Setting functools gives me an AttributeError object 'module' does not have an attribute 'compose'

I installed Ubuntu 12.04 64 bit on a new system and cannot install functools. I installed this several times, but I donโ€™t remember this error and cannot find any solution through Google. What do I need to do?

(myvenv)bobs@myvenv:~$ pip install functools Downloading/unpacking functools Downloading functools-0.5.tar.gz Running setup.py egg_info for package functools Traceback (most recent call last): File "<string>", line 3, in <module> File "/home/bobs/.virtualenvs/myvenv/local/lib/python2.7/site-packages/setuptools/__init__.py", line 2, in <module> from setuptools.extension import Extension, Library File "/home/bobs/.virtualenvs/myvenv/local/lib/python2.7/site-packages/setuptools/extension.py", line 5, in <module> from setuptools.dist import _get_unpatched File "/home/bobs/.virtualenvs/myvenv/local/lib/python2.7/site-packages/setuptools/dist.py", line 10, in <module> from setuptools.compat import numeric_types, basestring File "/home/bobs/.virtualenvs/myvenv/local/lib/python2.7/site-packages/setuptools/compat.py", line 17, in <module> import httplib File "/usr/lib/python2.7/httplib.py", line 71, in <module> import socket File "/usr/lib/python2.7/socket.py", line 49, in <module> from functools import partial File "functools.py", line 72, in <module> globals()['c_%s' % x] = globals()[x] = getattr(_functools, x) AttributeError: 'module' object has no attribute 'compose' Complete output from command python setup.py egg_info: Traceback (most recent call last): File "<string>", line 3, in <module> File "/home/bobs/.virtualenvs/myvenv/local/lib/python2.7/site-packages/setuptools/__init__.py", line 2, in <module> from setuptools.extension import Extension, Library File "/home/bobs/.virtualenvs/myvenv/local/lib/python2.7/site-packages/setuptools/extension.py", line 5, in <module> from setuptools.dist import _get_unpatched File "/home/bobs/.virtualenvs/myvenv/local/lib/python2.7/site-packages/setuptools/dist.py", line 10, in <module> from setuptools.compat import numeric_types, basestring File "/home/bobs/.virtualenvs/myvenv/local/lib/python2.7/site-packages/setuptools/compat.py", line 17, in <module> import httplib File "/usr/lib/python2.7/httplib.py", line 71, in <module> import socket File "/usr/lib/python2.7/socket.py", line 49, in <module> from functools import partial File "functools.py", line 72, in <module> globals()['c_%s' % x] = globals()[x] = getattr(_functools, x) AttributeError: 'module' object has no attribute 'compose' ---------------------------------------- Cleaning up... Command python setup.py egg_info failed with error code 1 in /home/bobs/.virtualenvs/myvenv/build/functools Storing complete log in /home/bobs/.pip/pip.log 
+11
python pip
source share
3 answers

Python2.7 comes with functools enabled.

You can install functools32 if you want to get the lru-cache decorator that was introduced with Python3.2.

Edit: I really checked this out. I have the same error when I tried to connect functools using Python2.7. Just do import functools and continue as usual.

+10
source share

Received a solution on the windows.

  • Remove the link to functools in the site-packages folder.
  • easy_install -U pip==7.1.2
0
source share

Make sure this is the version of functools32 in Python version 2.x. 3.x tools are built-in.

0
source share

All Articles