Lo-Fi Python

May 17, 2023

How to Fix Pip Install Site-Packages --user Error

While running Python version 3.8.10 today, out of the blue I saw this error attempting to pip install a package in my virtual environment:

ERROR: Cannot perform a '--user' install. User site-packages are not visible in this virtualenv.

I found a Github thread that fixed the problem! You need to update your pyvenv.cfg in order to resolve this conflict.

Here is how to fix your Python environment from Github user jawalahe:

  1. Go to the pyvenv.cfg file in the virtual environment folder.
  2. Set include-system-site-packages to true and save the change.

After completing this, my pip installs worked again and no longer returned the error.