python-3.xvisual-studio-codepipasdf-vm

unable to locate pip packages using asdf in VSC


I have just installed a fresh install of BigSur and Python (using asdf) when installing pip packages they seem to end up in:

./.asdf/installs/python/3.9.2/lib/python3.9/site-packages

when typing which flake8 for example I get flake8 not found but when I go to install it again pip install flake8 I get the following:

> which flake8
flake8 not found

~
> pip install flake8
Requirement already satisfied: flake8 in ./.asdf/installs/python/3.9.2/lib/python3.9/site-packages (3.8.4)
Requirement already satisfied: pycodestyle<2.7.0,>=2.6.0a1 in ./.asdf/installs/python/3.9.2/lib/python3.9/site-packages (from flake8) (2.6.0)
Requirement already satisfied: mccabe<0.7.0,>=0.6.0 in ./.asdf/installs/python/3.9.2/lib/python3.9/site-packages (from flake8) (0.6.1)
Requirement already satisfied: pyflakes<2.3.0,>=2.2.0 in ./.asdf/installs/python/3.9.2/lib/python3.9/site-packages (from flake8) (2.2.0)

I have just tried to use requests which I installed like pip install requests and I also got not found when using which but I manage to use the package in VSC ok.

I am using flake8 and Black and I need to give VSC their paths. I have used

./.asdf/installs/python/3.9.2/lib/python3.9/site-packages/<package name>

but VSC doesn't seem to pip it up. I am using the latest verisons.

> python -V
Python 3.9.2

~
> pip -V
pip 21.0.1 from /Users/paul/.asdf/installs/python/3.9.2/lib/python3.9/site-packages/pip (python 3.9)

this might help too:

~
> which python
/Users/paul/.asdf/shims/python

~
> which pip
/Users/paul/.asdf/shims/pip

Any idea how I can get which to display the correct paths so I can get my listing and formatting working ok?


Solution

  • This fixed it... https://til.hashrocket.com/posts/ques11vrjs-get-pip-installed-executables-into-the-asdf-path

    asdf reshim python

    I would be curious why I have to do this...if anyone could answer