I'm a mac user and installing with pip used to work. However I did something and now it doesn't work anymore. When running pip install somepackagename, I get the error ImportError: cannot import name DependencyWarning. I pasted the entire error below for trying to install PyPDF2.
For as far as I understand it the error is something with the requests module. I tried to uninstall it running pip uninstall requests, which results in the same error. Uninstalling other packages as well.
Anybody got an idea what's going wrong?
The error when installing PyPDF2
Traceback (most recent call last):
File "/Users/Arno/Library/Enthought/Canopy_64bit/User/bin/pip", line 9, in <module>
load_entry_point('pip==7.1.2', 'console_scripts', 'pip')()
File "/Users/Arno/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/pkg_resources/__init__.py", line 558, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/Users/Arno/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2682, in load_entry_point
return ep.load()
File "/Users/Arno/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2355, in load
return self.resolve()
File "/Users/Arno/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2361, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/Users/Arno/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/pip/__init__.py", line 22, in <module>
from pip._vendor.requests.packages.urllib3.exceptions import DependencyWarning
ImportError: cannot import name DependencyWarning
Related
I am testing an application and I am getting the above error "ImportError: No module named 'requests.packages.urllib3'" Below are the details.
[root#lab ~]# python /opt/test/panda_API.py
Traceback (most recent call last):
File "/opt/test/panda_API.py", line 8, in <module>
import requests
File "/usr/lib/python2.6/site-packages/requests/__init__.py", line 58, in <module>
from . import utils
File "/usr/lib/python2.6/site-packages/requests/utils.py", line 32, in <module>
from .exceptions import InvalidURL
File "/usr/lib/python2.6/site-packages/requests/exceptions.py", line 10, in <module>
from .packages.urllib3.exceptions import HTTPError as BaseHTTPError
File "/usr/lib/python2.6/site-packages/requests/packages/__init__.py", line 99, in load_module
raise ImportError("No module named '%s'" % (name,))
ImportError: No module named 'requests.packages.urllib3'
In a bid to resolve that, I try to pip install requests. Then the following error pops up.
[root#lab ~]# pip install requests
Traceback (most recent call last):
File "/usr/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/lib/python2.6/site-packages/pkg_resources/__init__.py", line 954, in <module>
class Environment:
File "/usr/lib/python2.6/site-packages/pkg_resources/__init__.py", line 958, in Environment
self, search_path=None, platform=get_supported_platform(),
File "/usr/lib/python2.6/site-packages/pkg_resources/__init__.py", line 188, in get_supported_platform
plat = get_build_platform()
File "/usr/lib/python2.6/site-packages/pkg_resources/__init__.py", line 388, in get_build_platform
from sysconfig import get_platform
ImportError: No module named sysconfig
I have searched for solution here on stack overflow and other platforms, the closest is the one in this page on stack overflow. (ImportError: No module named sysconfig--can't get pip working).
I have tried the steps proposed in the above link, yet the same error "ImportError: No module named sysconfig", keeps repeating.
Running "pip -V", generated the same error.
Running the recommended command to check the version of setuptools, generated the following error --------
[root#lab pkg_resources]# python2.6 -c "import setuptools; print(setuptools.__version__)"
`Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/python2.6/site-packages/setuptools/__init__.py", line 14, in <module >
import setuptools.version
File "/usr/lib/python2.6/site-packages/setuptools/version.py", line 1, in <module>
import pkg_resources
File "/usr/lib/python2.6/site-packages/pkg_resources/__init__.py", line 954, in <mo dule>
class Environment:
File "/usr/lib/python2.6/site-packages/pkg_resources/__init__.py", line 958, in Env ironment
self, search_path=None, platform=get_supported_platform(),
File "/usr/lib/python2.6/site-packages/pkg_resources/__init__.py", line 188, in get _supported_platform
plat = get_build_platform()
File "/usr/lib/python2.6/site-packages/pkg_resources/__init__.py", line 388, in get _build_platform
from sysconfig import get_platform
ImportError: No module named sysconfig
I have checked /usr/lib/python2.6/site-packages, and I do not have pkg_resources.py. Instead, what I have is the directory pkg_resources.
It appears that I have a more complicated case. Please I need help please!
Notes:
OS: CentOS release 6.10 (Final), and Python Version: Python 2.6.6
firstly run this command,
pip install requests urllib3 pyOpenSSL --force --upgrade
then install pyOpenSSL version 16.2.0 and run this command
pip install pyOpenSSL==16.2.0
Update your distribution packages! Python 2.6 is dead.
I was not being able to installed any module in the cygwin.
I have already:
Removed and reinstalled Python
Removed and reinstalled openssl and openssl-devel
However, the problems still happens?
$ pip install iplib
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
load_entry_point('pip==8.1.2', 'console_scripts', 'pip')()
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 552, i n load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2672, in load_entry_point
return ep.load()
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2345, in load
return self.resolve()
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2351, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/usr/lib/python2.7/site-packages/pip/__init__.py", line 16, in <module>
from pip.vcs import git, mercurial, subversion, bazaar # noqa
File "/usr/lib/python2.7/site-packages/pip/vcs/subversion.py", line 9, in <mod ule>
from pip.index import Link
File "/usr/lib/python2.7/site-packages/pip/index.py", line 30, in <module>
from pip.wheel import Wheel, wheel_ext
File "/usr/lib/python2.7/site-packages/pip/wheel.py", line 39, in <module>
from pip._vendor.distlib.scripts import ScriptMaker
File "/usr/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.py", line 1 4, in <module>
from .compat import sysconfig, detect_encoding, ZipFile
File "/usr/lib/python2.7/site-packages/pip/_vendor/distlib/compat.py", line 31 , in <module>
from urllib2 import (Request, urlopen, URLError, HTTPError,
ImportError: cannot import name HTTPSHandler
If reinstalling virtaulenv doesn't solve your problem, try installing OpenSSl(I do realize you've already reinstalled openssl but doesn't hurt to try it again):
yum install openssl openssl-devel -y
See this.
When I run the code as bzt test.yml I am getting the error.
Before it was working fine.
C:\etc\tmp\my-test>more test.yml
---
execution:
concurrency: 50
hold-for: 2m30s
ramp-up: 1m
scenario:
requests:
- url: http://server12:12012/
C:\etc\tmp\my-test>bzt test.yml
Traceback (most recent call last):
File "C:\Python27\Scripts\bzt-script.py", line 9, in <module>
load_entry_point('bzt==1.6.7', 'console_scripts', 'bzt')()
File "c:\python27\lib\site-packages\pkg_resources\__init__.py", line 564, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "c:\python27\lib\site-packages\pkg_resources\__init__.py", line 2621, in load_entry_point
return ep.load()
File "c:\python27\lib\site-packages\pkg_resources\__init__.py", line 2281, in load
return self.resolve()
File "c:\python27\lib\site-packages\pkg_resources\__init__.py", line 2287, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "c:\python27\lib\site-packages\bzt\cli.py", line 32, in <module>
from bzt.engine import Engine, Configuration, ScenarioExecutor
File "c:\python27\lib\site-packages\bzt\engine.py", line 37, in <module>
from bzt.six import build_opener, install_opener, urlopen, request, numeric_types, iteritems
File "c:\python27\lib\site-packages\bzt\six\__init__.py", line 35, in <module>
import elementtree.ElementTree as etree
ImportError: No module named elementtree.ElementTree
Sounds like missing or corrupt lxml package to me.
Workarounds are in:
Try out Taurus Installer
Reinstall lxml and/or bzt packages via pip.
Check out:
Taurus -> Installing and Upgrading -> Windows
Taurus: A New Star in the Test Automation Tools Constellation
for detailed setup instructions.
If the problem persists update your question with the bzt.log file contents.
ImportError: No module named elementtree.ElementTree
Are you sure it shouldn't be
import xml.etree.ElementTree as etree
Otherwise check if you have this dependency installed or if you have a "elementtree" folder in your current project that screws with the import lookup.
I'm trying to install a wheel file and keep stumbling over the following error:
pi#raspberrypi:~ $ pip-3.2 install DsController-1.0-py3-none-any.whl
Traceback (most recent call last):
File "/usr/bin/pip-3.2", line 9, in <module>
load_entry_point('pip==1.5.6', 'console_scripts', 'pip3')()
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 356, in
load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 2476, in
load_entry_point
return ep.load()
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 2190, in load
['__name__'])
File "/usr/lib/python3/dist-packages/pip/__init__.py", line 74, in <module>
from pip.vcs import git, mercurial, subversion, bazaar # noqa
File "/usr/lib/python3/dist-packages/pip/vcs/mercurial.py", line 9, in
<module>
from pip.download import path_to_url
File "/usr/lib/python3/dist-packages/pip/download.py", line 25, in <module>
from requests.compat import IncompleteRead
ImportError: cannot import name 'IncompleteRead'
I followed the answer in this thread: How do I fix 'ImportError: cannot import name IncompleteRead'?, unfortunately without success.
The Wheel can be installed without problems under Windows.
You are not picking up the version of pip that you have installed when running pip-3.2.
As you can see, version 8.1.2 of download.py does not import IncompleteRead. However, version 1.5.6 of download.py does.
Either your copy of pip and pip-3.2 are not the same executable (and so just using pip will work), or your system has a confused import path that means you are picking up the wrong version of the pip package. In the latter case, remvoing the old installation or fixing your import path should work.
So i'm using import requests in one of my python scripts but i keep getting a large error that looks to be the .get() method that i'm using out of the requests isn't there, or it wasn't installed correctly, now even when i try pip to get to the help menu it isnt doing it correctly. I followed the directions https://pip.pypa.io/en/stable/installing.html here, but even the python get-pip.py won't work? I feel like i am missing something very simple.. any advice? i know i have python installed correctly because whereis python comes back correctly with the location.
cambria#Vayne:~$ pip
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 521, 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 2632, in load_entry_point
return ep.load()
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2312, in load
return self.resolve()
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2318, 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 25, in <module>
from requests.compat import IncompleteRead
ImportError: cannot import name IncompleteRead
any light on this would help, i have been trying to fix this for a couple days now but im just not sure what isn't installed correctly or what i'm missing
thank you very much! sorry if i'm not clear enough english is my second language
It probably your internet connection. Try pip install requests if you haven't or not sure you installed it and turn on your internet.
It worked for me!