question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AttributeError: 'module' object has no attribute 'packaging'

See original GitHub issue
# pip --version
pip 6.1.1 from /usr/local/lib/python2.7/dist-packages (python 2.7)
# pip install supervisor --pre
Collecting supervisor
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  Downloading supervisor-3.1.3.tar.gz (391kB)
    100% |████████████████████████████████| 393kB 950kB/s 
  Exception:
  Traceback (most recent call last):
    File "/usr/local/lib/python2.7/dist-packages/pip/basecommand.py", line 246, in main
      status = self.run(options, args)
    File "/usr/local/lib/python2.7/dist-packages/pip/commands/install.py", line 342, in run
      requirement_set.prepare_files(finder)
    File "/usr/local/lib/python2.7/dist-packages/pip/req/req_set.py", line 345, in prepare_files
      functools.partial(self._prepare_file, finder))
    File "/usr/local/lib/python2.7/dist-packages/pip/req/req_set.py", line 290, in _walk_req_to_install
      more_reqs = handler(req_to_install)
    File "/usr/local/lib/python2.7/dist-packages/pip/req/req_set.py", line 502, in _prepare_file
      abstract_dist.prep_for_dist()
    File "/usr/local/lib/python2.7/dist-packages/pip/req/req_set.py", line 123, in prep_for_dist
      self.req_to_install.run_egg_info()
    File "/usr/local/lib/python2.7/dist-packages/pip/req/req_install.py", line 363, in run_egg_info
      self.setup_py, self.name,
    File "/usr/local/lib/python2.7/dist-packages/pip/req/req_install.py", line 334, in setup_py
      import setuptools  # noqa
    File "/usr/local/lib/python2.7/dist-packages/setuptools/__init__.py", line 11, in <module>
      from setuptools.extension import Extension
    File "/usr/local/lib/python2.7/dist-packages/setuptools/extension.py", line 8, in <module>
      from .dist import _get_unpatched
    File "/usr/local/lib/python2.7/dist-packages/setuptools/dist.py", line 21, in <module>
      packaging = pkg_resources.packaging
  AttributeError: 'module' object has no attribute 'packaging'

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:1
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
hectordcommented, Apr 16, 2016

I had the same issue. After upgrading “distribute” from 0.6.24 to 0.7.3, it works. (pip install --upgrade distribute)

1reaction
Bluehorncommented, Aug 24, 2015

geremih commented on May 4

print pkg_resources.file I deleted the compiled file and everything was fine.

Thanks, this just worked for me as well. Actually that file was from an old distribute installation, which I removed by

$ pip uninstall distribute
Uninstalling distribute-0.6.49:
  /opt/dynasdk/loco2-rhel6/bin/easy_install
  /opt/dynasdk/loco2-rhel6/bin/easy_install-2.7
  /opt/dynasdk/loco2-rhel6/lib/python2.7/site-packages/distribute-0.6.49-py2.7.egg
Proceed (y/n)? y
  Successfully uninstalled distribute-0.6.49

I wonder if pip could detect this case.

Read more comments on GitHub >

github_iconTop Results From Across the Web

AttributeError: 'module' object has no attribute 'version'
I meet the some error, but the error for my situation is in mmcv library. I solve it with
Read more >
[setroubleshoot] AttributeError: module 'pkg_resources' has no ...
Description of problem: abrt-cli check found the error what AttributeError: module 'pkg_resources' has no attribute 'get_distribution', ...
Read more >
`setup.py install` from VCS checkout fails: AttributeError ...
#3 `setup.py install` from VCS checkout fails: AttributeError: 'module' object has no attribute 'ChangelogAwareDistribution'.
Read more >
no module named foo; AttributeError: 'module' object has no ...
I've gone through https://anvil.works/docs/structuring-your-app/how-to-import-things and searched the forums but still just can't work out ...
Read more >
SALT AttributeError: 'module' object has no attribute 'dockermod'
SALT AttributeError: 'module' object has no attribute 'dockermod'. This document (000020509) is provided subject to the disclaimer at the end of ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found