12

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.

mhwombat
  • 8,026
  • 28
  • 53

3 Answers3

19

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
mhwombat
  • 8,026
  • 28
  • 53
  • 1
    I was having problems with the amazon web services (aws) command-line tools, and errors finding six. This solution worked... somehow. Is this a bug? How does this solution actually work? – tmpearce Feb 23 '15 at 04:20
  • Note: If using virtual-env, do not use "sudo pip ...". I just made this mistake. It breaks out of the virtual-env: compare "which pip" to "sudo which pip". – Curtis Yallop Mar 30 '17 at 19:58
1

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.

Adam Black
  • 11
  • 1
0

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