mirror of
https://github.com/freqtrade/freqtrade.git
synced 2026-02-03 21:00:25 +00:00
Merge pull request #12420 from qinhanlei/uv-pip
Add support for uv in setup.sh
This commit is contained in:
@@ -24,7 +24,7 @@ The easiest way to install and run Freqtrade is to clone the bot Github reposito
|
|||||||
The `stable` branch contains the code of the last release (done usually once per month on an approximately one week old snapshot of the `develop` branch to prevent packaging bugs, so potentially it's more stable).
|
The `stable` branch contains the code of the last release (done usually once per month on an approximately one week old snapshot of the `develop` branch to prevent packaging bugs, so potentially it's more stable).
|
||||||
|
|
||||||
!!! Note
|
!!! Note
|
||||||
Python3.11 or higher and the corresponding `pip` are assumed to be available. The install-script will warn you and stop if that's not the case. `git` is also needed to clone the Freqtrade repository.
|
Either [uv](https://docs.astral.sh/uv/), or Python3.11 or higher and the corresponding `pip` are assumed to be available. The install-script will warn you and stop if that's not the case. `git` is also needed to clone the Freqtrade repository.
|
||||||
Also, python headers (`python<yourversion>-dev` / `python<yourversion>-devel`) must be available for the installation to complete successfully.
|
Also, python headers (`python<yourversion>-dev` / `python<yourversion>-devel`) must be available for the installation to complete successfully.
|
||||||
|
|
||||||
!!! Warning "Up-to-date clock"
|
!!! Warning "Up-to-date clock"
|
||||||
|
|||||||
26
setup.sh
26
setup.sh
@@ -6,6 +6,7 @@ function echo_block() {
|
|||||||
echo $1
|
echo $1
|
||||||
echo "----------------------------"
|
echo "----------------------------"
|
||||||
}
|
}
|
||||||
|
UV=false
|
||||||
|
|
||||||
function check_installed_pip() {
|
function check_installed_pip() {
|
||||||
${PYTHON} -m pip > /dev/null
|
${PYTHON} -m pip > /dev/null
|
||||||
@@ -24,6 +25,13 @@ function check_installed_python() {
|
|||||||
echo "You can do this by running 'deactivate'."
|
echo "You can do this by running 'deactivate'."
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
if [ -x "$(command -v uv)" ]; then
|
||||||
|
echo "uv detected — using it instead of pip for faster installation."
|
||||||
|
PIP="uv pip"
|
||||||
|
PYTHON="python3.13"
|
||||||
|
UV=true
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
for v in 13 12 11
|
for v in 13 12 11
|
||||||
do
|
do
|
||||||
@@ -32,6 +40,7 @@ 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"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@@ -49,7 +58,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
|
${PIP} install --upgrade pip wheel setuptools
|
||||||
REQUIREMENTS_HYPEROPT=""
|
REQUIREMENTS_HYPEROPT=""
|
||||||
REQUIREMENTS_PLOT=""
|
REQUIREMENTS_PLOT=""
|
||||||
REQUIREMENTS_FREQAI=""
|
REQUIREMENTS_FREQAI=""
|
||||||
@@ -70,7 +79,7 @@ function updateenv() {
|
|||||||
fi
|
fi
|
||||||
if [ "${SYS_ARCH}" == "armv7l" ] || [ "${SYS_ARCH}" == "armv6l" ]; then
|
if [ "${SYS_ARCH}" == "armv7l" ] || [ "${SYS_ARCH}" == "armv6l" ]; then
|
||||||
echo "Detected Raspberry, installing cython, skipping hyperopt installation."
|
echo "Detected Raspberry, installing cython, skipping hyperopt installation."
|
||||||
${PYTHON} -m pip install --upgrade cython
|
${PIP} install --upgrade cython
|
||||||
else
|
else
|
||||||
# Is not Raspberry
|
# Is not Raspberry
|
||||||
read -p "Do you want to install hyperopt dependencies [y/N]? "
|
read -p "Do you want to install hyperopt dependencies [y/N]? "
|
||||||
@@ -92,12 +101,12 @@ function updateenv() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
${PYTHON} -m 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 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
|
||||||
@@ -179,7 +188,12 @@ function recreate_environments() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo
|
echo
|
||||||
${PYTHON} -m venv .venv
|
if [ "$UV" = true ] ; then
|
||||||
|
echo "- Creating new virtual environment with uv"
|
||||||
|
uv venv .venv --python=${PYTHON}
|
||||||
|
else
|
||||||
|
${PYTHON} -m venv .venv
|
||||||
|
fi
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "Could not create virtual environment. Leaving now"
|
echo "Could not create virtual environment. Leaving now"
|
||||||
exit 1
|
exit 1
|
||||||
@@ -252,7 +266,7 @@ function install() {
|
|||||||
|
|
||||||
function plot() {
|
function plot() {
|
||||||
echo_block "Installing dependencies for Plotting scripts"
|
echo_block "Installing dependencies for Plotting scripts"
|
||||||
${PYTHON} -m pip install plotly --upgrade
|
${PIP} install plotly --upgrade
|
||||||
}
|
}
|
||||||
|
|
||||||
function help() {
|
function help() {
|
||||||
|
|||||||
Reference in New Issue
Block a user