I am trying to install module using pip and I get this error:
$ pip install virtualenv
Collecting virtualenv
Downloading virtualenv-15.0.3-py2.py3-none-any.whl (3.5MB)
100% |████████████████████████████████| 3.5MB 312kB/s
Installing collected packages: virtualenv
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/pip/commands/install.py", line 317, in run
prefix=options.prefix_path,
File "/Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/pip/req/req_set.py", line 742, in install
**kwargs
File "/Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/pip/req/req_install.py", line 831, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "/Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/pip/req/req_install.py", line 1032, in move_wheel_files
isolated=self.isolated,
File "/Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/pip/wheel.py", line 346, in move_wheel_files
clobber(source, lib_dir, True)
File "/Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/pip/wheel.py", line 324, in clobber
shutil.copyfile(srcfile, destfile)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 83, in copyfile
with open(dst, 'wb') as fdst:
IOError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/virtualenv.py'
What is the problem and how can I resolve it?
the problem is caused because you have not given the super user permission to the system. in order to make any changes into the system you should go to super user mode, for that you have to type the code as
sudo pip install virtualenv
it will help you out
It's probably because the user you are logged as can't install to that folder.
First option: You can do:
sudo pip install virtualenv
to download as root user
Second Option: you could do these commands in sequence in terminal:
First:
cd /Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/
This command will go to the folder you have pip installed in.
Second:
ls -l
This command will show permissions for files/folders. In on the of the columns you will see users who has access to folder pip (eg. root).
Third: Change it to the user you are logged in as with instead of root:
sudo chown -R your_username:your_username path/to/pip/
This is assuming that folders up in the hierarchy don't have root permissions, otherwise you would need to change them too. I'm talking about: Library, Python etc.
Related
I am using python 2.7, 32 bit on windows 10, 64 bit. Whenever I try to install psychopy module by doing pip install psychopy, I am getting below mentioned error. I am not able to understand what is the problem. I have also made changes in environmental variable to set anconda bin and anaconda scripts as highest priority. I am running same program for last 8 months and never got any kind of problem. I am trying to install everything in new PC and getting this kind of error in my old and new PC. How can fix this problem?
Exception:
Traceback (most recent call last):
File "c:\users\ravikumar.mevada\anaconda2\lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "c:\users\ravikumar.mevada\anaconda2\lib\site-packages\pip\commands\install.py", line 342, in run
prefix=options.prefix_path,
File "c:\users\ravikumar.mevada\anaconda2\lib\site-packages\pip\req\req_set.py", line 784, in install
**kwargs
File "c:\users\ravikumar.mevada\anaconda2\lib\site-packages\pip\req\req_install.py", line 851, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "c:\users\ravikumar.mevada\anaconda2\lib\site-packages\pip\req\req_install.py", line 1064, in move_wheel_files
isolated=self.isolated,
File "c:\users\ravikumar.mevada\anaconda2\lib\site-packages\pip\wheel.py", line 345, in move_wheel_files
clobber(source, lib_dir, True)
File "c:\users\ravikumar.mevada\anaconda2\lib\site-packages\pip\wheel.py", line 323, in clobber
shutil.copyfile(srcfile, destfile)
File "c:\users\ravikumar.mevada\anaconda2\lib\shutil.py", line 97, in copyfile
with open(dst, 'wb') as fdst:
IOError: [Errno 13] Permission denied: 'c:\\users\\ravikumar.mevada\\anaconda2\\Lib\\site-packages\\win32\\win32api.pyd'
Looks like your user doesn't have the permission to install packages in your system (for all users). Here's how to fix this problem:
From the Command Prompt, you can install the package for your user only, like this:
pip install <package> --user
OR
You can install the package as Administrator, by following these steps:
Run the Command Prompt as Administrator, using the Run This Program As An Administrator option.
Run the command pip install <package>
open your command prompt by right click -> open as administrator after that
type:
py -2.7 -m pip help
py -2.7 -m pip install psychopy
OR
conda create -n py27 python=2.7 anaconda
https://conda.io/docs/user-guide/tasks/manage-python.html
I'm trying to install python virtualenv.
So i ran the command
pip install virtualenv
and I met these errors.
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/commands/install.py", line 342, in run
prefix=options.prefix_path,
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_set.py", line 784, in install
**kwargs
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 851, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 1064, in move_wheel_files
isolated=self.isolated,
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/wheel.py", line 345, in move_wheel_files
clobber(source, lib_dir, True)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/wheel.py", line 323, in clobber
shutil.copyfile(srcfile, destfile)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 83, in copyfile
with open(dst, 'wb') as fdst:
IOError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/virtualenv.py'
You are installing the virtualenv package in a system level directory of a Mac. Mac uses an older Python (2.7.10) that comes pre-installed. To install the virtualenv package in the system directory you identified, you need to use sudo because writing to a system directory requires elevated privileges.
sudo pip install virtualenv
Another option is to install it to a user directory using the --user option.
pip install --user virtualenv
Try running it with sudo:
sudo pip install virtualenv
or else explicitly calling the python command
python -m pip install virtualenv
I want to install simpleaudio but can't upgrade or install anything with pip, here's what it gives me:
Downloading/unpacking pip from https://pypi.python.org/packages/9c/32/004ce0852e0a127f07f358b715015763273799b d798956fa930814b60f39/pip-8.1.2-py2.py3-none-any.whl#md5=0570520434c5b600d89ec95393b2650b
Downloading pip-8.1.2-py2.py3-none-any.whl (1.2MB): 1.2MB downloaded
Installing collected packages: pip
Found existing installation: pip 1.5.6
Not uninstalling pip at /usr/lib/python2.7/dist-packages, owned by OS
Can't roll back pip; was not uninstalled
Cleaning up...
Exception:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 295, in run
requirement_set.install(install_options, global_options, root=options.root_path)
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1436, in install
requirement.install(install_options, global_options, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 672, in install
self.move_wheel_files(self.source_dir, root=root)
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 902, in move_wheel_files
pycompile=self.pycompile,
File "/usr/lib/python2.7/dist-packages/pip/wheel.py", line 214, in move_wheel_files
clobber(source, lib_dir, True)
File "/usr/lib/python2.7/dist-packages/pip/wheel.py", line 204, in clobber
os.makedirs(destdir)
File "/usr/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/pip-8.1.2.dist-info'
Storing debug log for failure in /home/pi/.pip/pip.log
I'm using Rasbian with NOOBS if that help figuring this out. I've just started studying programming so I have no clue what I need to do since using the guides results to above, so please explain this to an idiot.
pip fails to access some system paths and shows clearly that the user used to run pip does not have enough privileges to access them.
To solve this, try to run these commands as root using sudo:
sudo pip <options>
Otherwise, if you don't have sudo installed (this is almost impossible) or if you're just curious and know the root's password, simply log in as root and execute your commands without sudo:
su # or su root
# type the root's password
pip <options>
If you use this option, don't forget to log out after you've installed everything!
------EDIT Starting Over again ---------
I have a problem with virtualenv and I'm not sure how I caused it. The problem that I am having is that I cannot install any flask-extensions onto my flask application's site-packages directory.
I had a previous stackoverflow question that I overwrote before but I believe that I found the root problem and the problem is in virtualenv itself. Here is an error that I get when executing virtualenv env:
New python executable in env/bin/python
Please make sure you remove any previous custom paths from your /Users/drubio/.pydistutils.cfg file.
Installing setuptools, pip, wheel...
Complete output from command /Users/drubio/example/env/bin/python -c "import sys, pip; sys...d\"] + sys.argv[1:]))" setuptools pip wheel:
Ignoring indexes: https://pypi.python.org/simple
The directory '/Users/drubio/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/drubio/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting setuptools
Collecting pip
Collecting wheel
Installing collected packages: setuptools, pip, wheel
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/virtualenv-13.1.2-py2.7.egg/virtualenv_support/pip-7.1.2-py2.py3-none-any.whl/pip/basecommand.py", line 211, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/virtualenv-13.1.2-py2.7.egg/virtualenv_support/pip-7.1.2-py2.py3-none-any.whl/pip/commands/install.py", line 311, in run
root=options.root_path,
File "/Library/Python/2.7/site-packages/virtualenv-13.1.2-py2.7.egg/virtualenv_support/pip-7.1.2-py2.py3-none-any.whl/pip/req/req_set.py", line 646, in install
**kwargs
File "/Library/Python/2.7/site-packages/virtualenv-13.1.2-py2.7.egg/virtualenv_support/pip-7.1.2-py2.py3-none-any.whl/pip/req/req_install.py", line 803, in install
self.move_wheel_files(self.source_dir, root=root)
File "/Library/Python/2.7/site-packages/virtualenv-13.1.2-py2.7.egg/virtualenv_support/pip-7.1.2-py2.py3-none-any.whl/pip/req/req_install.py", line 998, in move_wheel_files
isolated=self.isolated,
File "/Library/Python/2.7/site-packages/virtualenv-13.1.2-py2.7.egg/virtualenv_support/pip-7.1.2-py2.py3-none-any.whl/pip/wheel.py", line 339, in move_wheel_files
clobber(source, lib_dir, True)
File "/Library/Python/2.7/site-packages/virtualenv-13.1.2-py2.7.egg/virtualenv_support/pip-7.1.2-py2.py3-none-any.whl/pip/wheel.py", line 282, in clobber
ensure_dir(dest) # common for the 'include' path
File "/Library/Python/2.7/site-packages/virtualenv-13.1.2-py2.7.egg/virtualenv_support/pip-7.1.2-py2.py3-none-any.whl/pip/utils/__init__.py", line 71, in ensure_dir
os.makedirs(path)
File "/Users/drubio/example/env/lib/python2.7/os.py", line 150, in makedirs
makedirs(head, mode)
File "/Users/drubio/example/env/lib/python2.7/os.py", line 150, in makedirs
makedirs(head, mode)
File "/Users/drubio/example/env/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/lib'
----------------------------------------
...Installing setuptools, pip, wheel...done.
Traceback (most recent call last):
File "/usr/local/bin/virtualenv", line 9, in <module>
load_entry_point('virtualenv==13.1.2', 'console_scripts', 'virtualenv')()
File "/Library/Python/2.7/site-packages/virtualenv-13.1.2-py2.7.egg/virtualenv.py", line 832, in main
symlink=options.symlink)
File "/Library/Python/2.7/site-packages/virtualenv-13.1.2-py2.7.egg/virtualenv.py", line 1004, in create_environment
install_wheel(to_install, py_executable, search_dirs)
File "/Library/Python/2.7/site-packages/virtualenv-13.1.2-py2.7.egg/virtualenv.py", line 969, in install_wheel
'PIP_NO_INDEX': '1'
File "/Library/Python/2.7/site-packages/virtualenv-13.1.2-py2.7.egg/virtualenv.py", line 910, in call_subprocess
% (cmd_desc, proc.returncode))
There is some sort of permission that is being denied in /lib and I'm not sure what that means. Is there a way to completely remove virtualenv. The bin directory for a new application does not contain an activate file or anything.
Also, running these commands result in the following:
(sudo) pip uninstall virtualenv
zsh: /bin/pip: bad interpreter: /usr/local/opt/python/bin/python2.7: no such file or directory
sudo: unable to execute /bin/pip: No such file or directory
However when I execute which virtualenv and which pip I clearly have them under /usr/local/bin/virtualenv/ and /bin/pip.
Any thoughts?
I found the problem! The problem was in this file /Users/drubio/.pydistutils.cfg
For another problem I had (which I can't remember) I needed to place these two lines for a work around:
[install]
prefix=''
Removing those lines made it work.
I'm new to Python development and I'm trying to instal virtualenv in my project directory.
However I have the following error:
Installing collected packages: pip, setuptools
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/virtualenv_support/pip-6.0.8-py2.py3-none-any.whl/pip/basecommand.py", line 232, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/virtualenv_support/pip-6.0.8-py2.py3-none-any.whl/pip/commands/install.py", line 347, in run
root=options.root_path,
File "/Library/Python/2.7/site-packages/virtualenv_support/pip-6.0.8-py2.py3-none-any.whl/pip/req/req_set.py", line 549, in install
**kwargs
File "/Library/Python/2.7/site-packages/virtualenv_support/pip-6.0.8-py2.py3-none-any.whl/pip/req/req_install.py", line 754, in install
self.move_wheel_files(self.source_dir, root=root)
File "/Library/Python/2.7/site-packages/virtualenv_support/pip-6.0.8-py2.py3-none-any.whl/pip/req/req_install.py", line 963, in move_wheel_files
isolated=self.isolated,
File "/Library/Python/2.7/site-packages/virtualenv_support/pip-6.0.8-py2.py3-none-any.whl/pip/wheel.py", line 234, in move_wheel_files
clobber(source, lib_dir, True)
File "/Library/Python/2.7/site-packages/virtualenv_support/pip-6.0.8-py2.py3-none-any.whl/pip/wheel.py", line 212, in clobber
shutil.copyfile(srcfile, destfile)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 82, in copyfile
with open(dst, 'wb') as fdst:
IOError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/pip/__init__.py'
----------------------------------------
...Installing setuptools, pip...done.
Traceback (most recent call last):
File "/usr/local/bin/virtualenv", line 11, in <module>
sys.exit(main())
File "/Library/Python/2.7/site-packages/virtualenv.py", line 825, in main
symlink=options.symlink)
File "/Library/Python/2.7/site-packages/virtualenv.py", line 993, in create_environment
install_wheel(to_install, py_executable, search_dirs)
File "/Library/Python/2.7/site-packages/virtualenv.py", line 961, in install_wheel
'PIP_NO_INDEX': '1'
File "/Library/Python/2.7/site-packages/virtualenv.py", line 903, in call_subprocess
% (cmd_desc, proc.returncode))
OSError: Command /Users/alexandrurada...oard/venv/bin/python -c "import sys, pip; sys...d\"] + sys.argv[1:]))" setuptools pip failed with error code 2
I installed pip with
easy_install pip
Then I installed virtualenv with
pip install virtualenv
Without any errors. However I'm still getting this. I didn't want to try it with sudo. Should I?
UPDATE: I installed them with sudo, and I got rid of this error. However another one when trying to install something with pip:
air:dashboard alexandrurada$ pip install flask
-bash: /usr/local/bin/pip: "path_here": bad interpreter: No such file or directory
UPDATE 2: The earlier error was because of a space inside a directory name. Looks like path doesn't work with such names.
Anyway, the error I'm getting now is
File "/usr/local/bin/pip", line 7, in <module>
from pip import main
ImportError: No module named pip
I checked my /usr/local/bin/pip and the file exists.
You need sudo pip install virtualenv to install virtualenv globally. When setting up your virtualenvs make sure you don't use sudo and that you activate your virtualenv before trying to install.
[Errno 13] Permission denied: means you don't have write permissions.
Install a newer version of pip and avoid using easy_install.
Download pip from: https://bootstrap.pypa.io/get-pip.py
and then run Python on it:
$ python get-pip.py
If you want to install pip to the global path, you likely want to run that last command with sudo. Without using sudo, pip will get installed for use with whatever Python interpreter is in your path.
From here, you can install virtualenv with pip:
$ pip install virtualenv
From your responses, it seems like you'd be best served by getting your system in a known state: Download that file, then run sudo python get-pip.py so you're running with a known-working pip install.