pip install error: cannot import name 'unpack_url' - python

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.

Related

pipenv virtual environment error with package install

I am new to using pipenv virtual environments. I am using one with a Django project. Recently I tried to start the environment with pipenv shell. I got a message that something like there was no environment available even though I have been using it for several months.
I exited the directory and re-entered. Then ran pipenv shell again. This time the env was activated. However when I try to install a package or run pipenv lock --clear I get the following error:
Locking [dev-packages] dependencies...
Locking [packages] dependencies...
Building requirements...
Resolving dependencies...
✘ Locking Failed!
Traceback (most recent call last):
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/resolver.py", line 764, in <module>
main()
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/resolver.py", line 758, in main
_main(parsed.pre, parsed.clear, parsed.verbose, parsed.system, parsed.write,
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/resolver.py", line 741, in _main
resolve_packages(pre, clear, verbose, system, write, requirements_dir, packages, dev)
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/resolver.py", line 695, in resolve_packages
from pipenv.core import project
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/core.py", line 33, in <module>
from .project import Project
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/project.py", line 30, in <module>
from .vendor.requirementslib.models.utils import get_default_pyproject_backend
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/vendor/requirementslib/__init__.py", line 9, in <module>
from .models.lockfile import Lockfile
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/vendor/requirementslib/models/lockfile.py", line 14, in <module>
from ..utils import is_editable, is_vcs, merge_items
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/vendor/requirementslib/utils.py", line 8, in <module>
import pip_shims.shims
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/vendor/pip_shims/__init__.py", line 26, in <module>
from . import shims
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/vendor/pip_shims/shims.py", line 12, in <module>
from .models import (
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/vendor/pip_shims/models.py", line 790, in <module>
Command.add_mixin(SessionCommandMixin)
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/vendor/pip_shims/models.py", line 704, in add_mixin
mixin = mixin.shim()
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/vendor/pip_shims/models.py", line 752, in shim
result = self.traverse(top_path)
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/vendor/pip_shims/models.py", line 744, in traverse
result = shim.shim()
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/vendor/pip_shims/models.py", line 590, in shim
imported = self._import()
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/vendor/pip_shims/models.py", line 615, in _import
result = self._import_module(self.calculated_module_path)
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/vendor/pip_shims/models.py", line 365, in _import_module
imported = importlib.import_module(module)
File "/Users/mainuser/.pyenv/versions/3.9.2/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/patched/notpip/_internal/cli/req_command.py", line 15, in <module>
from pipenv.patched.notpip._internal.index.package_finder import PackageFinder
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/patched/notpip/_internal/index/package_finder.py", line 21, in <module>
from pipenv.patched.notpip._internal.index.collector import parse_links
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/patched/notpip/_internal/index/collector.py", line 12, in <module>
from pipenv.patched.notpip._vendor import html5lib, requests
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/patched/notpip/_vendor/requests/__init__.py", line 97, in <module>
from pipenv.patched.notpip._vendor.urllib3.contrib import pyopenssl
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/patched/notpip/_vendor/urllib3/contrib/pyopenssl.py", line 46, in <module>
import OpenSSL.SSL
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import rand, crypto, SSL
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/OpenSSL/rand.py", line 213, in <module>
_lib.ERR_load_RAND_strings()
AttributeError: module 'lib' has no attribute 'ERR_load_RAND_strings'
I am not sure how to interpret this but it looks like python3.6 is being used when the shell and project python version is 3.9.
Any ideas about what is causing this and how to fix it?

Docker-Cloud CLI Error on Windows

I'm trying to install the Docker-Cloud CLI with pip, and it installs successfully. However, when I check the version (as suggested by the site), I get the error in the paste below. I'm running Windows 10 and Python 3.6.
Traceback (most recent call last):
File "C:\Users\aglas\AppData\Local\Programs\Python\Python36-32\Scripts\docker-cloud-script.py", line 11, in <module>
load_entry_point('docker-cloud==1.0.7', 'console_scripts', 'docker-cloud')()
File "c:\users\aglas\appdata\local\programs\python\python36-32\lib\site-packages\pkg_resources\__init__.py", line 565, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "c:\users\aglas\appdata\local\programs\python\python36-32\lib\site-packages\pkg_resources\__init__.py", line 2631, in load_entry_point
return ep.load()
File "c:\users\aglas\appdata\local\programs\python\python36-32\lib\site-packages\pkg_resources\__init__.py", line 2291, in load
return self.resolve()
File "c:\users\aglas\appdata\local\programs\python\python36-32\lib\site-packages\pkg_resources\__init__.py", line 2297, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "c:\users\aglas\appdata\local\programs\python\python36-32\lib\site-packages\dockercloudcli\cli.py", line 10, in <module>
from dockercloudcli import commands
File "c:\users\aglas\appdata\local\programs\python\python36-32\lib\site-packages\dockercloudcli\commands.py", line 15, in <module>
from dockercloudcli import utils
File "c:\users\aglas\appdata\local\programs\python\python36-32\lib\site-packages\dockercloudcli\utils.py", line 16, in <module>
from exceptions import BadParameter, StreamOutputError
ModuleNotFoundError: No module named 'exceptions'

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.

Failed install after installing Myysql-python

Problem using MySQLdb after installing MySQLdb-python. I followed the instructions I followed the instruction that had me delete the build and delete the egg then modify the my_config and then run the install again. I also tried installing the 64 bit version still no luck
Traceback (most recent call last):
File "/Users/nick.leclair/Documents/Aptana Studio 3 Workspace/Tester/driveByScript.py", line 1, in <module>
import MySQLdb
File "build/bdist.macosx-10.9-intel/egg/MySQLdb/__init__.py", line 19, in <module>
File "build/bdist.macosx-10.9-intel/egg/_mysql.py", line 7, in <module>
File "build/bdist.macosx-10.9-intel/egg/_mysql.py", line 4, in __bootstrap__
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 882, in resource_filenameself, resource_name
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 1351, in get_resource_filename self._extract_resource(manager,self._eager_to_zip(name))
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 1382, in _extract_resource outf, tmpnam = _mkstemp(".$extract", dir=os.path.dirname(real_path))
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2576, in _mkstemp
from tempfile import mkstemp
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/tempfile.py", line 35, in <module>
ImportError: cannot import name Random
Problem solved, it was problem with Aptana not picking up the new library.

Categories

Resources