Defaulting to user installation because normal site-packages is not writeable – How To Fix It?

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

If you are facing the warning “defaulting to user installation because normal site-packages is not writeable”, read carefully our tutorial below. We will give you some solutions to deal with the problem.

Reason for this warning in Python

Note that this is not a bug. You can only not access your system site-packages so pip will install your packages into your user site-packages. 

This is a common warning caused by two reasons: one is you have multiple versions of Python on your device, and another is your account has no permission to access the system.

How to fix the warning “defaulting to user installation because normal site-packages is not writeable”

Solution to multiple versions of Python

  • Reinstall python interpreter

If your operating system is windows, you can easily uninstall Python and then reinstall it from settings by following the sequence steps:

  • Step 1: Select Start -> Settings -> Apps -> Apps and Features 
  • Step 2: Select Python, then click More and Uninstall

You can also remove Python from the Control Panel by searching Control Panel on the taskbar. Then select Programs -> Programs and Feature. Finally, right-click on the program you want to remove and select Uninstall.

After that, direct to its website to download and reinstall it.

In case your operating system is Linux, you can uninstall Python from the terminal by using the command:

sudo apt-get autoremove python3

Because Python is relative to other software, you must reinstall them again.

sudo apt install software-properties-common
sudo apt-get install python3
sudo apt-get install ubuntu-desktop
  • Specify Python Version to install new packets

In Windows:

Check all installation of Python by command:

dir site.py /s

Then choose a version to install a new packet.

In Linux:

First, check all current versions in your system:

ls -ls /usr/bin/python*

Then, select the version you want to use and install the packet. For example, we use version 3.8 to install pygame.

python3.8 -m pip install pygame
  • Update pip

Another way to solve the warning is update pip:

Command in Windows:

python -m pip install --upgrade pip

Command in Linux:

pip install --upgrade pip

Solution to permission issue

If multiple versions of Python do not cause the warning, it must be the permission problem. Make sure that Python is available to all users, which is set up the first time you install Python. 

To fix this issue, go to Apps and Features in settings, then modify your Python and make sure you tick the “Install for all users” cell.

Summary

You have been through our article to get rid of the warning “defaulting to user installation because normal site-packages is not writeable” in Python. Again, this is not a bug. You only can not access your system site packages, because pip installs your packages into your user site packages.

Maybe you are interested:

Leave a Reply

Your email address will not be published. Required fields are marked *