Defaulting to user installation because normal site-packages is not writeable Error (HOW TO FIX)

When you see the message “Defaulting to user installation because normal site-packages is not writeable,” it means that the program you’re running is trying to install something on your computer but is having trouble doing so.

In this case, the program is Python, and it wants to install a package (which is a collection of code that adds extra features or functionality to Python). Normally, Python would install packages in a specific folder called “site-packages” that is shared by all users on the computer.

Possible Causes

Here are some possible scenarios that can trigger the error:

  1. Insufficient permissions: Your computer may not allow Python to make changes to the system-wide site packages directory. This can occur if you’re using a computer that is shared with other users or if you don’t have administrative privileges.
  2. Virtual environments: If you’re using virtual environments to manage your Python projects, sometimes they are set up in a way that prevents writing to the system-wide site packages directory.
  3. Misconfigured Python installation: If your Python installation is misconfigured or incomplete, it may lead to this error. For example, if the system-wide site packages directory doesn’t exist or has incorrect permissions, Python will fall back to the user installation.
  4. Package managers: If you’re using a package manager that installs Python packages in the system-wide site packages directory (e.g., pip without the --user flag), but the necessary permissions are lacking, this error may occur.
  5. Operating system restrictions: Certain operating systems, such as macOS, have increased security measures that limit write access to system directories. In such cases, Python might default to the user installation to avoid permission issues.

How to fix this error

Here are some solutions to try:

  • Run the installation command with administrative privileges (e.g., using sudo on Unix-based systems) to allow Python to write to the system-wide site packages directory.
  • Use the --user option: When installing packages, you can add the --user option to the command. This tells Python to install the packages in a location specific to your user account, bypassing the system-wide directory. For example, instead of running pip install package-name, you would run pip install --user package-name.
  • Use virtual environments without the --system-site-packages flag to create isolated environments with their own writable site packages directories.
  • Verify and fix any misconfigurations in your Python installation or the system-wide site packages directory.
  • If operating system restrictions are causing the issue, you may need to adjust the permissions or seek additional guidance specific to your operating system.