mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-11-29 00:23:07 +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).
|
||||
|
||||
!!! 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.
|
||||
|
||||
!!! Warning "Up-to-date clock"
|
||||
|
||||
26
setup.sh
26
setup.sh
@@ -6,6 +6,7 @@ function echo_block() {
|
||||
echo $1
|
||||
echo "----------------------------"
|
||||
}
|
||||
UV=false
|
||||
|
||||
function check_installed_pip() {
|
||||
${PYTHON} -m pip > /dev/null
|
||||
@@ -24,6 +25,13 @@ function check_installed_python() {
|
||||
echo "You can do this by running 'deactivate'."
|
||||
exit 2
|
||||
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
|
||||
do
|
||||
@@ -32,6 +40,7 @@ function check_installed_python() {
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "using ${PYTHON}"
|
||||
check_installed_pip
|
||||
PIP="${PYTHON} -m pip"
|
||||
return
|
||||
fi
|
||||
done
|
||||
@@ -49,7 +58,7 @@ function updateenv() {
|
||||
source .venv/bin/activate
|
||||
SYS_ARCH=$(uname -m)
|
||||
echo "pip install in-progress. Please wait..."
|
||||
${PYTHON} -m pip install --upgrade pip wheel setuptools
|
||||
${PIP} install --upgrade pip wheel setuptools
|
||||
REQUIREMENTS_HYPEROPT=""
|
||||
REQUIREMENTS_PLOT=""
|
||||
REQUIREMENTS_FREQAI=""
|
||||
@@ -70,7 +79,7 @@ function updateenv() {
|
||||
fi
|
||||
if [ "${SYS_ARCH}" == "armv7l" ] || [ "${SYS_ARCH}" == "armv6l" ]; then
|
||||
echo "Detected Raspberry, installing cython, skipping hyperopt installation."
|
||||
${PYTHON} -m pip install --upgrade cython
|
||||
${PIP} install --upgrade cython
|
||||
else
|
||||
# Is not Raspberry
|
||||
read -p "Do you want to install hyperopt dependencies [y/N]? "
|
||||
@@ -92,12 +101,12 @@ function updateenv() {
|
||||
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
|
||||
echo "Failed installing dependencies"
|
||||
exit 1
|
||||
fi
|
||||
${PYTHON} -m pip install -e .
|
||||
${PIP} install -e .
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed installing Freqtrade"
|
||||
exit 1
|
||||
@@ -179,7 +188,12 @@ function recreate_environments() {
|
||||
fi
|
||||
|
||||
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
|
||||
echo "Could not create virtual environment. Leaving now"
|
||||
exit 1
|
||||
@@ -252,7 +266,7 @@ function install() {
|
||||
|
||||
function plot() {
|
||||
echo_block "Installing dependencies for Plotting scripts"
|
||||
${PYTHON} -m pip install plotly --upgrade
|
||||
${PIP} install plotly --upgrade
|
||||
}
|
||||
|
||||
function help() {
|
||||
|
||||
Reference in New Issue
Block a user