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.

pip3 -V yields: "ImportError: 'module' object has no attribute 'main'"

See original GitHub issue
  • Pip version: pip -V “pip 10.0.1”, pip2 -V “pip 1.5.4”
  • Python version: python --version “Python 2.7.6”, python3 --version “Python 3.4.3”
  • Operating system: 14.04.1-Ubuntu

I simply cannot get pip to function:

$ pip -V
pip 10.0.1 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7)
$ pip2 -V
pip 1.5.4 from /usr/lib/python2.7/dist-packages (python 2.7)
$ pip3 -V
Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/pkg_resources/__init__.py", line 2388, in resolve
    return functools.reduce(getattr, self.attrs, module)
AttributeError: 'module' object has no attribute 'main'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/pip3", line 9, in <module>
    load_entry_point('pip==9.0.3', 'console_scripts', 'pip3')()
  File "/usr/local/lib/python3.4/dist-packages/pkg_resources/__init__.py", line 547, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/local/lib/python3.4/dist-packages/pkg_resources/__init__.py", line 2720, in load_entry_point
    return ep.load()
  File "/usr/local/lib/python3.4/dist-packages/pkg_resources/__init__.py", line 2380, in load
    return self.resolve()
  File "/usr/local/lib/python3.4/dist-packages/pkg_resources/__init__.py", line 2390, in resolve
    raise ImportError(str(exc))
ImportError: 'module' object has no attribute 'main'

I may have mixed up using apt-get and pip to install and upgrade pip and now my system seem to be caught in a weird state, where I cannot get the most recent version of pip and keep running into these main associated errors.

I have spend several days googling and trying to fix the issue with no luck, so any help is greatly appreciated!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
sentientmachinecommented, Apr 2, 2019

I got this same error running pip3 install whatever because somehow my pip3 got bugged. The final solution was a forced purge and force upgrade pip3 using these commands:

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.py --force-reinstall

Apparently one can have multiple pip3’s on a system, and they can fight each other over turf.

0reactions
lock[bot]commented, May 30, 2019

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

AttributeError: Module Pip has no attribute 'main'
I am running python3 and my pip version is 10.0.0. The file in question is setup.py and the code that is messing up...
Read more >
AttributeError: 'module' object has no ... - Net-Informations.Com
Module object has no attribute error: Python. An attribute in Python means some property that is associated with a particular type of object...
Read more >
importlib — The implementation of import — Python 3.11.1 ...
Returns None if no source is available (e.g. a built-in module). Raises ImportError if the loader cannot find the module specified. Changed in...
Read more >
module collections has no attribute mapping - You.com
Getting AttributeError: module 'collections' has no attribute 'MutableMapping' while using any pip3 command on linux Python 3.10.0.
Read more >
Error saying ERROR Unexpected Exception module object ...
I have installed ansible and trying to run it but I get this error: ERROR! Unexpected Exception: 'module' object has no attribute '_vendor'...
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