Last updated: Apr 10, 2024
Reading timeยท2 min

The error "Can not perform a '--user' install. User site-packages are not visible in this virtualenv" occurs for multiple reasons:
pip install command with the --user option with a virtual
environment active.pylint) with a virtual
environment active.user property set to true in your pip.conf file.
To solve the error:
venv folder.pyvenv.cfg file.include-system-site-packages property to true.pip install command.
You might have to reactivate the virtual environment after setting
include-system-site-packages to true.
# ๐๏ธ Deactivate deactivate # ๐๏ธ Activate on macOS and Linux source venv/bin/activate # ๐๏ธ Activate on Windows (cmd.exe) venv\Scripts\activate.bat # ๐๏ธ Activate on Windows (PowerShell) venv\Scripts\Activate.ps1
include-system-site-packages property to true in your pyvenv.cfg file.If you got the error when explicitly running a pip install command with the
--user option, you can:
sudo prefix to install the module globally (macOS or Linux)# ๐๏ธ Deactivate the virtual environment deactivate # ๐๏ธ Install the module with the `--user` option pip install requests --user pip3 install requests --user python -m pip install requests --user python3 -m pip install requests --user py -m pip install requests --user

sudo to install the package globallyAlternatively, you can prefix the command with sudo on macOS or Linux to
install the module globally.
sudo pip install requests --user sudo pip3 install requests --user sudo python -m pip install requests --user sudo python3 -m pip install requests --user
user variable to true in your global pip.conf file.The location of the pip.conf file is going to differ depending on your
operating system.
You can check
this section of the docs
to view the locations of pip.conf on the different operating systems.
If you still get the error even when installing packages without the --user
option, make sure you haven't set the user variable to true in your
pip.conf file.