Use uv instead of pip if available

This commit is contained in:
Hanlei Qin
2025-10-25 12:33:14 +08:00
parent 119cadcb2b
commit 9f7b7ef889

View File

@@ -32,6 +32,11 @@ function check_installed_python() {
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "using ${PYTHON}" echo "using ${PYTHON}"
check_installed_pip check_installed_pip
PIP="${PYTHON} -m pip"
if [ -x "$(command -v uv)" ]; then
echo "uv detected — using it instead of pip for faster installation."
PIP="uv pip"
fi
return return
fi fi
done done
@@ -49,7 +54,7 @@ function updateenv() {
source .venv/bin/activate source .venv/bin/activate
SYS_ARCH=$(uname -m) SYS_ARCH=$(uname -m)
echo "pip install in-progress. Please wait..." echo "pip install in-progress. Please wait..."
${PYTHON} -m pip install --upgrade pip wheel setuptools uv ${PIP} install --upgrade pip wheel setuptools
REQUIREMENTS_HYPEROPT="" REQUIREMENTS_HYPEROPT=""
REQUIREMENTS_PLOT="" REQUIREMENTS_PLOT=""
REQUIREMENTS_FREQAI="" REQUIREMENTS_FREQAI=""
@@ -92,12 +97,12 @@ function updateenv() {
fi fi
fi fi
${PYTHON} -m uv pip install --upgrade -r ${REQUIREMENTS} ${REQUIREMENTS_HYPEROPT} ${REQUIREMENTS_PLOT} ${REQUIREMENTS_FREQAI} ${REQUIREMENTS_FREQAI_RL} ${PIP} install --upgrade -r ${REQUIREMENTS} ${REQUIREMENTS_HYPEROPT} ${REQUIREMENTS_PLOT} ${REQUIREMENTS_FREQAI} ${REQUIREMENTS_FREQAI_RL}
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "Failed installing dependencies" echo "Failed installing dependencies"
exit 1 exit 1
fi fi
${PYTHON} -m uv pip install -e . ${PIP} install -e .
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "Failed installing Freqtrade" echo "Failed installing Freqtrade"
exit 1 exit 1
@@ -252,7 +257,7 @@ function install() {
function plot() { function plot() {
echo_block "Installing dependencies for Plotting scripts" echo_block "Installing dependencies for Plotting scripts"
${PYTHON} -m uv pip install plotly --upgrade ${PIP} install plotly --upgrade
} }
function help() { function help() {