pypipython-3.x95% confidence\u2191 117

How to avoid "Permission denied" when using pip with virtualenv

Full error message
I attempt to deploy a Python package with pip in a virtual environment on an Ubuntu machine, but encounter a permission-related issue. For example:

(TestVirtualEnv)test@testServer:~$ pip install markdown2

terminates by:

  error: could not create '/home/test/virtualenvs/TestVirtualEnv/lib/python3.3/site-packages/markdown2.py': Permission denied

I can't sudo, since it will install the package globally, and not within the virtual environment. I chowned site-packages; ls shows only directories related to easy_install, pip and setuptools, and nothing related to Markdown.

How to deploy a package in a virtual environment with pip without encountering permission-related errors?

virtualenv permission problems might occur when you create the virtualenv as sudo and then operate without sudo in the virtualenv. As found out in your question's comment, the solution here is to create the virtualenv without sudo to be able to work (esp. write) in it without sudo.

API access

Get this solution programmatically \u2014 free, no authentication.

curl https://depscope.dev/api/error/b8077f8ce3e05fe2ab792a0272df258c9ac18b6cb951324b946dbc8990ef3c4e
hash \u00b7 b8077f8ce3e05fe2ab792a0272df258c9ac18b6cb951324b946dbc8990ef3c4e
How to avoid "Permission denied" when using pip wi… — DepScope fix | DepScope