Falderol
Falderol

Reputation: 172

Error while finding module specification for 'pip' (AttributeError: module '__main__' has no attribute '__file__')

Long story short, I did a pip upgrade and a command that told it to install a bunch of dependencies in one file, and now when i try to do anything with pip, it is throwing me

For example, running

py -m pip -V

throws

Error while finding module specification for 'pip' (AttributeError: module '__main__' has no attribute '__file__')

Along with anything else that involves my trying to call my python 3.8 pip.

Running

py -m ensurepip

Tells me that pip is infact installed.

Requirement already satisfied: setuptools in c:\program files (x86)\python38-32\lib\site-packages (60.3.0)
Requirement already satisfied: pip in c:\program files (x86)\python38-32\lib\site-packages (21.3.1)

Which covers the pip not installed, and module not installed case that similar questions appear to be solved by. So, does anyone have any idea what is going on and how to get pip to start working again as a module?

Upvotes: 4

Views: 3020

Answers (2)

Tian Lady
Tian Lady

Reputation: 11

Thanks, and I need use pip3 install --upgrade setuptools==60.2.0

Upvotes: 1

wjandrea
wjandrea

Reputation: 33159

This was a bug with setuptools. Version 60.3.1 has now been released to fix it.


Previously, version 60.3.0 was yanked from PyPI, which I believe resolves the issue once you run another upgrade. (I wasn't hit by it myself.) If not, GitHub user ferrants suggested this workaround:

python3 -m pip install --upgrade setuptools==60.2.0

Upvotes: 5

Related Questions