Upgrade asdf's python

Danny CrastoDanny Crasto
1 min read

It's a fairly straight forward process to upgrade a python version in asdf.

asdf update
asdf install python <version>
asdf global python <version>

However I kept running into the follow when installing pipx

pip install pipx
ERROR: Could not find an activated virtualenv (required).

ensure pip uses the right python via alias pip='python -mpip'

After a little digging, I figured out the self inflicted error.

It's always a good idea to avoid install python packages to your global i.e: not in a virtual environment. Do this by adding it to your pip config file via

pip config set global.require-virtualenv True

pipx does this for you by default, but it needs to be installed in your "global" (actually asdf's) python. The work around is to temporarily disable it to install pipx.

I'm documenting here for anyone else that run's into this and for my future self.

References

0
Subscribe to my newsletter

Read articles from Danny Crasto directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Danny Crasto
Danny Crasto

I am developer/code-reviewer/debugger/bug-fixer/architect/teacher/builder from dubai, uae