After successfully installling virtualenv in terminal with 'pip install virtualenv', I tried installing virtualwrapper with 'pip install virtualenvwrapper' and something seems to have gone wrong with some code presenting in red instead of the usual white. There was about 20-30 lines of code in essence it said the following:
Installing collected packages: virtualenv-clone, pbr, stevedore, virtualenvwrapper
Exception:
Traceback (most recent call last):
Then there is a list of file paths shown, followed by..
IOError: [Errno 13] Permission denied:
'/usr/local/lib/python2.7/dist-packages/clonevirtualenv.py'
Does anyone know what could have gone wrong and how I can fix it?
Thanks
when it's about permission problem you have try with sudo(super user).
if Linux,
$ sudo pip install virtualenvwrapper
if Windows,
open cmd with administration privilege and then,
pip install virtualenvwrapper
First, uninstall virtualenv
# you might need to use sudo depending on how you installed it
pip uninstall virtualenv
Then, install virtualenvwrapper with sudo
sudo pip install virtualenwrapper
Since virtualenvwrapper has virtualenv among its dependencies, it will take care of installing it - no need to do it manually.
You should install virtualenvwrapper via system package manager.
Either dnf install python-virtualenvwrapper on Fedora or apt-get install virtualenvwrapper on Debian/Ubuntu.
Related
On Windows, if you try to use pip to upgrade itself, inside a virtualenv, you may get a mysterious "access is denied" error. For instance:
D:\scratch\> C:\Program Files\Python\3.7.4\x64\python.exe -m venv D:\scratch\my-venv
D:\scratch\> D:\scratch\my-venv\Scripts\activate
(my-venv) D:\scratch\> pip install --upgrade pip
Collecting pip
Downloading pip-19.3.1-py2.py3-none-any.whl (1.4MB)
Installing collected packages: pip
Found existing installation: pip 19.0.3
Uninstalling pip-19.0.3:
Could not install packages due to an EnvironmentError:
[WinError 5] Access is denied: 'd:\\scratch\\my-venv\\scripts\\pip.exe'
Consider using the `--user` option or check the permissions.
This happens whether or not the command prompt has administrative privileges.
We know we have write access to everything inside d:\scratch\my-venv, because we just created it with the initial python -m venv command. The advice to use the --user option is unhelpful, since we want to upgrade the version of pip inside the virtualenv, which --user will not do.
What could be wrong, and what is the correct way to upgrade pip inside a virtualenv on Windows?
I don't know if this is the only reason this can happen, but notice that the "Access is denied" error points at d:\scratch\my-venv\scripts\pip.exe. pip is trying to replace itself, and Windows doesn't allow you to modify a running EXE file in any way.
A workaround for this specific problem is to use python -m pip install --upgrade pip instead. This way, pip.exe is not running, so Windows will allow it to be replaced. This action doesn't try to overwrite d:\scratch\my-venv\scripts\python.exe, and Windows doesn't care what pip does to all the other files belonging to the pip package.
See https://github.com/pypa/pip/issues/188 and https://github.com/pypa/pip/issues/1299 for further information.
You must have the same version of pip installed in windows as in the virtual env. I think that is the reason for the error Access Denied in Virtual Env.
in promt,
python -m pip install --upgrade pip
located in the Scripts folder of the virtual env, execute the update command upgrade pip in venv
I would have put this in a comment to zwol's answer, but I don't have enough reputation yet.
I just wanted to add to anyone else potentially coming across this from google like I did, that python -m pip install --upgrade pip did fix this issue for me. However if you try pip install --upgrade pip before doing that, something happens in the process before you hit the access denied error that messes up pip. I personally was getting ModuleNotFoundError: No module named 'pip' after trying to upgrade the normal way.
Once I deleted and restarted my virtualenv and had the first command be python -m pip install --upgrade pip It worked just fine.
I hope that helps other newbies out there struggling like me! :)
Same error for me, but in both conditions: my system pip and virtualenv pip. So, when I tried to upgrade my system pip, hopefully it wasn't like totally deleted, I could still use the "pip" command. However I know the upgrade system pip failed. When I tried the command again, it said pip was on the latest version. Maybe this is just a glitch. I believe it is the same for virtual environments(virtualenv, venv). When I upgrade the system pip I get this error:
ERROR: Could not install packages due to an OSError: [WinError 5] Access is denied: 'C:\\Users\\heewo\\AppData\\Local\\Temp\\pip-uninstall-8ob_krif\\pip.exe'
Consider using the `--user` option or check the permissions.
I know this is not normal. But still, different than the virtualenv, "pip" is still installed. I believe this is still ignorable as this is just a known issue and most people here know about this topic. For me, python -m pip install --upgrade pip did not work in this state.
I tried this method, and this did work for me.
virtualenv --pip [VERSION]
and replace VERSION with the latest version available on pip. This prints out that what version you are attempting to upgrade to, when you get the error.
And that should do the trick.
On my Ubuntu 14.04 machine, when I try to install boto3 I get
Traceback (most recent call last):
File "/usr/local/bin/pip", line 7, in <module>
from pip import main
ImportError: No module named pip
I then try to install pip using sudo apt install python-pip and I get
Reading package lists... Done
Building dependency tree
Reading state information... Done
...
0 upgraded, 0 newly installed, 0 to remove and 130 not upgraded.
I then try and install pip using the directions here but when I run
python get-pip.py
I get
ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/local/lib/python2.7.9/lib/python2.7/site-packages/pip'
Consider using the `--user` option or check the permissions.
Is the website I linked an appropriate way of installing pip, and if so how do I resolve my permissions error? I'm using python 2.7.9.
Install conda (the best: miniconda - since more lightweight than Anaconda).
This you do by going to this site: https://docs.conda.io/en/latest/miniconda.html
Take care, which OS and whether 32bit or 64bit.
E.g. Linux 32 bit
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86.sh
Or Linux 64 bit
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
And for installation you do:
bash Miniconda3-latest-Linux-x86.sh
or
bash Miniconda3-latest-Linux-x86_64.sh
, respectively, in the terminal.
After that, any command starting with conda in terminal will work.
conda solves such dependency problems you have now.
create an environment useful for this stuff
conda create --name myenv
conda activate myenv # enter then newly created environment
Then, installing pip is super easy:
# the new environment e.g. here, <myenv>
conda install pip # this installs automatically newest Python and pip
# you could also do:
conda install git pip
# if you also want to pip install directly from github repositories
Recently I messed up my steady environment by installing multiple versions of python.
What I'm trying to do: install a particular package using pip
pip cannot install any package without the --user tag
Could not install packages due to an EnvironmentError: [Errno 13 Permission denied: '/Library/Python/2.7/site-packages/PIL
Here's More information:
which pip
/usr/local/bin/pip
which python
/usr/bin/python
What should I do?
Use sudo or su to install packages system-wide.
I have a huge problem with Python packages. I'm completely newbie when it comes to Python and I'm having trouble for a long time. Anyway, I succeed in installing NumPy package and after that I can't install anything by simply using python setup.py install in the terminal.
I'd like to install pandas package, but I'm getting the same error every time:
[Errno 13] Permission denied: '/Library/Python/2.7/site-packages/test-easy-install-539.pth'.
I went one step backward and tried to install "pip" and/or "setuptools", but I'm getting the same error [Errno 13] every time.
Is there a way to "easily" or even "understandably" install Python packages.
Permission denied error stems from not having write access when installing a package. On unix like systems the command is "sudo".
So, whatever package manager you use to download pandas, whichever package, start the command with "sudo" to ensure that you grant yourself write access for a download.
Example: (This is for a Linux box)
sudo apt-get install pip
And then with pip (the python package manager)
pip install <package-name>
With a Mac, you would either have to use homebrew or macports as your package manager.
Install homebrew like this:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
And then use brew to install pip
brew install pip
And just as before pip to install python packages
pip install <package-name>
Ok, this is not the answer to your question, but Anaconda works flawless for Linux. But I guess it is the same for Apple: http://continuum.io/downloads#py34
While installing pandas, I had the error of
'Could not install packages due to environmental errors: ...'
while uninstalling python-dateutil 1.5 .
It was solved using this command.
sudo pip install --ignore-installed python-dateutil pandas
you can use easy_install too:
first install easy_install tool and then use it like:
easy_install pandas
Thank you all for your help!!!
I'll suggest everyone facing the same problem to install brew and then follow the steps posted above.
If you still have problem ([Errno 13]), try with "sudo su" first, then follow the installation steps you need.
Best,
Zona
you can try the following.
sudo easy_install pandas
I am trying to get a nice clean Python environment setup on OSX 10.9. I've installed Python with Homebrew and set my PATH variables so...
> which python
/usr/local/bin/python
and
> which pip
/usr/local/bin/pip
so when I look at my /usr/local/bin :
pip -> ../Cellar/python/2.7.6/bin/pip
python -> ../Cellar/python/2.7.6/bin/python
then when I run:
> pip install virtualenv
I get permission errors on /usr/local/bin/virtualenv:
...
running install_scripts
Installing virtualenv script to /usr/local/bin
error: /usr/local/bin/virtualenv: Permission denied
I thought that by using Homebrew I could use pip and avoid using sudo to install virtualenv. Am I doing something wrong here?
Ok! I managed to fix this myself.
I deleted all the virtualenv related things from /usr/local/bin (they had been installed under root for some reason and this was causing my permission issues.).
Then I did a pip uninstall virtualenv to get rid of other instances of virtualenv, as there was still one in /usr/local/lib/python2.7/site-packages/
Then a simple pip install virtualenv and things work fine now!
Most likely HomeBrew does some magic so that running brew install allows writing to /usr/local/bin, but this privilege is not available to normal commands. This is a guess, I didn't investigate this further.
Install virtualenv with brew:
brew install pyenv-virtualenv
This command:
pip install virtualenv
runs pip from your first directory from $PATH environment variable, which is usually system wide, thus when you run in this way - you are trying to install it globall.
You should install you your environment in your $HOME directory:
virtualenv $HOME/myvirpython
and later:
$HOME/myvirpython/bin pip install something
Additionally you should read this:
https://docs.brew.sh/Homebrew-and-Python