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

I am setting up a clean version of Ubuntu under WSL2, it needs to run python 3.7 because of some dependencies. The goal is to have a project folder with a virtual environment in it, and to be able to install packages into the venv.

The sequence of commands I use to set up the environment is

sudo apt update
sudo apt install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt install python3.7
sudo apt install python3-pip
sudo apt install python3-virtualenv

Everything works up to the point where I try and install a package into the venv. The commands are

cd ./OneDrive/dev/babyclix_stg
virtualenv -p /usr/bin/python3.7 .venv
source .venv/bin/activate
pip3 install requests

The last pip3 command then returns this exception/error message.

(.venv) dev@DESKTOP-6FAUQ4D:/mnt/c/Users/mark/OneDrive/dev/babyclix_stg$ pip3 install requests
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: requests in /usr/lib/python3/dist-packages (2.22.0)

My venv, which created successfully has this structure.

venv folder structure

I am obviously doing something basic incorrectly. Can someone please point out my error. Thanks



Read more here: https://stackoverflow.com/questions/64399064/python-pip-defaulting-to-user-installation-because-normal-site-packages-is-not-w

Content Attribution

This content was originally published by Mark Kortink at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: