Wikipedia:Reference desk/Archives/Computing/2021 February 13

= February 13 =

Python library lost, or not, in Big Sur
I recently updated MacOS to Big Sur. In some of my Python programs that contain the line import Image I now get ImportError: No module named Image ... but at least one program is not affected. The 'surviving' program is, while all those that fail are  ; perhaps this is coincidence, perhaps not. (Each begins with .)

Any idea what's going on? —Tamfang (talk) 02:11, 13 February 2021 (UTC)


 * , what python version is used by your programs, and what python version is invoked by that path? Is there a /usr/local/bin/python3 or anywhere else on the system? Is your python interpreter installed by homebrew or is it a stock system? Elizium23 (talk) 08:35, 13 February 2021 (UTC)


 * I believe my python (2.7) is "stock", but the Image library isn't (I do not recall how I installed it). —Tamfang (talk) 16:09, 13 February 2021 (UTC)
 * /usr/bin/python3 exists but trying to run it gives xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun —Tamfang (talk) 16:09, 13 February 2021 (UTC)


 * What do you see when you issue the command ? Is it a link to another executable?  --Lambiam 11:47, 13 February 2021 (UTC)


 * link to /Library/Frameworks/Python.framework/Versions/2.7/bin/python —Tamfang (talk) 16:09, 13 February 2021 (UTC)


 * isn't a module in PyPi or builtins, so it came from somewhere else. from the naming convention, it's likely a class from a module, so maybe this is from PIL or some library that handles images? In your, make it
 * if that fails, use  instead.   might have an Image.py that's being imported instead.
 * As for your python3 path problem, I'm sure this SE answer can solve it; this has nothing to do with python probably, just your terminal. WhoAteMyButter ( 📨 │ 📝 ) 07:00, 14 February 2021 (UTC)


 * The command you suggest results in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PIL/Image.pyc. (I first ran some old code that had import PIL; when that failed I looked at dragon and copied over import Image.) — I apparently acquired PIL/Image in 2009. Will have a look at its README when time allows. —Tamfang (talk) 01:56, 17 February 2021 (UTC)