Macos defaulting to user installation because normal site-packages is not writeable

pippython: normal site-packages is not writeable

Questions : pippython: normal site-packages is not writeable

2022-08-02T04:03:33+00:00 2022-08-02T04:03:33+00:00

637

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

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

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

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

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

Total Answers 13

29

Answers 1 : of pippython: normal site-packages is not writeable

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

Python 3:

python3 -m pip install [package_name]

Python 2:

python -m pip install [package_name]

0

2022-08-02T04:03:33+00:00 2022-08-02T04:03:33+00:00Answer Link

mRahman

3

Answers 2 : of pippython: normal site-packages is not writeable

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

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

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

0

2022-08-02T04:03:33+00:00 2022-08-02T04:03:33+00:00Answer Link

miraj

5

Answers 3 : of pippython: normal site-packages is not writeable

python3.7 -m pip install [package_name]

(you should use the version that you anycodings_python have, of course)

solved it for me.

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

In my case, this was caused by a anycodings_python conflict with the dominating 3.6 version anycodings_python that was also installed as a default. anycodings_python You might ask yourself why you have 3.6 anycodings_python on your system, you will most probably anycodings_python not use that version now. The reason is anycodings_python that 3.6 is used as an independent anycodings_python default python version for many package anycodings_python installers. Those installers do not want anycodings_python to check which individual version you anycodings_python use and whether that fits, they just use anycodings_python 3.6 as a default, if you like it or not.

Here is a proof by example --upgrade anycodings_python pip:

pip3 install --upgrade pip

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

python3 -m pip install --upgrade pip

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

python3.7 -m pip install --upgrade pip

Collecting pip Cache entry anycodings_python deserialization failed, entry anycodings_python ignored Using cached anycodings_python https://files.pythonhosted.org/packages/ab/11/2dc62c5263d9eb322f2f028f7b56cd9d096bb8988fcf82d65fa2e4057afe/pip-20.3.1-py2.py3-none-any.whl Installing anycodings_python collected packages: pip Successfully anycodings_python installed pip-20.3.1

0

2022-08-02T04:03:33+00:00 2022-08-02T04:03:33+00:00Answer Link

miraj

1

Answers 4 : of pippython: normal site-packages is not writeable

sudo pip install

Worked for me. But pip install is not anycodings_python recommended to be run with sudo. The anycodings_python issue I was facing on BIGSUR was, it was anycodings_python using system python. Once I Installed anycodings_python python 3.9 using

brew install

Then pip worked fine

0

2022-08-02T04:03:33+00:00 2022-08-02T04:03:33+00:00Answer Link

miraj

5

Answers 5 : of pippython: normal site-packages is not writeable

It occurs with me when I the virtual anycodings_python 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.

0

2022-08-02T04:03:33+00:00 2022-08-02T04:03:33+00:00Answer Link

joy

6

Answers 6 : of pippython: normal site-packages is not writeable

For readers in 2022 who thought themselves accidentally update system pip:

If you saw this info in your terminal anycodings_python output:

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

then you will be fine. Use the pip3 you anycodings_python just updated to run:

pyenv global system # since I use pyenv pip3 uninstall pip # this one does the trick

Then you can check again pip3 --version anycodings_python will point to the original old anycodings_python (XCode/System-)pip. E.g. (2022/2/28):

pip 20.2.3 from /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/pip (python 3.8)

0

2022-08-02T04:03:33+00:00 2022-08-02T04:03:33+00:00Answer Link

joy

2

Answers 7 : of pippython: normal site-packages is not writeable

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

0

2022-08-02T04:03:33+00:00 2022-08-02T04:03:33+00:00Answer Link

jidam

1

Answers 8 : of pippython: normal site-packages is not writeable

I'm using Anaconda on Ubuntu and had the anycodings_python same problem.I fixed it by the following anycodings_python steps:

deactivating current environment

conda deactivate

Then, the base environment activates. I anycodings_python deactivated the base conda environment anycodings_python too. To do so, I used conda deactivate anycodings_python again.

Finally, I activate my project anycodings_python environment directly (instead of anycodings_python activating from the base environment) by anycodings_python the following command. Afterward, I anycodings_python installed the intended package anycodings_python successfully and worked perfectly.

conda activate myenv pip install somepackage

0

2022-08-02T04:03:33+00:00 2022-08-02T04:03:33+00:00Answer Link

jidam

5

Answers 9 : of pippython: normal site-packages is not writeable

In my case on Linux, the ownership of anycodings_python the conda env directory had changed to anycodings_python another Linux user (long story), and so anycodings_python the the normal site-packages was not anycodings_python writeable due to a permissions issue.

The solution was to change ownership anycodings_python back to the user doing pip install.

0

2022-08-02T04:03:33+00:00 2022-08-02T04:03:33+00:00Answer Link

raja

5

Answers 10 : of pippython: normal site-packages is not writeable

I met exactly the same issue.

I just type sudo python3.8 -m pip anycodings_python install .... and the error disappeared.

If I remove the sudo, issue remains.

0

2022-08-02T04:03:33+00:00 2022-08-02T04:03:33+00:00Answer Link

raja

5

Answers 11 : of pippython: normal site-packages is not writeable

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

0

2022-08-02T04:03:33+00:00 2022-08-02T04:03:33+00:00Answer Link

joy

6

Answers 12 : of pippython: normal site-packages is not writeable

When this problem occurred to me I have anycodings_python tried all the mentioned approaches but anycodings_python they don't seem to work.

Instead, restarting Python language anycodings_python server in my VSCode did the job - my anycodings_python SimPy package is now found. On Mac it is anycodings_python Cmd+Shift+P and select "Python: Restart anycodings_python Language Server".

0

2022-08-02T04:03:33+00:00 2022-08-02T04:03:33+00:00Answer Link

miraj

1

Answers 13 : of pippython: normal site-packages is not writeable

Had similar issue on Ubuntu 20.04.4 LTS anycodings_python in VirtualBox, but none of the anycodings_python suggestions here worked for me.

I was trying to install open3d in a venv anycodings_python and every time I was getting "Defaulting anycodings_python to user installation because normal anycodings_python site-packages is not writeable" which at anycodings_python first I didn't even noticed. open3d was anycodings_python always being installed in anycodings_python /usr/bin/python3 environment. I've anycodings_python restarted the VM but without luck, so I anycodings_python guess the problem was not just missing anycodings_python write access.

So in VS Code, which was using the venv, anycodings_python importing open3d was not possible. But anycodings_python testing from terminal from the activated anycodings_python venv with python3 -c "import open3d as anycodings_python o3d; print(o3d.__version__)" was working anycodings_python fine and that confused me totally. I anycodings_python even broke my system pip installation anycodings_python using sudo, see further below if you anycodings_python want to know how to fix it.

Anyhow, the solution to my problem was anycodings_python to explicitly point to the python3 file anycodings_python in the venv where I wanted to install anycodings_python the package:

venv/bin/python3 -m pip install open3d

So I was testing out everything and anycodings_python eventually installed with sudo: sudo anycodings_python pip3 install open3d. This of course anycodings_python didn't solved the problem and open3d was anycodings_python still missing in the venv. Even worse, I anycodings_python got the message:

"WARNING: You are using pip version anycodings_python 21.3.1; however, version 22.0.4 is anycodings_python available. You should consider upgrading anycodings_python via the '/usr/bin/python3 -m pip install anycodings_python --upgrade pip' command."

So I did it but with sudo, updating the anycodings_python system pip and then found out here that anycodings_python this is not good:

WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv

Following an advice here, I tried to anycodings_python revert to original version, only then anycodings_python pip3 broke:

sudo pip3 uninstall pip sudo pip3 --version sudo: pip3: command not found

The apt package was still there:

sudo apt install python3-pip python3-pip anycodings_python is already the newest anycodings_python version (20.0.2-5ubuntu1.6).

So I had to reinstalled to fix the anycodings_python problem:

sudo apt-get remove python3-pip sudo apt install python3-pip

0

2022-08-02T04:03:33+00:00 2022-08-02T04:03:33+00:00Answer Link

miraj

How do I fix defaulting to user installation because normal site packages are not writeable?

How to correct the error “Defaulting to user installation because normal site-packages is not writeable”.
Solution 1: The python need be Reinstalled..
Solution 2: Modify the download the python's location..
Solution 3: Make sure to update the Python version..
Solution 4: Operate python version when you install the package..

What does defaulting to user installation because normal site packages is not writeable mean?

The reason behind this is that you have multiple versions of Python and since you are using pip / pip3 it would try to add the packages in the default version of Python which is managed by Python and hence it will throw an error.

How do I download requirements for texting?

txt file..
cd to the directory where requirements.txt is located..
activate your virtualenv..
run: pip install -r requirements.txt in your shell..

Does Python install pip?

PIP is automatically installed with Python 2.7. 9+ and Python 3.4+ and it comes with the virtualenv and pyvenv virtual environments.