ImportError: cannot import name ProtocolError - python

Recently I was having difficulties using pip and any time I tried to issue a pip command I was receiving the below error message.
File "/usr/bin/pip", line 9, in <module>
load_entry_point('pip==1.5', 'console_scripts', 'pip2.7')()
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 353, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2302, in load_entry_point
return ep.load()
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2029, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/usr/lib/python2.7/site-packages/pip/__init__.py", line 11, in <module>
from pip.vcs import git, mercurial, subversion, bazaar # noqa
File "/usr/lib/python2.7/site-packages/pip/vcs/mercurial.py", line 9, in <module>
from pip.download import path_to_url
File "/usr/lib/python2.7/site-packages/pip/download.py", line 22, in <module>
from pip._vendor import requests
File "/usr/lib/python2.7/site-packages/pip/_vendor/requests/__init__.py", line 58, in <module>
from . import utils
File "/usr/lib/python2.7/site-packages/pip/_vendor/requests/utils.py", line 25, in <module>
from .compat import parse_http_list as _parse_list_header
File "/usr/lib/python2.7/site-packages/pip/_vendor/requests/compat.py", line 7, in <module>
from .packages import charade as chardet
File "/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/__init__.py", line 3, in <module>
from . import urllib3
File "/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/__init__.py", line 16, in <module>
from .connectionpool import (
File "/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 33, in <module>
from .connection import (
File "/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/connection.py", line 41, in <module>
from .util import (
File "/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/__init__.py", line 18, in <module>
from .retry import Retry
File "/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/retry.py", line 4, in <module>
from ..exceptions import (
ImportError: cannot import name ProtocolError
I'm using openSUSE SLES 12.

So I struggled trying to find a solution to this error as everything that I searched for didn't help, that was until I eventually stumbled upon an answer to another pip related question on StackOverflow which solved my error. How do I fix 'ImportError: cannot import name IncompleteRead'?
So to get rid of this error message, issue the following command.
easy_install -U pip

Related

"ImportError: dynamic module does not define module export function (PyInit__socket)" when using pip in a new conda envrionment

when I try to start a new conda environment using
conda create --name myenv
and then
conda install -n myenv pip
and then I try use
pip
I get the following error message:
Traceback (most recent call last):
File "C:\Users\ese\Miniconda3\envs\myenv\Scripts\pip-script.py", line 6, in <module>
from pip._internal.cli.main import main
File "C:\Users\ese\Miniconda3\envs\myenv\lib\site-packages\pip\_internal\cli\main.py", line 9, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "C:\Users\ese\Miniconda3\envs\myenv\lib\site-packages\pip\_internal\cli\autocompletion.py", line 10, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "C:\Users\ese\Miniconda3\envs\myenv\lib\site-packages\pip\_internal\cli\main_parser.py", line 8, in <module>
from pip._internal.cli import cmdoptions
File "C:\Users\ese\Miniconda3\envs\myenv\lib\site-packages\pip\_internal\cli\cmdoptions.py", line 24, in <module>
from pip._internal.cli.parser import ConfigOptionParser
File "C:\Users\ese\Miniconda3\envs\myenv\lib\site-packages\pip\_internal\cli\parser.py", line 12, in <module>
from pip._internal.configuration import Configuration, ConfigurationError
File "C:\Users\ese\Miniconda3\envs\myenv\lib\site-packages\pip\_internal\configuration.py", line 20, in <module>
from pip._internal.exceptions import (
File "C:\Users\ese\Miniconda3\envs\myenv\lib\site-packages\pip\_internal\exceptions.py", line 13, in <module>
from pip._vendor.requests.models import Request, Response
File "C:\Users\ese\Miniconda3\envs\myenv\lib\site-packages\pip\_vendor\requests\__init__.py", line 43, in <module>
from pip._vendor import urllib3
File "C:\Users\ese\Miniconda3\envs\myenv\lib\site-packages\pip\_vendor\urllib3\__init__.py", line 11, in <module>
from . import exceptions
File "C:\Users\ese\Miniconda3\envs\myenv\lib\site-packages\pip\_vendor\urllib3\exceptions.py", line 3, in <module>
from .packages.six.moves.http_client import IncompleteRead as httplib_IncompleteRead
File "C:\Users\ese\Miniconda3\envs\myenv\lib\site-packages\pip\_vendor\urllib3\packages\six.py", line 234, in create_module
return self.load_module(spec.name)
File "C:\Users\ese\Miniconda3\envs\myenv\lib\site-packages\pip\_vendor\urllib3\packages\six.py", line 209, in load_module
mod = mod._resolve()
File "C:\Users\ese\Miniconda3\envs\myenv\lib\site-packages\pip\_vendor\urllib3\packages\six.py", line 118, in _resolve
return _import_module(self.mod)
File "C:\Users\ese\Miniconda3\envs\myenv\lib\site-packages\pip\_vendor\urllib3\packages\six.py", line 87, in _import_module
__import__(name)
File "C:\Users\ese\Miniconda3\envs\myenv\lib\http\client.py", line 71, in <module>
import email.parser
File "C:\Users\ese\Miniconda3\envs\myenv\lib\email\parser.py", line 12, in <module>
from email.feedparser import FeedParser, BytesFeedParser
File "C:\Users\ese\Miniconda3\envs\myenv\lib\email\feedparser.py", line 27, in <module>
from email._policybase import compat32
File "C:\Users\ese\Miniconda3\envs\myenv\lib\email\_policybase.py", line 9, in <module>
from email.utils import _has_surrogates
File "C:\Users\ese\Miniconda3\envs\myenv\lib\email\utils.py", line 29, in <module>
import socket
File "C:\Users\ese\Miniconda3\envs\myenv\lib\socket.py", line 51, in <module>
import _socket
ImportError: dynamic module does not define module export function (PyInit__socket)
I have tried reinstalling conda in my different versions and it keeps happening. I am actually having a feeling this might be related to having some weird restrictions on my company PC, but I am unsure. Anyone know how I could solve this? Thanks!

Cant install pip on mac? Using VS code

whenever i use the terminal and type pip3 install requests this is what happens:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/bin/pip3", line 11, in <module>
sys.exit(main())
File "/Users/hawawague/Library/Python/3.7/lib/python/site-packages/pip/_internal/__init__.py", line 13, in main
from pip._internal.utils.entrypoints import _wrapper
File "/Users/hawawague/Library/Python/3.7/lib/python/site-packages/pip/_internal/utils/entrypoints.py", line 4, in <module>
from pip._internal.cli.main import main
File "/Users/hawawague/Library/Python/3.7/lib/python/site-packages/pip/_internal/cli/main.py", line 9, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/Users/hawawague/Library/Python/3.7/lib/python/site-packages/pip/_internal/cli/autocompletion.py", line 10, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/Users/hawawague/Library/Python/3.7/lib/python/site-packages/pip/_internal/cli/main_parser.py", line 8, in <module>
from pip._internal.cli import cmdoptions
File "/Users/hawawague/Library/Python/3.7/lib/python/site-packages/pip/_internal/cli/cmdoptions.py", line 23, in <module>
from pip._internal.cli.parser import ConfigOptionParser
File "/Users/hawawague/Library/Python/3.7/lib/python/site-packages/pip/_internal/cli/parser.py", line 12, in <module>
from pip._internal.configuration import Configuration, ConfigurationError
File "/Users/hawawague/Library/Python/3.7/lib/python/site-packages/pip/_internal/configuration.py", line 21, in <module>
from pip._internal.exceptions import (
File "/Users/hawawague/Library/Python/3.7/lib/python/site-packages/pip/_internal/exceptions.py", line 8, in <module>
from pip._vendor.requests.models import Request, Response
File "/Users/hawawague/Library/Python/3.7/lib/python/site-packages/pip/_vendor/requests/__init__.py", line 123, in <module>
from . import utils
File "/Users/hawawague/Library/Python/3.7/lib/python/site-packages/pip/_vendor/requests/utils.py", line 27, in <module>
from ._internal_utils import to_native_string
File "/Users/hawawague/Library/Python/3.7/lib/python/site-packages/pip/_vendor/requests/_internal_utils.py", line 11, in <module>
from .compat import is_py2, builtin_str, str
File "/Users/hawawague/Library/Python/3.7/lib/python/site-packages/pip/_vendor/requests/compat.py", line 63, in <module>
from urllib.request import parse_http_list, getproxies, proxy_bypass, proxy_bypass_environment, getproxies_environment
ImportError: cannot import name 'parse_http_list' from 'urllib.request' (/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py)
Is there something I did wrong?
Try running pip3 install --upgrade pip
then try again with pip3 install requests

Pip does not work on linux returning error:“from urllib3.packages.ordered_dict import OrderedDict ImportError: No module named ordered_dict”

I noticed i couldn't use pip anymore because of Import error whatever i do with pip, can't eve just run "pip" without getting:
cannot install urllib3 or setuputils using pip so i tryed downloading and then setup.py install them. Nothing worked
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
load_entry_point('pip==1.5.6', 'console_scripts', 'pip')()
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 489,
in load_entry_point
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 2843,
in load_entry_point
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 2434,
in load
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 2440,
in resolve
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 80, in
<module>
from . import utils
File "/usr/lib/python2.7/dist-packages/requests/utils.py", line 25, in
<module>
from .compat import parse_http_list as _parse_list_header
File "/usr/lib/python2.7/dist-packages/requests/compat.py", line 94, in
<module>
from urllib3.packages.ordered_dict import OrderedDict
ImportError: No module named ordered_dict
if i try ti pip install anything it gives me the error. Any suggestion?

Why is pip not working properly on ubuntu?

Iv'e Looked and Looked and cannot figure out this problem. Pip will not work for anything at all and it is causing me much trouble. pip3 will work, but pip will not work at all. keeps spitting out this error having to do with cryptography module. other posts said to pip remove enum and pip install enum34, but the problem is that pip won't even allow me to do this. When I try to do anything with pip, it's spits out this error or similar.
Traceback (most recent call last):
File "/usr/local/bin/pip", line 11, in <module>
load_entry_point('pip==18.1.dev0', 'console_scripts', 'pip')()
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 480, 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 2693, in load_entry_point
return ep.load()
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2324, in load
return self.resolve()
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2330, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/usr/local/lib/python2.7/dist-packages/pip-18.1.dev0-py2.7.egg/pip/_internal/__init__.py", line 40, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/usr/local/lib/python2.7/dist-packages/pip-18.1.dev0-py2.7.egg/pip/_internal/cli/autocompletion.py", line 8, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/usr/local/lib/python2.7/dist-packages/pip-18.1.dev0-py2.7.egg/pip/_internal/cli/main_parser.py", line 8, in <module>
from pip._internal.cli import cmdoptions
File "/usr/local/lib/python2.7/dist-packages/pip-18.1.dev0-py2.7.egg/pip/_internal/cli/cmdoptions.py", line 17, in <module>
from pip._internal.index import (
File "/usr/local/lib/python2.7/dist-packages/pip-18.1.dev0-py2.7.egg/pip/_internal/index.py", line 14, in <module>
from pip._vendor import html5lib, requests, six
File "/usr/local/lib/python2.7/dist-packages/pip-18.1.dev0-py2.7.egg/pip/_vendor/requests/__init__.py", line 97, in <module>
from pip._vendor.urllib3.contrib import pyopenssl
File "/usr/local/lib/python2.7/dist-packages/pip-18.1.dev0-py2.7.egg/pip/_vendor/urllib3/contrib/pyopenssl.py", line 46, in <module>
import OpenSSL.SSL
File "/usr/lib/python2.7/dist-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import crypto, SSL
File "/usr/lib/python2.7/dist-packages/OpenSSL/crypto.py", line 12, in <module>
from cryptography import x509
File "/usr/lib/python2.7/dist-packages/cryptography/x509/__init__.py", line 8, in <module>
from cryptography.x509.base import (
File "/usr/lib/python2.7/dist-packages/cryptography/x509/base.py", line 16, in <module>
from cryptography.x509.extensions import Extension, ExtensionType
File "/usr/lib/python2.7/dist-packages/cryptography/x509/extensions.py", line 24, in <module>
from cryptography.x509.general_name import GeneralName, IPAddress, OtherName
File "/usr/lib/python2.7/dist-packages/cryptography/x509/general_name.py", line 18, in <module>
from cryptography.x509.name import Name
File "/usr/lib/python2.7/dist-packages/cryptography/x509/name.py", line 28, in <module>
_ASN1_TYPE_TO_ENUM = dict((i.value, i) for i in _ASN1Type)
TypeError: 'type' object is not iterable
Thank You Very Much
Try:
curl 'https://bootstrap.pypa.io/get-pip.py' -o get-pip.py
python get-pip.py --force-reinstall

Getting a python error when running the EB command

I installed ec2 api tools and when I run the command I get this error:
Traceback (most recent call last):
File "/usr/local/bin/eb", line 9, in <module>
load_entry_point('awsebcli==3.9.0', 'console_scripts', 'eb')()
File "/Library/Python/2.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 "/Library/Python/2.7/site-packages/distribute-0.6.49-py2.7.egg/pkg_resources.py", line 2381, in load_entry_point
return ep.load()
File "/Library/Python/2.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 "/Library/Python/2.7/site-packages/ebcli/core/ebcore.py", line 42, in <module>
from . import ebglobals, base, io, hooks
File "/Library/Python/2.7/site-packages/ebcli/core/hooks.py", line 21, in <module>
from ..lib import aws
File "/Library/Python/2.7/site-packages/ebcli/lib/aws.py", line 21, in <module>
import botocore.session
File "/Library/Python/2.7/site-packages/botocore/session.py", line 26, in <module>
import botocore.credentials
File "/Library/Python/2.7/site-packages/botocore/credentials.py", line 22, in <module>
from dateutil.parser import parse
File "/Library/Python/2.7/site-packages/dateutil/parser.py", line 43, in <module>
from . import tz
File "/Library/Python/2.7/site-packages/dateutil/tz/__init__.py", line 1, in <module>
from .tz import *
File "/Library/Python/2.7/site-packages/dateutil/tz/tz.py", line 23, in <module>
from ._common import tzname_in_python2, _tzinfo, _total_seconds
File "/Library/Python/2.7/site-packages/dateutil/tz/_common.py", line 2, in <module>
from six.moves import _thread
ImportError: cannot import name _thread
I installed it using:
sudo pip install --upgrade awsebcli

Categories

Resources