No Module Named Extern - python

I am having real trouble trying to use pip to install pyserial for python 3.5.2, I am trying to install pip using 'sudo easy_install pip'.
I keep getting this error message:
sudo easy_install pip
Traceback (most recent call last):
File "/usr/local/bin/easy_install", line 11, in <module>
load_entry_point('setuptools==29.0.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
Any Help would be appreciated.

Running sudo easy_install pip will install pip for Python 2, which you don't want if you're using Python 3.
You might have pip installed for Python 3 already (run which pip3 to check). If so, you can install pyserial using pip3
pip3 install pyserial
However, it would be better to use a virtual environment. See the hitchhiker's guide to Python to get started.

Related

An error message when execute pip

I am confused on python on its installation path and configuration.
I know pip this command for installation or listing the modules.
The example is like pip freeze. It will show up the list of module.
Recently, I got an error when I execute pip. I had python2 and python3 on the system without any virtualenv. I use ls /usr/bin/python* -al | awk {print $9 $10 $11} to know python commands and ls /usr/bin/pip* -al to know the pip commands.
python->python2.7
python2->python2.7
python2.7
python2.7-config->arm-linux-gnueabihf-python2.7-config
python2-config->python2.7-config
python3->python3.4
python3.4
python3.4m
python3m->python3.4m
python-config->python2.7-config
pip pip2 pip3
In addition, I use ls on /usr/local/bin and know the pip commands.
pip pip2 pip2.7 pip3 pip3.4 pip3.5
The error message is this when I execute pip.
Traceback (most recent call last):
File "/usr/local/bin/pip3", line 11, in <module>
load_entry_point('pip==9.0.1', 'console_scripts', 'pip3')()
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 572, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2752, in load_entry_point
return ep.load()
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2405, in load
return self.resolve()
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2411, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/usr/local/lib/python2.7/dist-packages/pip/__init__.py", line 76, in <module>
from pip.commands import commands, get_summaries, get_similar_commands
File "/usr/local/lib/python2.7/dist-packages/pip/commands/__init__.py", line 6, in <module>
from pip.commands.bundle import BundleCommand
File "/usr/local/lib/python2.7/dist-packages/pip/commands/bundle.py", line 6, in <module>
from pip.commands.install import InstallCommand
File "/usr/local/lib/python2.7/dist-packages/pip/commands/install.py", line 5, in <module>
from pip.req import InstallRequirement, RequirementSet, parse_requirements
File "/usr/local/lib/python2.7/dist-packages/pip/req/__init__.py", line 3, in <module>
from .req_install import InstallRequirement
File "/usr/local/lib/python2.7/dist-packages/pip/req/req_install.py", line 42, in <module>
from pip.utils.hashes import Hashes
File "/usr/local/lib/python2.7/dist-packages/pip/utils/hashes.py", line 5, in <module>
from pip.exceptions import HashMismatch, HashMissing, InstallationError
ImportError: cannot import name HashMissing`
How to resolve this error? Why does the system show up the error?
The result is the conflict without a specific command.
Use python2.7 -m pip or python2 -m pip for a specific command. Vice versa, on python3, use python3 -m pip or python3.4 -m pip for a specific command.
In addition, use python or python3 to get into interactive mode. Then, use import sys and sys.path to get the path of python package.

Error when using pip to install

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

Pip error when using "pip install ..."

Using OSX El Capitan. Just installed a bunch of pip module and was following a few online tutorials, must have broken something as now I get the following error whenever I try to use pip (although python seems to run fine).
$ pip install pandas
Traceback (most recent call last):
File "/usr/local/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
File "build/bdist.macosx-10.9-x86_64/egg/pkg_resources.py", line 2837, in <module>
File "build/bdist.macosx-10.9-x86_64/egg/pkg_resources.py", line 451, in _build_master
File "build/bdist.macosx-10.9-x86_64/egg/pkg_resources.py", line 464, in _build_from_requirements
File "build/bdist.macosx-10.9-x86_64/egg/pkg_resources.py", line 639, in resolve
pkg_resources.DistributionNotFound: pip==1.5.6
Any helping fixing would be much appreciated.
Thanks.
Reinstall using easy_install. Close the terminal and reopen. Pip should now work.
Try updating pip first by typing pip install -U pip and the try pip install pandas. I myself use Anaconda/Miniconda. Most of the packages are well handled and the dependencies are taken care of as well by the conda package manager.

ocdev won't run: SyntaxError: invalid Syntax

I can't get the ocdev tool to run. when I try running it i receive "SyntaxError: invalid syntax" with some code.
My guess is maybe wrong python version? Since python --version outputs 2.7.3.
I also have python3 installed but it's not the standard version. I installed ocdev using pip-3.2. I already tried reinstalling it multiple times. I also have python3-jinja2 installed. I'm running debian 7.8.
Here is the whole error:
Traceback (most recent call last):
File "/usr/local/bin/ocdev", line 9, in <module>
load_entry_point('ocdev==0.1.2', 'console_scripts', 'ocdev')()
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/ocdev/application.py", line 20, in <module>
from ocdev.plugins import PLUGINS
File "/usr/local/lib/python3.2/dist-packages/ocdev/plugins/__init__.py", line 1, in <module>
from ocdev.plugins.startapp.startapp import StartApp
File "/usr/local/lib/python3.2/dist-packages/ocdev/plugins/startapp/startapp.py", line 7, in <module>
from jinja2 import Environment, FileSystemLoader
File "/usr/local/lib/python3.2/dist-packages/jinja2/__init__.py", line 33, in <module>
from jinja2.environment import Environment, Template
File "/usr/local/lib/python3.2/dist-packages/jinja2/environment.py", line 639
u'\xff\xff\xff\xff'.encode('iso-8859-15')
^
SyntaxError: invalid syntax
In order to get ocdev to work with Python 3.2 you need to install legacy versions of Jinja2(source) and MarkupSafe(source). This is because the newer versions require Python 3.3.
To do the proper install follow the regular setup guide and use the following pip/pip3 commands:
pip install -Iv Jinja2==2.6
pip install -Iv MarkupSafe==0.15
pip install ocdev
I also reported this in the ocdev GitHub repository here.
It looks like you're running Python 3.2.
To use the u'unicode' syntax with Python 3 you'll need at least Python 3.3. (see What's New In Python 3.3)

Cannot install virtualenv using pip

I first installed distribute, then pip with easy_install but when I run:
sudo pip install virtualenv
I get these error messages:
Traceback (most recent call last):
File "/usr/bin/pip", line 8, in ? sys.exit(
File "/usr/lib/python2.4/site-packages/distribute-0.6.49-py2.4.egg/pkg_resources.py", line 345, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python2.4/site-packages/distribute-0.6.49-py2.4.egg/pkg_resources.py", line 2381, in load_entry_point
return ep.load()
File "/usr/lib/python2.4/site-packages/distribute-0.6.49-py2.4.egg/pkg_resources.py", line 2087, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/usr/lib/python2.4/site-packages/pip-1.4-py2.4.egg/pip/__init__.py", line 10, in ?
from pip.util import get_installed_distributions, get_prog
File "/usr/lib/python2.4/site-packages/pip-1.4-py2.4.egg/pip/util.py", line 17, in ?
from pip.vendor.distlib import version
File "/usr/lib/python2.4/site-packages/pip-1.4-py2.4.egg/pip/vendor/__init__.py", line 8
from __future__ import absolute_importSyntaxError: from __future__ imports must occur at the beginning of the file
I do not know what to do to install virtualenv properly now?
You appear to be using Python 2.4 - try creating the virtualenv with a version of Python which includes from __future__ import absolute_import (Python 2.5 or later).
You can specify which Python to use like this:
virtualenv -p /usr/bin/python2.7

Categories