How to avoid Permission denied when using pip with virtualenv
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
.
permission denied pip virtualenv
I don't think there's anything wrong with your pip installation. virtualenv is itself a Python module, and by default it goes in /usr/local/lib/python2.7/dist-packages, a folder for which your user does not have write permissions. If you have sudo access, it would be easiest to simply try:
sudo pip install virtualenv
Once you've done that, you should be able to create virtualenvs without needing to use sudo. Alternately, there are instructions here for making your own virtual environment, but it looks like you will likely need to do some manual editing of the script it directs you to download.
creating a virtualenv gives a permission denied
Looks like you're trying to create the virtualenv test
within /lib/python2.7/site-packages
, which, by all rights, you shouldn't have write access to.
Try running cd ~
first, to create the venv in your home directory.
Errno 13 Permission denied when running virtualenv
As suggested in a comment, there was an issue with a custom Distutils config file. This file can apparently be in one of three places (ref):
- system:
<prefix>/lib/pythonver/distutils/distutils.cfg
- personal:
$HOME/.pydistutils.cfg
- local:
setup.cfg
I had meanwhile created a setup.cfg
according to this SO answer here with content:
[install]
prefix=
I can no longer remember why I had consulted that answer, or why I had put that file there, but after I removed it, virtualenv worked fine again, and I'm not having any more issues.
Related Topics
Most Efficient Way to Search the Last X Lines of a File
Convert Dictionary Entries into Variables
Importerror After Cython Embed
Difference Between Python3 and Python3M Executables
Type Annotations for *Args and **Kwargs
Get All Object Attributes in Python
Does Flask Support Regular Expressions in Its Url Routing
Text Box with Line Wrapping in Matplotlib
How to Upload a File to Directory in S3 Bucket Using Boto
Recursive Definitions in Pandas
How to Plot Multi-Color Line If X-Axis Is Date Time Index of Pandas
Create a Main Loop with Tkinter
Finding Elements Not in a List
Understanding Time.Perf_Counter() and Time.Process_Time()
How to Schedule a Function to Run Every Hour on Flask
Python Selenium: Wait Until Element Is Clickable - Not Working