Xcode 11.2 has broken python pip

After installing XCode 11.2 on my 2 Macs (one iMac and other Macbook), both using MacOS Catalina 10.15.1, Python is broken.


For example when I run command to check pip version, I get following output:


pip3 --version

Traceback (most recent call last):
  File "/usr/local/bin/pip3", line 6, in <module>
    from pip._internal.main import main
ModuleNotFoundError: No module named 'pip._internal.main'


Any ideas what is going on? I haven't installed any third-party python/pip packages. Just using what is shipped with XCode.


In previous release 11.1, this worked well.

Answered by native.code in 392915022

Ok, I think I have fixed the problem. I was having this issue because I had manually upgraded pip. Version shipped with Catalina is 19.0.3 but when you use it in terminal, it asks you to update to 1.9.3.1 version. Which I did using pip install --upgrade pip.


It all worked until XCode 11.2 was installed. Somehow during installation it changed paths or something but the versions of pip, pip3 installed in /usr/local/bin (which were installed when I manually upgraded pip) stopped working. Since /usr/loca/bin directory comes first in my path, I was using these versions which were failing.


After I removed the manually installed pip 19.3.1 version, pip which comes with XCode and is installed in /usr/bin started to work like a charm.


Thanks @KMT for your help.

>when I run command to check pip version


I have 11.2 & I see:


pip 19.0.3 from /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/site-packages/pip (python 3.7)


Might want to try the Xcode 11.2.1 GM seed via downloads.

Accepted Answer

Ok, I think I have fixed the problem. I was having this issue because I had manually upgraded pip. Version shipped with Catalina is 19.0.3 but when you use it in terminal, it asks you to update to 1.9.3.1 version. Which I did using pip install --upgrade pip.


It all worked until XCode 11.2 was installed. Somehow during installation it changed paths or something but the versions of pip, pip3 installed in /usr/local/bin (which were installed when I manually upgraded pip) stopped working. Since /usr/loca/bin directory comes first in my path, I was using these versions which were failing.


After I removed the manually installed pip 19.3.1 version, pip which comes with XCode and is installed in /usr/bin started to work like a charm.


Thanks @KMT for your help.

Xcode 11.2 has broken python pip
 
 
Q