mirror of
https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI.git
synced 2025-03-03 20:34:54 +08:00
pyenv compatibility. Pyenv check was not working as intended, it should be inverted match (with -v). if pyenv exists in the system, it will now install python3.8 and set it as the default for the current folder This should give support to Arch Linux users, among other distros. Review needed, 2 questions: 1. Is it safe to set python3.8 as the default for the current folder? If you don't know and no one can verify, let's assume it is. I think it likely is, but I can't consider for every possibility. 2. Which version of python 3.8 do you prefer? If it's not 3.8.19, it should be changed to the one you wish to have installed (like 3.8.0)
67 lines
1.9 KiB
Bash
Executable File
67 lines
1.9 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
if [ "$(uname)" = "Darwin" ]; then
|
|
# macOS specific env:
|
|
export PYTORCH_ENABLE_MPS_FALLBACK=1
|
|
export PYTORCH_MPS_HIGH_WATERMARK_RATIO=0.0
|
|
elif [ "$(uname)" != "Linux" ]; then
|
|
echo "Unsupported operating system."
|
|
exit 1
|
|
fi
|
|
|
|
if [ -d ".venv" ]; then
|
|
echo "Activate venv..."
|
|
. .venv/bin/activate
|
|
else
|
|
echo "Create venv..."
|
|
requirements_file="requirements.txt"
|
|
|
|
# Check if Python 3.8 is installed
|
|
if ! command -v python3.8 >/dev/null 2>&1 || pyenv versions --bare | grep -qv "3.8"; then
|
|
echo "Python 3 not found. Attempting to install 3.8..."
|
|
if [ "$(uname)" = "Darwin" ] && command -v brew >/dev/null 2>&1; then
|
|
brew install python@3.8
|
|
elif [ "$(uname)" = "Linux" ] && command -v apt-get >/dev/null 2>&1; then
|
|
sudo apt-get update
|
|
sudo apt-get install python3.8
|
|
elif [ "$(uname)" = "Linux" ] && command -v pyenv >/dev/null 2>&1; then
|
|
pyenv install 3.8
|
|
pyenv local 3.8
|
|
alias python3.8=python
|
|
else
|
|
echo "Please install Python 3.8 manually."
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
python3.8 -m venv .venv
|
|
. .venv/bin/activate
|
|
|
|
# Check if required packages are installed and install them if not
|
|
if [ -f "${requirements_file}" ]; then
|
|
installed_packages=$(python3.8 -m pip freeze)
|
|
while IFS= read -r package; do
|
|
expr "${package}" : "^#.*" > /dev/null && continue
|
|
package_name=$(echo "${package}" | sed 's/[<>=!].*//')
|
|
if ! echo "${installed_packages}" | grep -q "${package_name}"; then
|
|
echo "${package_name} not found. Attempting to install..."
|
|
python3.8 -m pip install --upgrade "${package}"
|
|
fi
|
|
done < "${requirements_file}"
|
|
else
|
|
echo "${requirements_file} not found. Please ensure the requirements file with required packages exists."
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
# Download models
|
|
chmod +x tools/dlmodels.sh
|
|
./tools/dlmodels.sh
|
|
|
|
if [ $? -ne 0 ]; then
|
|
exit 1
|
|
fi
|
|
|
|
# Run the main script
|
|
python3.8 infer-web.py --pycmd python3.8
|