pipx does not copy site-packages in venvs when installing, resulting in error "No module named pip"
See original GitHub issueDescribe the bug
When trying to install any package with pipx
, a pip
error is thrown and a log created. The error is No module named pip
.
By digging and little and reproducing the commands that pipx
uses (present in the log), I realized that during the installation, pipx
correctly created the venvs
folder for the package that it was trying to install; however, the Lib/site-packages
of the venvs
folder is empty.
Therefore, as the folder does not contain the pip
package files, the installation throws an error when trying to use the command C:\Users\<USER NAME>\.local\pipx\venvs\pycowsay\Scripts\python.exe -m pip install <PACKAGE NAME>
.
How to reproduce
- Fresh installation of Windows 10
- Installation of Python 3.10.6 and of Anaconda (but making sure that
pipx
is installed with Python and not Anaconda, and correctly points to the Python installation) - Use the command
pipx install <PACKAGE NAME>
Expected behavior
The installation process should properly copy the necessary files in venvs/<PACKAGE NAME>/Lib/site-packages
, making the command C:\Users\<USER NAME>\.local\pipx\venvs\pycowsay\Scripts\python.exe -m pip install <PACKAGE NAME>
succeed and the installation completed.
Workaround
It is possible to create the folder venvs/<PACKAGE NAME>/Lib/site-packages
in advance of using the command pipx install <PACKAGE NAME>
, and to fill it with the files and folders present in C:\Users\<USER NAME>\.local\pipx\shared\Lib\site-packages
.
If this is done, using the command pipx install <PACKAGE NAME> --force
will complete the installation of the package properly.
Potential causes
- Problem with Anaconda installation ? There’s not reference to it in the
pipx
files, but who knows ? - I’ve installed a number of security tweaks and scripts with Windows 10. Maybe some of them are preventing
pipx
from copying the files properly ? Butpipx
is still able to create some folders and copy some files when attempting the installation; it’s just the files invenvs/<PACKAGE NAME>/Lib/site-packages
that are missing.
Issue Analytics
- State:
- Created a year ago
- Comments:6 (1 by maintainers)
Top GitHub Comments
I had the same issue after upgrading to Fedora 37 (which updated the main Python installation from 3.10 to 3.11.0rc2). Removing
~/.local/pipx/shared
andpipx reinstall-all
solved the problem. Thank you!@meowmeowmeowcat, does this fix solve this? (it did for me, albeit on MacOS)