installing pkg from virtualenv still put binary on ~/.local/bin/

Viewed 24

with a fresh pyenv virtualenv created:

$ pyenv virtualenv 3.8.10 da38
$ pyenv activate da38
(da38) $

I install mypy from this virtualenv:

(da38) $ pip3.8 install mypy
Collecting mypy
  Using cached mypy-0.971-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (17.3 MB)
Requirement already satisfied: mypy-extensions>=0.4.3 in /home/fox/.pyenv/versions/3.8.10/envs/da38/lib/python3.8/site-packages (from mypy) (0.4.3)
Requirement already satisfied: typing-extensions>=3.10 in /home/fox/.pyenv/versions/3.8.10/envs/da38/lib/python3.8/site-packages (from mypy) (4.3.0)
Requirement already satisfied: tomli>=1.1.0 in /home/fox/.pyenv/versions/3.8.10/envs/da38/lib/python3.8/site-packages (from mypy) (2.0.1)
Installing collected packages: mypy
Successfully installed mypy-0.971
(da38) $ 

mypy is not found (despite of the fact we are on an activated virtualenv, mypy is still the ~/.local/bin/mypy

(da38) $ mypy
Traceback (most recent call last):
  File "/home/fox/.local/bin/mypy", line 5, in <module>
    from mypy.__main__ import console_entry
ModuleNotFoundError: No module named 'mypy'
(da38) $ which mypy
/home/fox/.local/bin/mypy
(da38) $

very strange:

(da38) f$ which pip
/home/fox/.local/bin/pip
(da38) $ which pip3
/home/fox/.local/bin/pip3
(da38) $ which pip3.8
/home/fox/.pyenv/shims/pip3.8
(da38) $ 

(da38) $ pyenv which pip
/home/fox/.pyenv/versions/da38/bin/pip
(da38) $ pyenv which pip3
/home/fox/.pyenv/versions/da38/bin/pip3
(da38) $ pyenv which pip3.8
/home/fox/.pyenv/versions/da38/bin/pip3.8
(da38) $

if I explicitly give the full path to the mypy scrip in virtualenv it works:

(da38) $ /home/fox/.pyenv/versions/3.8.10/envs/da38/bin/mypy daudit/sap.py 
Success: no issues found in 1 source file
(da38) $ 

the pyenv virtualenv is working fine:

(da38) $ pyenv virtualenvs
  3.8.10/envs/da38 (created from /home/fox/.pyenv/versions/3.8.10)
* da38 (created from /home/fox/.pyenv/versions/3.8.10)
(da38) $

pip3.8 did the correct job to install mypy on the correct pyenv virtualenv

(da38) $ pip3.8 show mypy
Name: mypy
Version: 0.971
Summary: Optional static typing for Python
...
Location: /home/fox/.pyenv/versions/3.8.10/envs/da38/lib/python3.8/site-packages
Requires: mypy-extensions, tomli, typing-extensions
(da38) $ 

Could be kind of related to https://github.com/pypa/pip/issues/6264 and/or https://lists.debian.org/debian-python/2022/03/msg00039.html

0 Answers
Related