I'm trying to install pip with:
$ sudo easy_install pip
Getting this error:
Searching for pip
Reading https://pypi.python.org/simple/pip/
Couldn't find index page for 'pip' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading https://pypi.python.org/simple/
No local packages or download links found for pip
error: Could not find suitable distribution for Requirement.parse('pip')
I have checked that python is installed:
$ python --version
Python 2.7.10
According to multiple threads this should be working correctly, what am I doing wrong?
After downloading https://bootstrap.pypa.io/get-pip.py and running :
python get-pip.py
I'm getting this error:
Exception:
Traceback (most recent call last):
File "/var/folders/1y/4bcsjv_97t3793jlxscvccb07rjdl6/T/tmpvjuB2G/pip.zip/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/var/folders/1y/4bcsjv_97t3793jlxscvccb07rjdl6/T/tmpvjuB2G/pip.zip/pip/commands/install.py", line 342, in run
prefix=options.prefix_path,
File "/var/folders/1y/4bcsjv_97t3793jlxscvccb07rjdl6/T/tmpvjuB2G/pip.zip/pip/req/req_set.py", line 784, in install
**kwargs
File "/var/folders/1y/4bcsjv_97t3793jlxscvccb07rjdl6/T/tmpvjuB2G/pip.zip/pip/req/req_install.py", line 851, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "/var/folders/1y/4bcsjv_97t3793jlxscvccb07rjdl6/T/tmpvjuB2G/pip.zip/pip/req/req_install.py", line 1064, in move_wheel_files
isolated=self.isolated,
File "/var/folders/1y/4bcsjv_97t3793jlxscvccb07rjdl6/T/tmpvjuB2G/pip.zip/pip/wheel.py", line 345, in move_wheel_files
clobber(source, lib_dir, True)
File "/var/folders/1y/4bcsjv_97t3793jlxscvccb07rjdl6/T/tmpvjuB2G/pip.zip/pip/wheel.py", line 316, in clobber
ensure_dir(destdir)
File "/var/folders/1y/4bcsjv_97t3793jlxscvccb07rjdl6/T/tmpvjuB2G/pip.zip/pip/utils/__init__.py", line 83, in ensure_dir
os.makedirs(path)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/pip'
Why not follow the official doc?
To install pip, securely download get-pip.py. 2
Then run the following:
$ python get-pip.py
from official doc of pip
and the actual link to get-pip.py
if you want to install for a specific python version on your machine
python2.7 or python3.x instead of python.
Related
I need to upgrade pip on my Ubuntu system but I am getting error:
Collecting pip
Using cached pip-9.0.1-py2.py3-none-any.whl
Installing collected packages: pip
Found existing installation: pip 8.1.2
Uninstalling pip-8.1.2:
Successfully uninstalled pip-8.1.2
Rolling back uninstall of pip
Exception:
Traceback (most recent call last):
File "/home/shivams334/.local/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/home/shivams334/.local/lib/python2.7/site-packages/pip/commands/install.py", line 317, in run
prefix=options.prefix_path,
File "/home/shivams334/.local/lib/python2.7/site-packages/pip/req/req_set.py", line 742, in install
**kwargs
File "/home/shivams334/.local/lib/python2.7/site-packages/pip/req/req_install.py", line 831, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "/home/shivams334/.local/lib/python2.7/site-packages/pip/req/req_install.py", line 1032, in move_wheel_files
isolated=self.isolated,
File "/home/shivams334/.local/lib/python2.7/site-packages/pip/wheel.py", line 346, in move_wheel_files
clobber(source, lib_dir, True)
File "/home/shivams334/.local/lib/python2.7/site-packages/pip/wheel.py", line 317, in clobber
ensure_dir(destdir)
File "/home/shivams334/.local/lib/python2.7/site-packages/pip/utils/__init__.py", line 83, in ensure_dir
os.makedirs(path)
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-9.0.1.dist-info'
You are using pip version 8.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Maybe I should go with 'chown' but don't know how to use it. Please help.
Since you want to upgrade your system-wide Python, you need to run this command with administrator privilege:
sudo pip install -U pip
But, I recommend you not changing/polluting your system-wide Python. Instead use a virtualenv:
virtualenv myapp
source myapp/bin/activate
pip install -U pip # <- only if virtualenv is not up to date
I am a new to Linux and have dual booted my system. I specifically want to install numpy, darknet or lightnet python packages. I tried following the instructions given here
When I run the below command:
pip install darknetpy
I am seeing the following error:
Collecting darknetpy
Using cached darknetpy-2.0.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-5J0HcA/darknetpy/setup.py", line 6, in <module>
import urllib.request
ImportError: No module named request
I am unable to understand what this error is about. When I tried installing numpy package, I get the below error:
Exception:
Traceback (most recent call last):
File "/home/test/.local/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/home/test/.local/lib/python2.7/site-packages/pip/commands/install.py", line 342, in run
prefix=options.prefix_path,
File "/home/test/.local/lib/python2.7/site-packages/pip/req/req_set.py", line 784, in install
**kwargs
File "/home/test/.local/lib/python2.7/site-packages/pip/req/req_install.py", line 851, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "/home/test/.local/lib/python2.7/site-packages/pip/req/req_install.py", line 1064, in move_wheel_files
isolated=self.isolated,
File "/home/test/.local/lib/python2.7/site-packages/pip/wheel.py", line 345, in move_wheel_files
clobber(source, lib_dir, True)
File "/home/test/.local/lib/python2.7/site-packages/pip/wheel.py", line 316, in clobber
ensure_dir(destdir)
File "/home/test/.local/lib/python2.7/site-packages/pip/utils/__init__.py", line 83, in ensure_dir
os.makedirs(path)
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/numpy-1.13.3.dist-info'
Kindly help in solving this error.
OSError: [Errno 13] Permission denied Typically means you the invoker have insufficient permissions.
It looks like you are trying to pip install it using python2, as eyllanesc pointed out the package you're installing is only supported by python3, so you will have to install it first.
Here are some links to help with that:
http://ubuntuhandbook.org/index.php/2017/07/install-python-3-6-1-in-ubuntu-16-04-lts/
http://docs.python-guide.org/en/latest/starting/install3/linux/
https://tecadmin.net/install-python-3-6-on-centos/
https://gist.github.com/dschep/24aa61672a2092246eaca2824400d37f (Raspbian)
https://unix.stackexchange.com/questions/332641/how-to-install-python-3-6 (debian)
Try running the command again with sudo as in sudo pip install darknetpy, or as a super user (typically gained with sudo su) then run the command normaly.
If you are still getting ImportErrors when you are trying to pip install something, try pip installing the module that is missing.
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
This question already has an answer here:
Installing pip on Mac OS error - Permission denied: '/Library/Python/2.7/site-packages/pip'
(1 answer)
Closed 6 years ago.
I am very new to python and have recently installed python 3.5.1 and am trying to install the module 'requests' by writing the following in terminal:
pip install requests
However I am receiving the following error. Thank you so much in advance for any help that you can give!
Collecting requests
Using cached requests-2.9.1-py2.py3-none-any.whl
Installing collected packages: requests
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip-8.1.0-py2.7.egg/pip/basecommand.py", line 209, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip-8.1.0-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.0-py2.7.egg/pip/req/req_set.py", line 732, in install
**kwargs
File "/Library/Python/2.7/site-packages/pip-8.1.0-py2.7.egg/pip/req/req_install.py", line 835, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "/Library/Python/2.7/site-packages/pip-8.1.0- py2.7.egg/pip/req/req_install.py", line 1030, in move_wheel_files
isolated=self.isolated,
File "/Library/Python/2.7/site-packages/pip-8.1.0-py2.7.egg/pip/wheel.py", line 344, in move_wheel_files
clobber(source, lib_dir, True)
File "/Library/Python/2.7/site-packages/pip-8.1.0-py2.7.egg/pip/wheel.py", line 315, in clobber
ensure_dir(destdir)
File "/Library/Python/2.7/site-packages/pip-8.1.0- py2.7.egg/pip/utils/__init__.py", line 83, in ensure_dir
os.makedirs(path)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/requests'
You're attempting to install requests to a place you do not have permissions to do so.
If you sudo it, ie. sudo pip install requests it will succeed. Else you can look into virtual environments to manage dependancies locally.
Also, you're installing the Python 2.7.x version of requests, due to using the Python 2.7.x version of pip. You'll need to use the pip for 3.5 explicitly if that's the one you want to install. There will either be a pip3.5 binary, or you can launch it with the full path to pip for Python 3.5.x
I just recently re-installed Python 2 and Python 3 via homebrew and everything looked ok. However I updated pip3 as well as pip after installing python and then, when trying to install virtualenv, I get the below errors:
~> pip install virtualenv Collecting virtualenv Downloading virtualenv-13.1.2-py2.py3-none-any.whl (1.7MB) 100% |
████████████████████████████████| 1.7MB 361kB/s Installing collected
packages: virtualenv Exception: Traceback (most recent call last):
File "/usr/local/lib/python3.4/site-packages/pip/basecommand.py", line 211, in main status = self.run(options, args)
File "/usr/local/lib/python3.4/site-packages/pip/commands/install.py", line 311, in run root=options.root_path, File "/usr/local/lib/python3.4/site-packages/pip/req/req_set.py", line 646, in install **kwargs
File "/usr/local/lib/python3.4/site-packages/pip/req/req_install.py", line 803, in install self.move_wheel_files(self.source_dir, root=root)
File "/usr/local/lib/python3.4/site-packages/pip/req/req_install.py", line 998, in move_wheel_files isolated=self.isolated, File "/usr/local/lib/python3.4/site-packages/pip/wheel.py", line 479, in move_wheel_files maker.make_multiple(['%s = %s' % kv for kv in console.items()]) File "/usr/local/lib/python3.4/site-packages/pip/_vendor/distlib/scripts.py", line 364, in make_multiple filenames.extend(self.make(specification, options))
File "/usr/local/lib/python3.4/site-packages/pip/_vendor/distlib/scripts.py", line 353, in make self._make_script(entry, filenames, options=options)
File "/usr/local/lib/python3.4/site-packages/pip/_vendor/distlib/scripts.py", line 257, in _make_script self._write_script(scriptnames, shebang, script, filenames, ext) File "/usr/local/lib/python3.4/site-packages/pip/_vendor/distlib/scripts.py", line 231, in _write_script self._fileop.write_binary_file(outname, script_bytes)
File "/usr/local/lib/python3.4/site-packages/pip/_vendor/distlib/util.py", line 388, in write_binary_file with open(path, 'wb') as f:
PermissionError: [Errno 13] Permission denied: '/usr/local/bin/virtualenv'
pip freeze then seems to think virtualenv is installed but none of it's commands work.
Interestingly if I try to uninstall virtualenv it seems to have it attached to the Python 3 installed by brew installed of the Python 2 version brew installed.
Uninstalling virtualenv-13.1.2:
/usr/local/lib/python3.4/site-packages/__pycache__/virtualenv.cpython-34.pyc
/usr/local/lib/python3.4/site-packages/virtualenv-13.1.2.dist-info/DESCRIPTION.rst
/usr/local/lib/python3.4/site-packages/virtualenv-13.1.2.dist-info/METADATA
/usr/local/lib/python3.4/site-packages/virtualenv-13.1.2.dist-info/RECORD
/usr/local/lib/python3.4/site-packages/virtualenv-13.1.2.dist-info/WHEEL
/usr/local/lib/python3.4/site-packages/virtualenv-13.1.2.dist-info/entry_points.txt
/usr/local/lib/python3.4/site-packages/virtualenv-13.1.2.dist-info/metadata.json
/usr/local/lib/python3.4/site-packages/virtualenv-13.1.2.dist-info/pbr.json
/usr/local/lib/python3.4/site-packages/virtualenv-13.1.2.dist-info/top_level.txt
/usr/local/lib/python3.4/site-packages/virtualenv.py
/usr/local/lib/python3.4/site-packages/virtualenv_support/__init__.py
/usr/local/lib/python3.4/site-packages/virtualenv_support/__pycache__/__init__.cpython-34.pyc
/usr/local/lib/python3.4/site-packages/virtualenv_support/argparse-1.3.0-py2.py3-none-any.whl
/usr/local/lib/python3.4/site-packages/virtualenv_support/pip-7.1.2-py2.py3-none-any.whl
/usr/local/lib/python3.4/site-packages/virtualenv_support/setuptools-18.2-py2.py3-none-any.whl
/usr/local/lib/python3.4/site-packages/virtualenv_support/wheel-0.24.0-py2.py3-none-any.whl
Proceed (y/n)?
pip freeze gives me:
~> pip freeze
pbr==1.6.0
virtualenv==13.1.2
virtualenv-clone==0.2.6
wheel==0.24.0
so virtualenv already installed but doesn't work for some reason.
For python 2.7 I believe pip is referenced by pip2. Your permission error is easily fixed by running the command as sudo.