Home > database >  Error while finding module specification for 'pip' (AttributeError: module '__main__&
Error while finding module specification for 'pip' (AttributeError: module '__main__&

Time:01-06

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?

CodePudding user response:

This is a bug with setuptools. Version 60.3.0 has been 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

Disclaimer: I haven't tried this myself, but it looks fine.

CodePudding user response:

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

  •  Tags:  
  • Related