`Could not install packages due to an EnvironmentError: [Errno 1] Operation not permitted` in the virtual envinronment

Viewed 3401

I tried to make a python virtualenvironment using virtualenv in I type virtuelenv env --python=python3 I get an error

PermissionError: [Errno 1] Operation not permitted: '/mnt/d/venv/bin/python3'

So I used the command with sudo and therefore type sudo virtualenv env --python=python3

The command works this time, now I activate the environment and try to install something using pip, I get

Could not install packages due to an EnvironmentError: [Errno 1] Operation not permitted

I know for a fact that if use pip with sudo, it will install packages for the global site packages and no the site packages of the virtual environment. I want to install things to the virtual environment.

I am running ubuntu bionic on WSL, I used to run ubuntu xenial and didn't face this problem.

please advise.

1 Answers

When using WSL: Create the venv in the Linux hierarchy, not the Windows hierarchy.

Typically this means creating in /home/YOUR_USER/ instead of /mnt/....

Related