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

If you have multiple versions of Python and try to install the packages using the pip3 install <package> command Python will throw an error defaulting to user installation because normal site-packages is not writeable.

In this article, we will take a look at what is defaulting to user installation because normal site-packages is not writeable and how to fix this error.

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

There are several reasons behind this error and some of the most common issues and solutions are mentioned below.

Issue 1: Multiple Versions of Python

In the case of Linux environments, Python comes by default and the version of Python depends on a different distribution of Linux and you may have installed a different version of Python.

Now when you are using pip install <pacakage_name> command to install the packages it will throw the error site-packages are not writable.

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.

Solution 1 – Specify Python Interpreter while installing packages

To install the packages try running the below command by appending the Python command to it. This will ensure the correct Python interpreter is specified and the packages will be installed over there.

Python 3

python3 -m pip install [package_name]

Python 2

python -m pip install [package_name]

If this also throws an error the better way is to resolve this issue is to append the exact version of Python will installing the packages.

Install Package using Specific Python Interpreter version

python3.7 -m pip install [package_name]

Solution 2 – Install Virtual Environment

A virtual environment creates an isolated Python virtual environment and keeps all the dependencies for the project inside it. This would be the ideal solution to resolve the conflict.

Follow the steps to create the virtual environment for your project.

Step 1: Install Virtual Environment Module in Python

$ pip install virtualenv

Step 2: Verify if the Virtual environment is installed properly by checking its version

$ virtualenv --version

Step 3: Create a new virtual environment for your project

$ virtualenv my_name

After running this command, a directory named my_name will be created. This is the directory that contains all the necessary executables to use the packages that a Python project would need. This is where Python packages will be installed.

Step 4: Specify the Python interpreter of your choice. This will be useful if you have multiple versions of Python installed.

$ virtualenv -p /usr/bin/python3 virtualenv_name

Step 5: Activate the Virtual Environment

$ source virtualenv_name/bin/activate

Issue 2 – Permission Issue

If you have multiple user accounts in Linux/Mac/Windows do check if the Python is installed for specific users or all the users. Many times if it’s accessible only by specific users and hence you get an error that site-packages are not writeable.

Solution – Install Python for specific user and grant permissions

Verify if Python is installed for all the users and has the correct permissions to write and install the packages.


Mostly when you have multiple version of Python installed on your machine and if your OS also comes with default version of Python there would be a conflict and when you install the packages Python will throw defaulting to user installation because normal site-packages is not writeable.

The best way to resolve this issue is by Creating the virtual environment or specifying the exact version of Python interpreter while installing the packages.

Leave a Reply

Your email address will not be published.

Sign Up for Our Newsletters

Subscribe to get notified of the latest articles. We will never spam you. Be a part of our ever-growing community.

You May Also Like
Python String Encode()

Python String encode()

Table of Contents Hide encode() Syntaxencode() Parameter encode() Return ValueExample 1- Encode the string to Utf-8 EncodingExample 2- UnicodeEncodeError while encoding stringExample 3- Handling Encoding errors with error parameters Python String…
View Post