Error when install pip - python

I have installed python2.7 on Linux and I want to install pip under /path/to/python2.7.9/bin. So I did this:
> cd /path/to/setuptools-16.0
> /path/to/python2.7.9/bin/python setup.py install
> cd /path/to/pip-7.0.0
> /path/to/python2.7.9/bin/python setup.py install
Then pip is installed under /path/to/python2.7.9/bin. But when I executed /path/to/python2.7.9/bin/pip, it shows:
> ~/local/python-2.7.9/bin/pip
Traceback (most recent call last):
File "/root/local/python-2.7.9/bin/pip", line 9, in <module>
load_entry_point('pip==7.0.0', 'console_scripts', 'pip')()
File "/root/local/python-2.7.9/lib/python2.7/site-packages/distribute-0.6.49-py2.7.egg/pkg_resources.py", line 345, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/root/local/python-2.7.9/lib/python2.7/site-packages/distribute-0.6.49-py2.7.egg/pkg_resources.py", line 2381, in load_entry_point
return ep.load()
File "/root/local/python-2.7.9/lib/python2.7/site-packages/distribute-0.6.49-py2.7.egg/pkg_resources.py", line 2087, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/root/local/python-2.7.9/lib/python2.7/site-packages/pip-7.0.0-py2.7.egg/pip/__init__.py", line 15, in <module>
from pip.vcs import git, mercurial, subversion, bazaar # noqa
File "/root/local/python-2.7.9/lib/python2.7/site-packages/pip-7.0.0-py2.7.egg/pip/vcs/subversion.py", line 9, in <module>
from pip.index import Link
File "/root/local/python-2.7.9/lib/python2.7/site-packages/pip-7.0.0-py2.7.egg/pip/index.py", line 30, in <module>
from pip.wheel import Wheel, wheel_ext
File "/root/local/python-2.7.9/lib/python2.7/site-packages/pip-7.0.0-py2.7.egg/pip/wheel.py", line 34, in <module>
from pip._vendor.distlib.scripts import ScriptMaker
File "/root/local/python-2.7.9/lib/python2.7/site-packages/pip-7.0.0-py2.7.egg/pip/_vendor/__init__.py", line 92, in load_module
raise ImportError("No module named '%s'" % (name,))
ImportError: No module named 'pip._vendor.distlib.scripts'
I don't know what is wrong and what should I do. Can you help me?
Thanks.

As suggested here, try installing SSL support.
On Debian:
apt-get -y install libssl-dev
On CentOS:
yum install openssl openssl-devel
If libssl-dev is not present, try: openssl-dev.

Related

Raspberry Pi - Errors downloading Python Modules

I am trying to download a module for python on my raspberry pi 3. The first error I received was saying my urllib3 was not up to date. This error was given whenever I ran the pip command. So I re-installed urllib3, and it downloaded the same version I had, even though I had just ran sudo apt-get update. I then decided to remove pip, and re-install, and that didn't fix it. The final thing I have tried doing it manually downloading urllib3 from github, and then installing it onto my pi using setup.py. This was successful in eliminating the previous error, but I am now receiving this.
$ pip install imutils
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
load_entry_point('pip==1.5.6', 'console_scripts', 'pip')()
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 356, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2476, in load_entry_point
return ep.load()
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2190, in load
['__name__'])
File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 74, in <module>
from pip.vcs import git, mercurial, subversion, bazaar # noqa
File "/usr/lib/python2.7/dist-packages/pip/vcs/mercurial.py", line 9, in <module>
from pip.download import path_to_url
File "/usr/lib/python2.7/dist-packages/pip/download.py", line 22, in <module>
import requests, six
File "/usr/local/lib/python2.7/dist-packages/requests/__init__.py", line 53, in <module>
major, minor, patch = urllib3_version
ValueError: need more than 1 value to unpack
I would really appreciate any help, thanks.

Getting error while installing scrapy in ubuntu

I want to install scrapy for my project in ubunu. i used pip to install scrapy but i always getting this error while installing.
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
load_entry_point('pip==1.5.6', 'console_scripts', 'pip')()
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 558, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2682, in load_entry_point
return ep.load()
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2355, in load
return self.resolve()
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2361, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 74, in <module>
from pip.vcs import git, mercurial, subversion, bazaar # noqa
File "/usr/lib/python2.7/dist-packages/pip/vcs/mercurial.py", line 9, in <module>
from pip.download import path_to_url
File "/usr/lib/python2.7/dist-packages/pip/download.py", line 22, in <module>
import requests, six
File "/usr/lib/python2.7/dist-packages/requests/__init__.py", line 53, in <module>
from .packages.urllib3.contrib import pyopenssl
File "/usr/lib/python2.7/dist-packages/urllib3/contrib/pyopenssl.py", line 53, in <module>
import OpenSSL.SSL
File "/home/karthick/.local/lib/python2.7/site-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import rand, crypto, SSL
File "/home/karthick/.local/lib/python2.7/site-packages/OpenSSL/SSL.py", line 112, in <module>
if _lib.Cryptography_HAS_SSL_ST:
AttributeError: 'module' object has no attribute 'Cryptography_HAS_SSL_ST'
so how do i get rid of this error and install scrapy
This happened to me (although with Anaconda, not pip).
I tracked it down to updating pyopenssl from 16.0 to 16.2.
My solution was to first reinstall Anaconda (which reverted pyopenssl to 16.0). (You may not need to do this.)
After that, I just ran
sudo apt install python3-openssl
After doing this, my problem seemed to be corrected.
I think you should update your pip first, then try again.
I see pip==1.5.6, omg, it's older than the moon

Cannot install PIP on Raspbian

I can't get PIP running in my Raspberry (running in Wheezy).
After I always got this message:
~ $ pip3
/usr/local/lib/python3.2/dist-packages/pip-8.1.2-py3.2.egg/pip/_vendor/pkg_resources/__init__.py:80:
UserWarning: Support for Python 3.0-3.2 has been dropped. Future
versions will fail here. warnings.warn(msg) Traceback (most recent
call last): File "/usr/local/bin/pip3", line 9, in <module>
load_entry_point('pip==8.1.2', 'console_scripts', 'pip3')() File "/usr/lib/python3/dist-packages/pkg_resources.py", line 337, in
load_entry_point
return get_distribution(dist).load_entry_point(group, name) File "/usr/lib/python3/dist-packages/pkg_resources.py", line 2280, in
load_entry_point
return ep.load() File "/usr/lib/python3/dist-packages/pkg_resources.py", line 1990, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__']) File
"/usr/local/lib/python3.2/dist-packages/pip-8.1.2-py3.2.egg/pip/__init__.py",
line 16, in <module>
from pip.vcs import git, mercurial, subversion, bazaar # noqa File
"/usr/local/lib/python3.2/dist-packages/pip-8.1.2-py3.2.egg/pip/vcs/mercurial.py",
line 9, in <module>
from pip.download import path_to_url File "/usr/local/lib/python3.2/dist-packages/pip-8.1.2-py3.2.egg/pip/download.py",
line 36, in <module>
from pip.utils.ui import DownloadProgressBar, DownloadProgressSpinner File
"/usr/local/lib/python3.2/dist-packages/pip-8.1.2-py3.2.egg/pip/utils/ui.py",
line 15, in <module>
from pip._vendor.progress.bar import Bar, IncrementalBar File "/usr/local/lib/python3.2/dist-packages/pip-8.1.2-py3.2.egg/pip/_vendor/progress/bar.py",
line 48
empty_fill = u'∙'
^ SyntaxError: invalid syntax
I compiled Python3.5 and now try running the get-pip.py script. But this gives me this error:
Traceback (most recent call last): File "get-pip.py", line 19177, in
<module>
main() File "get-pip.py", line 194, in main
bootstrap(tmpdir=tmpdir) File "get-pip.py", line 82, in bootstrap
import pip File "/tmp/tmprewy_1xt/pip.zip/pip/__init__.py", line 16, in <module> File
"/tmp/tmprewy_1xt/pip.zip/pip/vcs/subversion.py", line 9, in <module>
File "/tmp/tmprewy_1xt/pip.zip/pip/index.py", line 30, in <module>
File "/tmp/tmprewy_1xt/pip.zip/pip/wheel.py", line 39, in <module>
File "/tmp/tmprewy_1xt/pip.zip/pip/_vendor/distlib/scripts.py", line
14, in <module> File
"/tmp/tmprewy_1xt/pip.zip/pip/_vendor/distlib/compat.py", line 66, in
<module> ImportError: cannot import name 'HTTPSHandler'
OpenSSL is installed.
Any ideas what I'm missing?
Thanks for your help.
OK, sorted.
Apparently my Python 2.7 install was somewhat corrupted.
After I did sudo apt-get -u dist-upgrade which - with some hick-ups - fixed the install.
After that I re-built the 3.5.1 binaries and pip3 works now fine.

pip install error: cannot import name 'unpack_url'

I'm using Python 3.4.1 64-bit on a Windows 8.1 machine. Pip has been giving me problems lately, specifically this error:
C:\Users\Charlie\Desktop>pip install wxPython_Phoenix-3.0.3.dev78341-cp34-none-w
in_amd64.whl
Traceback (most recent call last):
File "C:\Python34\Scripts\pip-script.py", line 9, in <module>
load_entry_point('Scipy-stack==14.8.27', 'console_scripts', 'pip')()
File "C:\Python34\lib\site-packages\pkg_resources\__init__.py", line 519, in l
oad_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "C:\Python34\lib\site-packages\pkg_resources\__init__.py", line 2630, in
load_entry_point
return ep.load()
File "C:\Python34\lib\site-packages\pkg_resources\__init__.py", line 2310, in
load
return self.resolve()
File "C:\Python34\lib\site-packages\pkg_resources\__init__.py", line 2316, in
resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "C:\Python34\lib\site-packages\pip\__init__.py", line 13, in <module>
from pip.commands import commands, get_summaries, get_similar_commands
File "C:\Python34\lib\site-packages\pip\commands\__init__.py", line 6, in <mod
ule>
from pip.commands.bundle import BundleCommand
File "C:\Python34\lib\site-packages\pip\commands\bundle.py", line 6, in <modul
e>
from pip.commands.install import InstallCommand
File "C:\Python34\lib\site-packages\pip\commands\install.py", line 5, in <modu
le>
from pip.req import InstallRequirement, RequirementSet, parse_requirements
File "C:\Python34\lib\site-packages\pip\req\__init__.py", line 4, in <module>
from .req_set import RequirementSet, Requirements
File "C:\Python34\lib\site-packages\pip\req\req_set.py", line 9, in <module>
from pip.download import (url_to_path, unpack_url)
ImportError: cannot import name 'unpack_url'
This occurs every time I try to install any package. Has anyone had this problem before?
I used: easy_install -U pip
problem solved
Well, obviously there is an error with pip and unpack_url is probably use to download packages from PyPi. I suggest reinstalling by executing this script.

broken easy_install and pip after upgrading to OS X Mavericks

Upgraded to OS X 10.9 Mavericks and installed XCode, Command Line Tools, XQuartz, etc. Trying to run a pip install now, but it says that the distribution is not found:
Traceback (most recent call last):
File "/usr/local/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2603, in <module>
working_set.require(__requires__)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 666, in require
needed = self.resolve(parse_requirements(requirements))
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 565, in resolve
raise DistributionNotFound(req) # XXX put more info here
pkg_resources.DistributionNotFound: pip==1.4.1
So I tried to install pip with an easy_install. Turns out that's borked too:
Traceback (most recent call last):
File "/usr/local/bin/easy_install", line 5, in <module>
from pkg_resources import load_entry_point
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2607, in <module>
parse_requirements(__requires__), Environment()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 565, in resolve
raise DistributionNotFound(req) # XXX put more info here
pkg_resources.DistributionNotFound: setuptools==1.1.6
So some of the other threads say to reinstall setuptools with a sudo python ez_setup.py. It seems to work fine:
Installed /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/setuptools-1.1.6-py2.7.egg
Processing dependencies for setuptools==1.1.6
Finished processing dependencies for setuptools==1.1.6
But when running the easy_install pip, the same pkg_resources.DistributionNotFound: setuptools==1.1.6 error occurs. Anyone else have this problem? Any ideas how to fix this?
Install easy_install:
Download ez_setup.py module from https://pypi.python.org/pypi/setuptools
$ cd path/to/ez_setup.py
$ python ez_setup.py
Install pip:
$ sudo easy_install pip
try sudo python -m easy_install pip
I ran into a similar problem with git-review.
$ git review -s
Traceback (most recent call last):
File "/usr/local/bin/git-review", line 11, in <module>
sys.exit(main())
File "/Library/Python/2.7/site-packages/git_review/cmd.py", line 1132, in main
(os.path.split(sys.argv[0])[-1], get_version()))
File "/Library/Python/2.7/site-packages/git_review/cmd.py", line 180, in get_version
provider = pkg_resources.get_provider(requirement)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 197, in get_provider
return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 666, in require
needed = self.resolve(parse_requirements(requirements))
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 565, in resolve
raise DistributionNotFound(req) # XXX put more info here
pkg_resources.DistributionNotFound: git-review
The git-review team said it was a bug with pkg_resources that could be fixed with
sudo pip install --upgrade setuptools
This worked fine for me.

Categories

Resources