When I'm trying to install any package using pip it gives an error. It shows "ImportError: No module named helpers". I tried installing the helpers module using pip but the same error occurred. I'm pasting the output of the error message. Operating System: Arch Linux.
pip2 install requests
Error:
Traceback (most recent call last):
File "/usr/bin/pip2", line 11, in <module>
load_entry_point('pip==18.1', 'console_scripts', 'pip')()
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 489, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2793, in load_entry_point
return ep.load()
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2411, in load
return self.resolve()
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2417, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/usr/lib/python2.7/site-packages/pip/_internal/__init__.py", line 40, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/usr/lib/python2.7/site-packages/pip/_internal/cli/autocompletion.py", line 8, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/usr/lib/python2.7/site-packages/pip/_internal/cli/main_parser.py", line 8, in <module>
from pip._internal.cli import cmdoptions
File "/usr/lib/python2.7/site-packages/pip/_internal/cli/cmdoptions.py", line 22, in <module>
from pip._internal.utils.ui import BAR_TYPES
File "/usr/lib/python2.7/site-packages/pip/_internal/utils/ui.py", line 15, in <module>
from pip._vendor.progress.helpers import HIDE_CURSOR, SHOW_CURSOR, WritelnMixin
ImportError: No module named helpers
Thanks for everyone's help. I found out the solution. When I upgraded to python 3.7 pip was broken.
Executing these commands solved the issue.
rm -rf /usr/lib/python3.7/site-packages
python3.7 -m ensurepip
pip install --upgrade pip
Same can be used with Python2 as well, just replacing 3.7 with 2.7 and pip with pip2.
Related
Usually, pip3 works normally, but after installing tenser flow using pip, for some reason pip is not working anymore. For example, I did pip freeze to get my packages, but it came up with this error.
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/bin/pip", line 7, in <module>
from pip._internal import main
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/_internal/__init__.py", line 42, in <module>
from pip._internal import cmdoptions
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/_internal/cmdoptions.py", line 16, in <module>
from pip._internal.index import (
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/_internal/index.py", line 24, in <module>
from pip._internal.download import HAS_TLS, is_url, path_to_url, url_to_path
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/_internal/download.py", line 39, in <module>
from pip._internal.utils.logging import indent_log
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/_internal/utils/logging.py", line 9, in <module>
from pip._internal.utils.misc import ensure_dir
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/_internal/utils/misc.py", line 21, in <module>
from pip._vendor import pkg_resources
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3095, in <module>
#_call_aside
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3079, in _call_aside
f(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3123, in _initialize_master_working_set
for dist in working_set
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3123, in <genexpr>
for dist in working_set
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2633, in activate
declare_namespace(pkg)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2170, in declare_namespace
_handle_ns(packageName, path_item)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2105, in _handle_ns
loader.load_module(packageName)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pygoogle/google.py", line 118
%(__credits__)s""" % globals()
^
SyntaxError: invalid syntax
But when I do pip2 freeze it works completely normal.
I'm not sure if tenserflow is causing this, but it started happening after I installed it.
I have a mac os sierra 10.13.4, and did the commands on my terminal. I am using python 3.6.6 . Is there any way to fix this? I also tried uninstalling tensor flow.
It seems the cause of the problem is a Python 2.7 module somehow getting installed into python 3.6 folder. The guilty module is pygoogle. Uninstalling that may work. See:
https://www.pythonanywhere.com/forums/topic/12390/
Tensorflow SyntaxError with python 3.5.2
Some of my python packages installed with pip had conflicts with another package I tried installing using pacman. So I decided to uninstall all the packages installed with pip. I made a requirements.txt file with all the packages and started uninstalling them. It worked fine for a while but eventually gave this error:
Traceback (most recent call last):
File "/usr/bin/pip", line 11, in <module>
load_entry_point('pip==10.0.1', 'console_scripts', 'pip')()
File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 479, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2703, in load_entry_point
return ep.load()
File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2321, in load
return self.resolve()
File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2327, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/usr/lib/python3.6/site-packages/pip/_internal/__init__.py", line 42, in <module>
from pip._internal import cmdoptions
File "/usr/lib/python3.6/site-packages/pip/_internal/cmdoptions.py", line 16, in <module>
from pip._internal.index import (
File "/usr/lib/python3.6/site-packages/pip/_internal/index.py", line 15, in <module>
from pip._vendor import html5lib, requests, six
ImportError: cannot import name 'requests'
I got a similar error everytime I tried running pip after that.
Setting up a new mac here. I just installed python with brew install python, but when I try to install virtualenv with sudo pip install virtualenv it returns sudo: pip: command not found.
When I try sudo easy_install pip it returns the following response
Traceback (most recent call last):
File "/usr/local/bin/easy_install", line 11, in <module>
load_entry_point('setuptools==33.1.1', 'console_scripts', 'easy_install')()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 565, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 2697, in load_entry_point
return ep.load()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 2370, in load
return self.resolve()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 2376, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "build/bdist.macosx-10.12-intel/egg/setuptools/__init__.py", line 10, in <module>
File "build/bdist.macosx-10.12-intel/egg/setuptools/extern/__init__.py", line 1, in <module>
ImportError: No module named extern
I can't imagine what is happening, but with my old installation I had any of this problems. Any help woul be really helpful…
I update this question to post a possible solution:
curl https://bootstrap.pypa.io/get-pip.py | sudo python
I am getting the following error while using pip command, in anaconda.
C:\Users\name>pip install xmlschema
Traceback (most recent call last):
File "C:\ANACONDA2\Scripts\pip-script.py", line 9, in <module>
load_entry_point('pip==9.0.1', 'console_scripts', 'pip')()
File "C:\ANACONDA2\lib\site-packages\setuptools-18.4-py2.7.egg\pkg_resources\__init__.py", line 558, in load_entry_point
File "C:\ANACONDA2\lib\site-packages\setuptools-18.4-py2.7.egg\pkg_resources\__init__.py", line 2682, in load_entry_point
File "C:\ANACONDA2\lib\site-packages\setuptools-18.4-py2.7.egg\pkg_resources\__init__.py", line 2355, in load
File "C:\ANACONDA2\lib\site-packages\setuptools-18.4-py2.7.egg\pkg_resources\__init__.py", line 2361, in resolve
File "c:\anaconda2\lib\site-packages\pip\__init__.py", line 28, in <module>
from pip.vcs import git, mercurial, subversion, bazaar # noqa
File "c:\anaconda2\lib\site-packages\pip\vcs\subversion.py", line 9, in <module>
from pip.index import Link
File "c:\anaconda2\lib\site-packages\pip\index.py", line 33, in <module>
from pip._vendor import html5lib, requests, six
File "c:\anaconda2\lib\site-packages\pip\_vendor\html5lib\__init__.py", line 19, in <module>
from .serializer import serialize
File "c:\anaconda2\lib\site-packages\pip\_vendor\html5lib\serializer\__init__.py", line 5, in <module>
from .htmlserializer import HTMLSerializer
File "c:\anaconda2\lib\site-packages\pip\_vendor\html5lib\serializer\htmlserializer.py", line 11, in <module>
from .. import utils
ImportError: cannot import name utils
I am having utils package, but still throwing ImportError: cannot import name utils
On windows there is no sudo command. You have to run the command line as administrator and run the pip commands from above without sudo.
you can try this commands to fix it:
pip uninstall requests
pip install --upgrade requests
if you have trouble about to execute pip command on windows, check this link
Whenever I try to install anything using pip I get the following error:
$ sudo pip install --upgrade pip
Traceback (most recent call last):
File "/usr/local/bin/pip", line 9, in <module>
load_entry_point('pip==7.0.3', 'console_scripts', 'pip')()
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 558, in load_entry_point
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 2682, in load_entry_point
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 2355, in load
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 2361, in resolve
File "/usr/local/lib/python2.7/site-packages/pip-7.0.3-py2.7.egg/pip/__init__.py", line 15, in <module>
from pip.vcs import git, mercurial, subversion, bazaar # noqa
File "/usr/local/lib/python2.7/site-packages/pip-7.0.3-py2.7.egg/pip/vcs/subversion.py", line 9, in <module>
from pip.index import Link
File "/usr/local/lib/python2.7/site-packages/pip-7.0.3-py2.7.egg/pip/index.py", line 30, in <module>
from pip.wheel import Wheel, wheel_ext
File "/usr/local/lib/python2.7/site-packages/pip-7.0.3-py2.7.egg/pip/wheel.py", line 35, in <module>
from pip._vendor.distlib.scripts import ScriptMaker
File "/usr/local/lib/python2.7/site-packages/pip-7.0.3-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'
This also happens when I try to upgrade pip, install sphinx or basically any install/upgrade option using pip.
I am running Ubuntu 15.10 and using Python 2.7.10
StackOverflow has said this is a duplicate, and that there is a solution at ImportError: No module named 'pip._vendor.distlib.scripts' when I try to install fabric by python pip however the recommend solution on this post is not actually a soltuion. It does not solve my issue, nor does it appear to solve the original posters problem.
Try this:
sudo pip install --upgrade --no-use-wheel pip