I have six installed (even reinstalled it).
$ pip show six
---
Name: six
Version: 1.7.3
Location: /usr/lib/python2.6/site-packages
Requires:
But when I try to run csvcut, it can't find it.
$ csvcut -n monster.csv
Traceback (most recent call last):
File "/usr/bin/csvcut", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 2655, in <module>
working_set.require(__requires__)
File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 648, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 546, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: six>=1.6.1
Here's the relevant but of csvcut:
#!/usr/bin/python
# EASY-INSTALL-ENTRY-SCRIPT: 'csvkit==0.8.0','console_scripts','csvcut'
__requires__ = 'csvkit==0.8.0'
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.exit(
load_entry_point('csvkit==0.8.0', 'console_scripts', 'csvcut')()
)
This is on CentOS.
Uninstalling and reinstalling six using pip didn't work
sudo pip uninstall six
sudo pip install six
However, I was able to solve the problem using easy_install:
easy_install --upgrade six
Reason for this is when you install Six using PIP the location of the Six library isnt added to Pythons Path so when trying to use the commands, python cant find them. Installing with Easy_Install doesn't have this problem, when it is installing six it automatically updates the python path variable so python can find the library.
Installing by Easy_Install as answered before resolves this but you can alternatively add the location to the python path variable.
I came across the same problem today, reinstalling with pip did not work and i can not do it with easy_install as it a custom package
the solution was to point the PYTHONPATH variable to the site-packages that contains the package
export PYTHONPATH=$PYTHONPATH:/path/to/sites-package
you will face this problem if you work with virtual env
Related
>pip
Traceback (most recent call last):
File "/usr/bin/pip", line 6, in <module>
from pkg_resources import load_entry_point
File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 49, in <module>
from pkg_resources.extern import six
File "/usr/lib/python3.6/site-packages/pkg_resources/extern/__init__.py", line 61, in load_module
"distribution.".format(**locals())
ImportError: The 'six' package is required; normally this is bundled with this package so if you get this warning, consult the packager of your distribution.
I did reinstall with pacman -S python as well as pacman -S python-setuptools, pacman -S python-packaging, and pacman -S python-six, nothing helps.
Almost every other python applications follow the same pattern now (such as qutebrowser and buku.
I think it happened right after I installed vmware-vcli manually following the ArchWiki guide on the topic (I know its perl and might be unrelated though).
Downgrading python-setuptools as suggesting in similar posts by installing the earlier version in /var/cache/pacman/pkg did not fix the problem.
I faced exactly the same problem running pip3 install --upgrade pip.
However, pip3.5 install --upgrade pip worked for me. After this upgrade the error message of pip3 disappeared.
Having trouble installing modules via pip3, tried several suggestions from top voted thread from Dec' 2014, but still getting the following:
sudo pip3 install send2trash
Traceback (most recent call last):
File "/usr/bin/pip3", line 9, in <module>
load_entry_point('pip==1.5.6', 'console_scripts', 'pip3')()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 558, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2682, in load_entry_point
return ep.load()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2355, in load
return self.resolve()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2361, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
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'
On Ubuntu 15.10; tried removing python 3 completely and reinstalling, still having issues. Help?
Edit: UPDATE: Tried using my bootable USB to repair Ubuntu and get back to original config and reinstalled via sudo apt-get install python3-pip, but now it generates a crash report saying:
Sorry, the application pip3 has unexpectedly crashed.
This seems to be an issue with pip's interaction with the requests package. requests dropped the IncompleteRead module but older versions of pip, which you have, still rely on it, newer versions don't.
You should try updating pip via easy_install-3.5 (if you have Python 3.5) or easy_install-3 for other versions:
sudo easy_install-3.5 -U pip
or:
sudo easy_install-3 -U pip
and you should be good to go.
Had similar error on Raspberry Pi. The solution was a combination of all proposals above:
sudo pip install --upgrade pip
sudo pip install --upgrade requests
sudo easy_install3 -U pip
It happened me when I tried to install a pip module to my Python3 installation. I mistakenly run pip instead of pip3 and it installed Python2 modules into Python3 installation. After that I realized command was wrong, I run pip3 this time. But, it was no good, installation was blown up, there were errors in Python2 like parenthesis missing in print statement(obviously this is an error for Python3). Eventually, it blown up my terminal too, I needed to install another terminal.
Like you did, I tried to install and reinstall everything, but it didn't work. Fix needed to be done manually. After trying several days and failing, I backed up my files and reinstalled Ubuntu.
I know this is not what you want, but maybe you can save your time by accepting that reinstalling the OS is the easiest solution.
Make sure you install newest versions of pip and requests:
pip install --upgrade pip
pip install --upgrade requests
I decided to give pelican a try, but when I run pelican-quickstart, I get the following dialog:
$ pelican-quickstart
Traceback (most recent call last):
File "/usr/local/bin/pelican-quickstart", line 9, in <module>
load_entry_point('pelican==3.4.0', 'console_scripts', 'pelican-quickstart')()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 357, 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.py", line 2394, in load_entry_point
return ep.load()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2108, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/Library/Python/2.7/site-packages/pelican-3.4.0-py2.7.egg/pelican/__init__.py", line 20, in <module>
from pelican.generators import (ArticlesGenerator, PagesGenerator,
File "/Library/Python/2.7/site-packages/pelican-3.4.0-py2.7.egg/pelican/generators.py", line 23, in <module>
from pelican.readers import Readers
File "/Library/Python/2.7/site-packages/pelican-3.4.0-py2.7.egg/pelican/readers.py", line 24, in <module>
from six.moves.html_parser import HTMLParser
ImportError: No module named html_parser `
There was a similar error message in this post, and since I'm running Python 2.7.6 on OS X 10.10 (Yosemite), there may be a similar issue.
What's the best way to address this?
Reinstall Pelican doesn't help me, so I made a little fix in pelican
Modifications were made in following file
/Library/Python/2.7/site-packages/pelican/readers.py
at line 24 place
from six.moves import html_parser
instead of
from six.moves.html_parser import HTMLParser
and at line 299
class _HTMLParser(html_parser.HTMLParser):
instead of
class _HTMLParser(HTMLParser):
Modification actual for pelican 3.6.0, but seems to applicable for other version if search for this lines in readers.py file. This is just quick workaround, hope this problem will be solved at pelican's side.
This error seems to come from Python 2.7.6 on OSX. When I install python via Homebrew and reinstall this module I got rid of this error.
$ pip uninstall pelican
$ brew install python
$ which python # should show /usr/local/bin/python
$ python -V # should show Python 2.7.8
$ pip install pelican
I think that you've probably encountered with version conflict problem in module six.
Try sudo pip install virtualenv to create an isolate python environment.
start
create your pelican path mkdir /path/to/pelican
go to /path/to/pelican and create an isolate python environment with virtualenv venv
activate virtualenv source venv/bin/activate
install pelican under the venv(without sudo!) pip install pelican markdown
done
and now you are free to any problem mentioned above. all the dependencies in the venv are isolated from the global environment.
To quit the venv, type deactivate
I was running into the same error message.
six was also already installed, but an old version (1.4.1)
pip install six --upgrade
Installed six 1.10.0, which made pelican-quickstart finally work :)
You may need to install six.
if you're using pip, try
pip install six
and then restart pelican-quickstart
I'm completely new to programming. I've been trying various ways to install NLTK on my Mac (running OS 10.5.8), and none of them is working. Please help! Here's what I've done so far.
Since at first I didn't realize that newer versions of Python required OS 10.6 or higher, I first tried to install the latest versions of both Python 3 and Python 2, but this obviously didn't work. I then cottoned on and found an older installation (the filename is python-2.7.6-macosx10.3.dmg), which installed successfully.
I then tried to follow the instructions on this page, which I copy below:
Install Setuptools: http://pypi.python.org/pypi/setuptools
Install Pip: run sudo easy_install pip
Install Numpy (optional): run sudo pip install -U numpy
Install PyYAML and NLTK: run sudo pip install -U pyyaml nltk
Test installation: run python then type import nltk
Steps 1 and 2 worked fine, but when I try steps 3 and 4, I get an error. The error is the same whether I try step 3 or step 4:
unknown0021E9E0E476:~ Tom$ sudo pip install -U numpy
Traceback (most recent call last):
File "/usr/local/bin/pip", line 8, in <module> load_entry_point('pip==1.4.1', 'console_scripts', 'pip')()
File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/pkg_resources.py", line 271, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/pkg_resources.py", line 2173, in load_entry_point
return ep.load()
File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/pkg_resources.py", line 1906, in loadentry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/Library/Python/2.5/site-packages/pip-1.4.1-py2.5.egg/pip/__init__.py", line 10, in <module>
from pip.util import get_installed_distributions, get_prog
File "/Library/Python/2.5/site-packages/pip-1.4.1-py2.5.egg/pip/util.py", line 17, in <module>
from pip.vendor.distlib import version
File "/Library/Python/2.5/site-packages/pip-1.4.1-py2.5.egg/pip/vendor/distlib/version.py", line 13, in <module>
from .compat import string_types
File "/Library/Python/2.5/site-packages/pip-1.4.1-py2.5.egg/pip/vendor/distlib/compat.py", line 276
return b''
^
SyntaxError: invalid syntax
I then found a different set of instructions on this page. It first has you install Xcode and MacPorts, which I did (again finding older versions compatible with 10.5.8). I got through the next few steps successfully: installed python27, made it the system default (sudo port select --set python python27), and installed the dependencies py27-numpy, py27-yaml, and py27-scipy. However, I can't install one needed package, py27-matplotlib. Here's what happens when I try:
unknown0021E9E0E476:~ Tom$ sudo port install py27-matplotlib
---> Computing dependencies for py27-matplotlib
---> Dependencies to be installed: py27-pyobjc-cocoa py27-pyobjc py27-six py27-tkinter tk Xft2 tcl xorg-libXScrnSaver xorg-scrnsaverproto py27-tornado py27-backports-ssl_match_hostname py27-backports
---> Staging py27-pyobjc into destroot
Error: org.macports.destroot for port py27-pyobjc returned: command execution failed
Error: Failed to install py27-pyobjc
Please see the log file for port py27-pyobjc for details:
/opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_python_py-pyobjc/py27-pyobjc/main.log
Error: The following dependencies were not installed: py27-pyobjc-cocoa py27-pyobjc py27-six py27-tkinter tk Xft2 tcl xorg-libXScrnSaver xorg-scrnsaverproto py27-tornado py27-backports-ssl_match_hostname py27-backports
To report a bug, follow the instructions in the guide:
http://guide.macports.org/#project.tickets
Error: Processing of port py27-matplotlib failed
Without this package, I can't go on to install NLTK.
I've also tried installing NLTK in PyCharm, but that didn't work either: see this question. I'm at my wits' end here, so any help would be much appreciated!
ETA: Problem solved! I downloaded the tar.gz file from https://pypi.python.org/pypi/nltk and followed the install instructions in the package, and now I can import NLTK in the Python shell. Is it possible that I was simply trying to install things while in the wrong directory? (I'd still like to use NLTK in PyCharm, so answers to that question will still be welcome.)
Try installing the scipy package which includes matplotlib and numpy, I was a TA on a course where we used numpy and matplotlib quite a lot and using the scipy package to install was a solution for a lot of people.
The individual binary and source packages are available from: scipy docs
sudo port install py27-numpy py27-scipy py27-matplotlib py27-ipython +notebook py27-pandas py27-sympy py27-nose
I installed virtualenv using pip and now receive the following error whenever I actually try and use it:
% virtualenv
Traceback (most recent call last):
File "/bin/virtualenv", line 5, in <module>
from pkg_resources import load_entry_point
File "build/bdist.macosx-10.9-x86_64/egg/pkg_resources.py", line 2705, in <module>
File "build/bdist.macosx-10.9-x86_64/egg/pkg_resources.py", line 668, in require
File "build/bdist.macosx-10.9-x86_64/egg/pkg_resources.py", line 571, in resolve
pkg_resources.DistributionNotFound: virtualenv==1.11.2
%
Similarly, I installed django with pip, and when I try and import django in python I get: ImportError: No module named django.
I tried to install virtualenv again, this time using easy_install instead of pip. easy_install gave me an error saying that it was having issues with my PYTHONPATH environment variable. Lo and behold, after reading http://www.stereoplex.com/blog/understanding-imports-and-pythonpath, PYTHONPATH is what python uses to find modules, and my PYTHONPATH was unset.
After setting PYTHONPATH to /lib/python3.3/site-packages (where pip was installing my modules), both virtualenv and importing django functioned properly.
Note: because I have both python2.7 and python 3.3 installed, for me pip actually installs packages to /lib/python2.7/site-packages while pip3 installs packages to the aforementioned /lib/python3.3/site-packages.
For the unfamiliar, information on setting environment variables can be found here: https://help.ubuntu.com/community/EnvironmentVariables