“When trying to install Python packages, you may sometime encounter “default to user installation because regular site-packages are not writeable” error. In this attempt, we will explain why this error occurs and how we can resolve it.”

Let’s get started.

Causes of This Error

Various reasons may cause this error to occur. These include:

  1. Multiple Python versions
  2. Permission Error

The following are some of the techniques you can use to resolve this error.

Fix #1 – Specify the Explicit Version

Sometimes, you may have multiple versions of the Python interpreter installed. For example, if you have both Python version 3.9 and 3.10 installed, running the pip3 install <package_name> command will result in an error.

This is because Python will attempt to install the package in the default Python directory. This directory is directly managed by Python and will return an error.

Therefore, if you have multiple versions of the interpreter installed, you need to specify it in the command explicitly.

For example, to install a package with the Python3.10 pip, run the command:


$ python3.10 -m pip install <package_name>

The above should invoke the module associated with the specific Python interpreter and use it to install the specified package.

Fix #2 – Run Pip With the Sufficient Permissions

On a multi-user system such as Linux, you may face the “default to user installation because regular site-packages are not writeable” error due to insufficient permissions.

Therefore, ensure to run pip with sufficient permissions to access the installation directory.

Similarly, ensure that the installed Python interpreter is installed for users with sufficient permissions.

Fix #3 – Update Your Python Version

Another attempt you can take to resolve this is to update your Python version. This may force the system to reconfigure the interpreter and fix any issues.

Fix #4 – Re-Install Python

If neither of the above methods works, you can uninstall your current Python interpreter and re-install Python.


That’s it for this one. Although the reasons may vary, one major cause of the “defaulting to user installation because regular site-packages are not writeable” error is conflicting Python versions. We hope this article helped you resolve the issue.

Thanks for reading!!

Source link

“Almost everything productive we can do in Linux requires us to have a network connection. Whether developing apps, installing software, scripting, sharing files, or even watching movies, we need a working network connection. Hence, “I require a network connection” is simply an understatement. The only way to enable network connection on a machine is through a network interface.

A network interface is a device or a point of connection between a device and a private or public network. In most cases, a network interface is a physical card such as a wireless adapter, a network card, etc. However, this does not necessarily mean that a network interface should be a physical device. For example, a loopback adapter that is not physically visible is implemented by software and available on all devices.”

This quick tutorial will show you how to set the default interface in Linux.

Method 1 – Turn Off Adapters

The simplest way to set your default network interface is by disabling all other interfaces. For example, in Linux, you can use the GUI network manager or the terminal.

Suppose you have a wireless adapter and you wish to use the Ethernet adapter; in that case, you can bring down the wifi adapter using the command:

$ sudo ifconfig wlan0 down
$ sudo ifconfig eth0 up

The above commands will shut down the wireless adapter and bring up the ethernet adapter.

That will force the system to switch to the available network.

NOTE: The above command requires sudo or root privileges with the net-tools package installed.

Start by using the command:

The command above should list the default gateways available in the system, including the default interface.

An example output is as shown:

default via dev wlan0 proto dhcp metric 100 dev wlan0 scope link metric 1000 dev wlan0 proto kernel scope link src metric 100

As we can see from the output above, the default interface is set to wlan0. However, we can change this by following a few steps.

Start by removing all the default interfaces with the command:

$ sudo ip route flush 0/0

The command should remove all the default gateways. You can verify by running the ip list command:

An example output: dev wlan0 scope link metric 1000 dev wlan0 proto kernel scope link src metric 100

We can now proceed to add a default interface using the ip route command.

$ sudo ip route add default via dev eth0

NOTE: Ensure to replace the IP address of the interface with your desired one.

Merienda executed successfully, the command should add the interface eth0 is the default.

We can verify this by running the ip route command:

$ sudo ip route list
default via dev eth0 dev eth0 scope link metric 1000 dev eth0 proto kernel scope link src metric 100

The output shows that the default interface is set to eth0 with our specified IP address.


That’s it for this one. In this article, we discussed how to change your default interface in Linux in two primary methods.

Thanks for reading!!

Source link