I am running a python project into a virtualenv on Ubuntu 16.04. Until now everything was working as it should, i.e. I could install libraries through pip and listing the installed packages. I am not sure what happened but whenever I try to run pip freeze I get this at the end of python traceback:

File "/home/diego/work/cg/venv/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/retry.py", 
line 15, in <module>
log = logging.getLogger(__name__)
AttributeError: 'module' object has no attribute 'getLogger'

Do you have an idea what happened and how can I fix this? thanks

  • Did you activate the virtualenv?
    – don.joey
    Commented Jan 30, 2017 at 13:48
  • @don.joey Yes with source venev/bin/activate
    – diegus
    Commented Jan 30, 2017 at 13:52
  • Did you create a file called logging.py?
    – don.joey
    Commented Jan 30, 2017 at 13:54
  • @don.joey Well, this project actually contains a folder called logging with a file in it called initialize_logging.py
    – diegus
    Commented Jan 30, 2017 at 13:59
  • I actually solved the problem moving the venv folder to another folder that does not contain subfolder with logging name and it works again
    – diegus
    Commented Jan 30, 2017 at 14:02

1 Answer 1


This is because you created a file logging.py or a folder logging that is on the PYTHONPATH and that conflicts with the logging module required for pip to work.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .