pipx icon indicating copy to clipboard operation
pipx copied to clipboard

pipx does not copy site-packages in venvs when installing, resulting in error "No module named pip"

Open Klemet opened this issue 3 years ago • 0 comments

Describe 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 ? But pipx is still able to create some folders and copy some files when attempting the installation; it's just the files in venvs/<PACKAGE NAME>/Lib/site-packages that are missing.

Klemet avatar Aug 22 '22 14:08 Klemet