Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'module' object has no attribute 'PY2'

I am using ubuntu 14.04, was trying to install python-memcache. I have got an error like

Downloading/unpacking python-memcached
  Downloading python-memcached-1.53.tar.gz
Cleaning up...
Exception:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 278, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1229, in prepare_files
    req_to_install.run_egg_info()
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 292, in run_egg_info
    logger.notify('Running setup.py (path:%s) egg_info for package %s' % (self.setup_py, self.name))
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 284, in setup_py
    if six.PY2 and isinstance(setup_py, six.text_type):
AttributeError: 'module' object has no attribute 'PY2'

Storing debug log for failure in /home/mani/.pip/pip.log

I am getting the same error when installing Django-celery, pymongo etc

like image 506
V Manikandan Avatar asked Jun 06 '14 11:06

V Manikandan


1 Answers

The problem in this case was simply that a very old version of the package six was used that didn't have the PY2 identifier.

Since the package had been installed with pip it was sufficient to upgrade it using:

pip install --upgrade six
like image 189
otus Avatar answered Nov 10 '22 09:11

otus