I was using Big Sur with Python 3.8.2 (not Homebrew's, but native OS' Python) and I had a lot of packages installed (around 60). Now I updated my OS to Monterey 12.6 and I updated Xcode to 14.0 which updated Python to 3.9.6. And I had a very nasty surprise - all of my packages are gone. There is not a single package I installed when I was using Python 3.8.2. I sure hope it didn't delete them for good. I found some of them in ~/Library/Python/3.8
but not all. If I knew this would happen, I would use pip freeze
. How can I fix this?
Asked
Active
Viewed 378 times
0

dosvarog
- 694
- 1
- 6
- 20
-
Are you sure that the installed packages save when you upgrade your Python version? Have you done any research on this? As far as I know, Xcode should not interfere with pip. – J Muzhen Sep 14 '22 at 12:13
-
I am not sure, I don't know, because until now, nothing similar happened to me. I didn't even know that Xcode has anything to do with Python (I come from Linux, and Python is mandatory there and standalone). It makes sense that when updating from 3.8 to 3.9 packages are gone, but Xcode could at least make `/usr/bin/python3.8` or something not just run over `/usr/bin/python3` and link it to 3.9, or warn somehow that it will update Python and that I should take care of packages. It is not a problem to install them, it is a problem that I don't know which and what versions. – dosvarog Sep 14 '22 at 12:22
-
1Just for clarification: when you updated Xcode to 14.0, it automatically updated Python? – J Muzhen Sep 14 '22 at 12:32
-
I searched online, and it seems that Xcode is not supposed to tamper with Python in any way; in fact, Xcode does not have good support for Python. – J Muzhen Sep 14 '22 at 12:34
-
@JMuzhen I am 95% sure that was the case. When I updated macOS to Monterey my scripts were still working, when I updated Xcode, my scripts stopped working because of missing packages. Xcode was something like 7 GB so it took time to update and in the meanwhile I was normally coding my scripts, I am sure of that. – dosvarog Sep 14 '22 at 12:42
-
And when I checked version of Python, it was 3.9.6 and I know I was working with 3.8.2. – dosvarog Sep 14 '22 at 12:43
-
Oh that is weird... Xcode is really broken right now, and to be honest I would not recommend using Xcode for Python development at all. There are many better free IDEs than Xcode. – J Muzhen Sep 14 '22 at 13:10
-
Also, I recommend using Homebrew to update Python as it generally handles the update process better. – J Muzhen Sep 14 '22 at 13:11
-
I am using Xcode for other development, for Python I use VS Code with all good stuff. I ditched Homebrew's Python because of some problems with it (it didn't work well with Rosetta and some other things), and generally it is easier when everybody has same version (one that comes with OS) and works with it. Well, I guess I will have to reinstall them as need arises. – dosvarog Sep 14 '22 at 13:32
2 Answers
1
To answer my own question. For some reason update of Xcode decides to update Python also. So beware when you are updating it, you packages are still there, but for older version which will become unavailable.

dosvarog
- 694
- 1
- 6
- 20
0
In my case, after update Xcode my project on Python do not connecting to mysql database with error MySQLdb.OperationalError: (2002, "Can't connect to server on 'xxx.xxx.xxx.xxx' (60)"). In this time Dbeaver still connecting and work perfect