Pip: Pip AttributeError

Created on 17 Oct 2015  路  12Comments  路  Source: pypa/pip

pip -h works but whenever i try installing a module like pip install xyz, this happens:

Traceback (most recent call last):
File "C:\Python27\Scripts\pip-script.py", line 9, in
load_entry_point('pip==7.1.2', 'console_scripts', 'pip')()
File "C:\Python27\lib\site-packages\pip-7.1.2-py2.7.egg\pip__init__.py", line 217, in main
return command.main(cmd_args)
File "C:\Python27\lib\site-packages\pip-7.1.2-py2.7.egg\pip\basecommand.py", line 182, in main
for name in ["pip._vendor", "distlib", "requests", "urllib3"]
File "C:\Python27\lib\site-packages\pip-7.1.2-py2.7.egg\pip\compat\dictconfig.py", line 565, in dictConfig
dictConfigClass(config).configure()
File "C:\Python27\lib\site-packages\pip-7.1.2-py2.7.egg\pip\compat\dictconfig.py", line 332, in configure
del logging._handlerList[:]
AttributeError: 'module' object has no attribute '_handlerList'

Why is this happening and any solutions?

auto-locked

Most helpful comment

@Aarushi-Ign You shouldn't have _any_ logging-0.4.9.6, or easy_install logging. The logging module is part of the standard library. What seems to be happening is that your 3rd-party logging module is overriding the stdlib version (that's a fault of easy_install, which puts 3rd party modules _ahead_ of the standard library in PYTHONPATH).

Try uninstalling all 3rd party logging modules, and that should fix your issue.

All 12 comments

This is Python 2.7? That's confusing... that shouldn't be used on Python 2.7. What happens if you open up Python and run:

from logging.config import dictConfig as logging_dictConfig

@dstufft It gives the following error:

from logging.config import dictConfig as logging_dictConfig
Traceback (most recent call last):
File "", line 1, in
ImportError: cannot import name dictConfig

This is Python 2.7 right?

ya 2.7.6 to be exact

It seems like your Python installation is messed up. That's part of the standard library, see https://docs.python.org/2/library/logging.config.html#logging.config.dictConfig

Great. I am gonna reinstall logging module again for 2.7 version

@dstufft Pip is not working so i tried easy_install -m logging which doesn't work because it doesn't delete anything. So I deleted logging-0.4.9.6-py2.7.egg present in site-packages and tried installing logging by easy_install-2.7 logging and it installed the same version that is 0.4.9.6

But this command still doesn't work
from logging.config import dictConfig as logging_dictConfig

@Aarushi-Ign You shouldn't have _any_ logging-0.4.9.6, or easy_install logging. The logging module is part of the standard library. What seems to be happening is that your 3rd-party logging module is overriding the stdlib version (that's a fault of easy_install, which puts 3rd party modules _ahead_ of the standard library in PYTHONPATH).

Try uninstalling all 3rd party logging modules, and that should fix your issue.

@pfmoore It worked. I just deleted the logging-0.4.9.6-py2.7.egg folder and pip worked.
Thank you so much.

I am having the same issue in Mac OS X with all the same errors as Traceback (most recent call last):
File "/usr/local/bin/pip", line 9, in
load_entry_point('pip==9.0.1', 'console_scripts', 'pip')()
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/__init__.py", line 233, in main
return command.main(cmd_args)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/basecommand.py", line 185, in main
for name in ["pip._vendor", "distlib", "requests", "urllib3"]
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/compat/dictconfig.py", line 565, in dictConfig
dictConfigClass(config).configure()
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/compat/dictconfig.py", line 332, in configure
del logging._handlerList[:]
AttributeError: 'module' object has no attribute '_handlerList'

I also searched that there is no other logging installed, is there any other way I can get pip working?

+1 to @shahshalin91 comment

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings