Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add envvar to allow upgrading pip before installing default-python-packages #179

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,14 @@ pipenv
```

You can specify a non-default location of this file by setting a `ASDF_PYTHON_DEFAULT_PACKAGES_FILE` variable.

### Upgrade pip before installing Default Python packages

In some cases (older verisons of pip - which come with older versions of Python) unpinned package versions in `$HOME/.default-python-packages` (or `ASDF_PYTHON_DEFAULT_PACKAGES_FILE` environment variable) may cause errors during pip install - due to latest package dependency versions not being available.

You can set the environment variable `ASDF_PYTHON_PKGS_UPGRADE_PIP_FIRST` (to either `true` or `True`) to first upgrade your pip version, before installing pacakges from `$HOME/.default-python-packages` (or `ASDF_PYTHON_DEFAULT_PACKAGES_FILE` environment variable):

```
export ASDF_PYTHON_PKGS_UPGRADE_PIP_FIRST=true
asdf install python 3.6.15
```
4 changes: 4 additions & 0 deletions bin/install
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ install_default_python_packages() {
local packages_file="${ASDF_PYTHON_DEFAULT_PACKAGES_FILE:-$HOME/.default-python-packages}"

if [ -f "$packages_file" ]; then
if [[ "${ASDF_PYTHON_PKGS_UPGRADE_PIP_FIRST:-}" =~ ^t|True ]]; then
echo "pip install --upgrade pip"
PATH="$ASDF_INSTALL_PATH/bin:$PATH" pip install --upgrade pip
fi
echo -ne "\nInstalling default python packages..."
PATH="$ASDF_INSTALL_PATH/bin:$PATH" pip install -U -r "$packages_file"
fi
Expand Down