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 chown
ed 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?
To Solve 'virtualenv' is not recognized as an internal or external command, operable program or batch file Error You just need to reinstall virtualenv.
A tool for creating isolated virtual python environments. Installation.
There is no command for deleting your virtual environment. Simply deactivate it and rid your application of its artifacts by recursively removing it. Note that this is the same regardless of what kind of virtual environment you are using.
Solution:
If you created the virtualenv as root, run the following command:
sudo chown -R your_username:your_username path/to/virtuaelenv/
This will probably fix your problem.
Cheers
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
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With