switch pyenv to uv (#248)

* switch pyenv to uv

* resolve issues

* remove uv upgrade
This commit is contained in:
coder351
2024-07-18 23:46:21 +05:00
committed by GitHub
parent c079a39be9
commit 7d1a421b60
+14 -11
View File
@@ -2,20 +2,23 @@
echo "Installing python for openpilot"
# Install pyenv
export PYENV_ROOT="/usr/local/pyenv"
curl https://pyenv.run | bash
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
echo "installing uv..."
curl -LsSf https://astral.sh/uv/install.sh | sh
UV_BIN='$HOME/.cargo/env'
ADD_PATH_CMD=". \"$UV_BIN\""
eval $ADD_PATH_CMD
PYTHON_VERSION="3.11.4"
if [ "$(uname -p)" == "aarch64" ]; then
pyenv install --verbose $PYTHON_VERSION
uv python install $PYTHON_VERSION
else
MAKEFLAGS="-j1" MAKE_OPTS="-j1" taskset --cpu-list 0 pyenv install --verbose $PYTHON_VERSION
MAKEFLAGS="-j1" MAKE_OPTS="-j1" taskset --cpu-list 0 uv python install --verbose $PYTHON_VERSION
fi
echo "Setting global python version"
pyenv global $PYTHON_VERSION
pip3 install --no-cache-dir --upgrade pip uv
# uv requires virtual env either managed or system before installing dependencies
uv venv --python-preference only-system
# need to activate virtual env otherwise call to uv pip install throws error,
# error: No virtual or system environment found for path ...
source .venv/bin/activate
# install dependencies using system python
uv pip install --python=$(which python) --no-cache-dir --upgrade pip