[Solved] pip/python: normal site-packages is not writeable

I have a new Macbook – a user installed it, and then I installed a new user (mine), granted admin privileges and deleted the old one. I am on OS Catalina.

Since the installation I’ve been having several permission problems.
VSCode can’t find Jupyter Notebook, pip installs packages at ~/Library/Python/3.7/site-packages.

When I do which python3 I get usr/bin/python3.
When I do pip3 install <package> I get: Defaulting to user installation because normal site-packages is not writeable And then it says it has already been installed, even though I can’t access it when I do import <package>.

It’s seems clear that this is a permission problem, pip can’t install to the “base” python, and them python can’t find what I’ve installed into ~/Library/Python/3.7/site-packages.

I’ve tried reinstalling the OS, but since I haven’t done a clean install, it didn’t change anything.
What am I missing?
How exactly can I fix permissions? Where do I want packages to be installed (venv sure, but some packages I want global (like jupyter).


Solution #1:

As @TomdeGeus mentioned in the comments, this command works for me:

python3 -m pip install [package_name]
Respondent: lowercase00

Solution #2:

It’s best to not use the system-provided Python directly. Leave that one alone since the OS can change it in undesired ways, as you experienced.

The best practice is to configure your own Python version(s) and manage them on a per-project basis using virtualenv (for Python 2) or venv (for Python 3). This eliminates all dependency on the system-provided Python version, and also isolates each project from other projects on the machine.

Each project can have a different Python point version if needed, and gets its own site_packages directory so pip-installed libraries can also have different versions by project. This approach is a major problem-avoider.

Respondent: Dammio

Solution #3:

python3.7 -m pip install [package_name]

solved it for me.

The most voted answer python3 -m pip install [package_name] does not help me here.

In my case, this was caused by a conflict with the dominating 3.6 version that was also installed.

Here is a proof by example --upgrade pip:

pip3 install --upgrade pip

Defaulting to user installation because normal site-packages is not
writeable Requirement already satisfied: pip in
/home/USERNAME/.local/lib/python3.6/site-packages (20.3.1)

python3 -m pip install --upgrade pip

Defaulting to user installation because normal site-packages is not
writeable Requirement already satisfied: pip in
/home/USERNAME/.local/lib/python3.6/site-packages (20.3.1)

python3.7 -m pip install --upgrade pip

Collecting pip Cache entry deserialization failed, entry ignored
Using cached
Installing collected packages: pip Successfully installed pip-20.3.1

Respondent: Chris Johnson

Solution #4:

I had the Same issue with Jetson Nano, Used Sudo and it worked

So try sudo with pip.

Respondent: questionto42

Solution #5:

It occurs with me when I the virtual enviroment folder name was : venv.

in this case, It gives errors like :

No module pip

Default folder is unwritable

renaming the folder solve the proplem.

Respondent: Lakshay

Solution #6:

Had this same issue on a fresh install of Debian 9.12.
Rebooting my server solved the issue.

Respondent: tabebqena

Solution #7:

in my case python3 -m pip install [package_name] did not solve that.
in my case, it was a problem related to other processes occupying the directory.
I restart Pycharm and close any other program that might occupy this folder, and reinstalled the package in site-packages directory successfully.

Respondent: Chris S

The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .

Most Popular

To Top
India and Pakistan’s steroid-soaked rhetoric over Kashmir will come back to haunt them both clenbuterol australia bossier man pleads guilty for leadership role in anabolic steriod distribution conspiracy