question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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.

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
d-k-bocommented, Oct 4, 2022

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 and pipx reinstall-all solved the problem. Thank you!

2reactions
zdog234commented, Sep 25, 2022

@meowmeowmeowcat, does this fix solve this? (it did for me, albeit on MacOS)

remove ~/.local/pipx/shared

Read more comments on GitHub >

github_iconTop Results From Across the Web

pipx install eth-brownie issue - python - Stack Overflow
Tried reinstalling pip and pipx. No problems installing eth-brownie through pip, but need it done through pipx. Below is the error message:
Read more >
pipenv Documentation - Read the Docs
Pipenv is a tool that aims to bring the best of all packaging worlds (bundler, composer, npm, cargo, yarn, etc.) to the. Python...
Read more >
Troubleshooting - pipx
This is a good fix for the following problems: System python was upgraded and the python used with a pipx-installed package is no...
Read more >
virtualenv(1) — Arch manual pages
The venv module does not offer all features of this library, to name just a few more ... python -m pip install --user...
Read more >
Eth-Brownie error No module named 'psutil._psutil_windows'
I tried installing brownie (with pipx) following multiple tutorials and docs, but I still get the same error. INFO: Could not find files...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found