"Defaulting to user installation because normal site-packages is not writeable" python message

Question:

Whenever I try to install a new python package I get this message first :

Defaulting to user installation because normal site-packages is not writeable

even though I have administrator rights and I am running my py scripts and installation commands on my computer.

Any ideas why I keep getting this message before every and each pip installation?

Asked By: Wallflower

||

Answers:

first I need to ask when you open cmd, is python added to path? when you type ‘python’ in cmd does something happen? If not, try to add python to path, otherwise if that doesn’t work, try re-installing python. Also which version of python do you have? Does this happen with every package you try to install? Finally if nothing works, try to change the download location of python, and run cmd as admin/without admin, try both.

Answered By: Samoshi

For anyone who does not wanna reinstall python, if u get the defaulter message, then all you have to do is go to AppData>Roaming>Python>Python3.(X)>site-packages. Cut the folders that are related to the package(U can identify by seeing the date modified), and paste the folders in originally installed python.exe destination then>Lib>site-packages. Hopefully when you restart the code editor modules will work. I did this and it worked.

You can copy packages file to AppData>Roaming>Python>Python3.(X)>script directory

Answered By: hamidreza bina

While this most likely is to be avoided, the only option I found to work is to use the –ignore-installed switch such as:

pip install -U --ignore-installed python-openstackclient

as root which allowed python to overwrite all old distro files with the correct new versions.

Answered By: Nab Eng

This is an old question, but it mirrored my problem well. After running python3 -m virtualenv myproject, it created myproject/local/bin/activate instead of myproject/bin/activate, and after sourcing this file, pip3 install some_package would report Defaulting to user installation because normal site-packages is not writeable and proceed to install packages as the user rather than the virtual environment.

The fix for both issues was:

sudo pip3 uninstall virtualenv
sudo apt install -y python3-virtualenv

This second command will be different for non-Debian distributions.

Answered By: bitinerant
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.