I used the Ubuntu repositories to install python3-dev, python3-setuptools, python3-virtualenv, python3-venv, and python3-pip. I then used pyvenv to create a virtual environment and source [dir] to activate it. Then, from within that environment, I used pip3 to install the cryptography module. After deactivating the environment and restarting my terminal I find that the module is available outside the environment. This is true even when I log out and back in or restart the computer.

My concern is that the libraries are being linked to the root install of Python and could cause conflicts with other libraries installed later within other virtual environments.

I know I can't link external discussions, but I've found credible online material that this is a bug in Ubuntu's implementation of pip. Can you confirm or deny and offer a solution?

1 Answer 1


You can only install packages into your system installation as root. When inside your virtual environment you shouldn't need to use "sudo" when installing any packages because the entire environment is owned by your user. If you get any "permission denied" errors when running pip in your virtualenv as non-root then there is something broken with the packages installer and it's trying to install into your system installation.

  • I didn't use sudo or get any error messages, and both Python3.x and pip3 were installed into my virtual environment directory by the pyvenv command. I neglected to use the which command to see whether they were the ones being called by the pip3 install command when I used it within the virtual environment, but I'll activate the virtual environment and add another comment reporting that. Jan 24, 2018 at 17:53
  • I just had a chance to check and the which command returns the virtual enviornment pip3 both from within the virtual environment and from outside it, both before and after the virtual environment has been deactivated. This happens even when I cd out of my home folder into the root folder before running which. Meanwhile, the local version of Python3 is called by which from inside the virtual environment but the /usr/local one is being called outside it both before and after it's deactivated, regardless of pwd. Jan 24, 2018 at 18:00
  • There must be some funny business with your environment then. What's your $PATH environmental variable set to?
    – Kevin
    Jan 25, 2018 at 1:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .