Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Fixing Python install on the Mac after running 'CleanMyMac'

299 views
Skip to first unread message

Laura Creighton

unread,
May 28, 2015, 11:47:52 PM5/28/15
to pytho...@python.org, l...@openend.se
webm...@python.org just got some mail from some poor embarrased
soul who ran this program and broke their Python install.

They are running Mac OSX 10.7.5

They are getting:

Utility has encountered a fatal error, and will now terminate. A
Python runtime could not be located. You may need to install a
framework build of Python or edit the PyRuntimeLocations array in this
applications info.plist file. Then there are two oblong circles. One
says Open Console. The other says Terminate.

So https://docs.python.org/2/using/mac.html says:

The Apple-provided build of Python is installed in
/System/Library/Frameworks/Python.framework and /usr/bin/python,
respectively. You should never modify or delete these, as they are
Apple-controlled and are used by Apple- or third-party software.

So, I assume this poor soul has done precisely that.

What do I tell her to do now?

Laura


Ned Deily

unread,
May 29, 2015, 2:08:41 AM5/29/15
to pytho...@python.org
In article <201505290347....@fido.openend.se>,
It would be helpful to know what utility it is that is encountering the
fatal error; that message is not familiar and I suspect it is coming
from trying to run some third-party application. It may be that the
application was depending on a third-party framework installation of
Python (in /Library/Frameworks rather than the system Python in
/System/Library/Frameworks), such as provided by the python.org OS X
installers, but without knowing more information, like what particular
version of Python is needed, it would only be speculation. Perhaps the
best thing to do is to suggest the OP to participate directly here or an
Apple users' forum like http://apple.stackexchange.com.

--
Ned Deily,
n...@acm.org

Cem Karan

unread,
May 29, 2015, 9:13:04 AM5/29/15
to Laura Creighton, pytho...@python.org

On May 28, 2015, at 11:47 PM, Laura Creighton <l...@openend.se> wrote:

> webm...@python.org just got some mail from some poor embarrased
> soul who ran this program and broke their Python install.
>
> They are running Mac OSX 10.7.5
>
> They are getting:
>
> Utility has encountered a fatal error, and will now terminate. A
> Python runtime could not be located. You may need to install a
> framework build of Python or edit the PyRuntimeLocations array in this
> applications info.plist file. Then there are two oblong circles. One
> says Open Console. The other says Terminate.
>
> So https://docs.python.org/2/using/mac.html says:
>
> The Apple-provided build of Python is installed in
> /System/Library/Frameworks/Python.framework and /usr/bin/python,
> respectively. You should never modify or delete these, as they are
> Apple-controlled and are used by Apple- or third-party software.
>
> So, I assume this poor soul has done precisely that.
>
> What do I tell her to do now?

Does she have a recent Time Machine backup that she can restore from? Otherwise the solutions are all fairly painful:

1) Install Python 2.7 from scratch (easy). Then figure out where to put symlinks that point back to the install (mildly annoying/hard). Note that Python 3 won't work; none of the built-in scripts expect it.

2) OS X recovery - http://www.macworld.co.uk/how-to/mac/how-reinstall-mac-os-x-using-internet-recovery-3593641/ I've never had to do that, so I have no idea how easy/reliable it is. I **think** its supposed to save all the data on the drive, but again, I've not done this, so I can't make any guarantees.

3) Wipe it clean and reinstall from scratch.

Honestly, I hope she has a time machine backup. I've had to do recoveries a couple of times, and it can really save you.

Good luck,
Cem Karan

William Ray Wing

unread,
May 29, 2015, 10:55:55 AM5/29/15
to Cem Karan, William R. Wing, Laura Creighton, pytho...@python.org

> On May 29, 2015, at 9:12 AM, Cem Karan <cfka...@gmail.com> wrote:
>
>
> On May 28, 2015, at 11:47 PM, Laura Creighton <l...@openend.se> wrote:
>
>> webm...@python.org just got some mail from some poor embarrased
>> soul who ran this program and broke their Python install.
>>
>> They are running Mac OSX 10.7.5
>>
>> They are getting:
>>
>> Utility has encountered a fatal error, and will now terminate. A
>> Python runtime could not be located. You may need to install a
>> framework build of Python or edit the PyRuntimeLocations array in this
>> applications info.plist file. Then there are two oblong circles. One
>> says Open Console. The other says Terminate.
>>
>> So https://docs.python.org/2/using/mac.html says:
>>
>> The Apple-provided build of Python is installed in
>> /System/Library/Frameworks/Python.framework and /usr/bin/python,
>> respectively. You should never modify or delete these, as they are
>> Apple-controlled and are used by Apple- or third-party software.
>>
>> So, I assume this poor soul has done precisely that.
>>
>> What do I tell her to do now?

As a minor addendum - you can point out that “Clean My Mac” is a well-known piece of crap-ware that is so badly written as to be labeled by most people as malware. Best possible solution would be a clean boot and restore from a recent clone (either CarbonCopy Cloner or SuperDuper) followed by a restore of intervening files from Time Machine. Failing that, Cem’s suggestions are good.

-Bill

>
> Does she have a recent Time Machine backup that she can restore from? Otherwise the solutions are all fairly painful:
>
> 1) Install Python 2.7 from scratch (easy). Then figure out where to put symlinks that point back to the install (mildly annoying/hard). Note that Python 3 won't work; none of the built-in scripts expect it.
>
> 2) OS X recovery - http://www.macworld.co.uk/how-to/mac/how-reinstall-mac-os-x-using-internet-recovery-3593641/ I've never had to do that, so I have no idea how easy/reliable it is. I **think** its supposed to save all the data on the drive, but again, I've not done this, so I can't make any guarantees.
>
> 3) Wipe it clean and reinstall from scratch.
>
> Honestly, I hope she has a time machine backup. I've had to do recoveries a couple of times, and it can really save you.
>
> Good luck,
> Cem Karan
> --
> https://mail.python.org/mailman/listinfo/python-list

Ned Deily

unread,
May 29, 2015, 12:12:01 PM5/29/15
to pytho...@python.org
In article <201505290959....@fido.openend.se>,
Laura Creighton <l...@openend.se> wrote:
> I asked her to come here, but I fear she is feeling a tad too
> embarassed to do that right now. I don't know how to find out
> the name of the Utility -- the Error message really does say
> 'Utility' -- with no name for it. Apparantly there is some log
> file you can go take a look at to find out, but I don't know
> what it is ...

Well, she could just download a current Python 2.7.x for OS X from
python.org, install it, and see if that solves the problem. That would
be likely the easiest thing to do and is unlikely to make matters worse.
If that doesn't work, restoring files from a backup would be in order,
again most likely /Library/Frameworks/Python.framework/*. As others
have noted, running third-party apps like CleanMyMac is probably not a
good idea, but, even if it is as crappy as its sounds, I would think it
unlikely that it would be fooling with the Apple-supplied system Python
in /System/Library/Frameworks. If it did though, then the safest
approach is to do a full Time Machine or other backup and restore the
base system from the recovery partition and use the Migration Assistant
to restore user files and settings from the backup. But that's a very
long and somewhat risky process so should only be done as a last resort.

https://support.apple.com/en-us/HT201314

--
Ned Deily,
n...@acm.org

Skip Montanaro

unread,
May 29, 2015, 12:45:00 PM5/29/15
to Ned Deily, Python

On Fri, May 29, 2015 at 11:11 AM, Ned Deily <n...@acm.org> wrote:
Well, she could just download a current Python 2.7.x for OS X from
python.org, install it, and see if that solves the problem.  That would
be likely the easiest thing to do and is unlikely to make matters worse.

Might that appear to work at first, but leave some subtle issues which are not at first apparent? I don't know how intertwined Apple's Python instance is in the day-to-day operation of the operating system (it certainly seems to be on some Linux distros), but it's possible that some Apple-specific package isn't available at part of the stock Python 2.7 distribution.

Skip

Ned Deily

unread,
May 29, 2015, 1:29:02 PM5/29/15
to pytho...@python.org
In article
<CANc-5Uy3Shm870E7G0tM2S64aX8MC_6jqzdZ0T3=KaRNi...@mail.gmail.com>,
Installing a python.org Python (/usr/local/bin/python*) is independent
of and does not interfere with use of the Apple-supplied system Pythons
(/usr/bin/python*). Apple does ship various third-party Python packages
("distributions") with its system Python, like numpy, but they tend to
be old and outdated versions and there are a few Apple-only packages.
But, should that issue arise, that can be resolved by choosing the right
path (/usr/local/bin vs /usr/bin) or removing /usr/local/bin from $PATH.

The thing is the original message in this thread had this:
> They are getting:
> Utility has encountered a fatal error, and will now terminate. A
> Python runtime could not be located. You may need to install a
> framework build of Python or edit the PyRuntimeLocations array in this
> applications info.plist file. Then there are two oblong circles. One
> says Open Console. The other says Terminate.

But ... I just did what I should have done earlier: googled for that
message. And I find that the message is coming from a py2app-built
application (and it seems I answered the question 3 years ago!):

http://stackoverflow.com/questions/10184974/py2app-is-not-copying-the-pyt
hon-framework-to-the-new-app-while-using-virutalenv

The py2app glue code could be looking for Pythons in various spots
including the system Python. So, let's make sure the system Python is
still working. On the most up-to-date 10.7 Lion system (10.7.5), typing
the following two commands should give results the same as those shown
(->):

/usr/bin/python2.7 -c 'import sys;print(sys.version)'
-> 2.7.1 (r271:86832, Jul 31 2011, 19:30:53)
-> [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)]

/usr/bin/python2.7 -c 'import numpy;print(numpy.__file__)'
->
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/pytho
n/numpy/__init__.py

If not, then it really may be necessary to restore system files which,
as I noted before, is most safely and accurately done by following
Apple's directions to restore the system from the recovery partition and
a good backup of user files.

--
Ned Deily,
n...@acm.org

MrJean1

unread,
May 29, 2015, 1:50:53 PM5/29/15
to
FWIW, I recently upgraded an older MacBook to Mac OS X 10.7.5 and there are 3 different versions of Python in /System/Library/Frameworks/Python.framework, see:

$ ls /System/Library/Frameworks/Python.framework/Versions/
2.5 2.6 2.7 Current


It is unclear whether MacOS X 10.7.5 installed all four of these Python versions. The older one(s) may be left over from the previous MacOS X release on the machine. But all are Apple builds of the Python version, for example:

$ python2.7
Python 2.7.1 (r271:86832, Jul 31 2011, 19:30:53)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> ^D


In addition, there is a link in /usr/bin to the python2.X, pythonw2.X and python2.X-config file for each version, see

$ ls -la /usr/bin/python*
-rwxr-xr-x 2 root wheel 62752 May 21 19:06 /usr/bin/python
-rwxr-xr-x 6 root wheel 925 May 21 19:06 /usr/bin/python-config
lrwxr-xr-x 1 root wheel 75 May 21 19:06 /usr/bin/python2.5 -> ../../System/Library/Frameworks/Python.framework/Versions/2.5/bin/python2.5
lrwxr-xr-x 1 root wheel 82 May 21 19:06 /usr/bin/python2.5-config -> ../../System/Library/Frameworks/Python.framework/Versions/2.5/bin/python2.5-config
lrwxr-xr-x 1 root wheel 75 May 21 19:06 /usr/bin/python2.6 -> ../../System/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6
lrwxr-xr-x 1 root wheel 82 May 21 19:06 /usr/bin/python2.6-config -> ../../System/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6-config
lrwxr-xr-x 1 root wheel 75 May 21 19:06 /usr/bin/python2.7 -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
lrwxr-xr-x 1 root wheel 82 May 21 19:06 /usr/bin/python2.7-config -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7-config
-rwxr-xr-x 2 root wheel 62752 May 21 19:06 /usr/bin/pythonw
lrwxr-xr-x 1 root wheel 76 May 21 19:06 /usr/bin/pythonw2.5 -> ../../System/Library/Frameworks/Python.framework/Versions/2.5/bin/pythonw2.5
lrwxr-xr-x 1 root wheel 76 May 21 19:06 /usr/bin/pythonw2.6 -> ../../System/Library/Frameworks/Python.framework/Versions/2.6/bin/pythonw2.6
lrwxr-xr-x 1 root wheel 76 May 21 19:06 /usr/bin/pythonw2.7 -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/pythonw2.7


Perhaps you can reinstall these Pythons from the CD which came with the Mac. Let me know if you need more info.

/Jean

Ned Deily

unread,
May 29, 2015, 2:01:05 PM5/29/15
to pytho...@python.org
In article <bffd4736-f9ff-492e...@googlegroups.com>,
MrJean1 <MrJ...@gmail.com> wrote:
> FWIW, I recently upgraded an older MacBook to Mac OS X 10.7.5 and there are 3
> different versions of Python in /System/Library/Frameworks/Python.framework,
> see:
>
> $ ls /System/Library/Frameworks/Python.framework/Versions/
> 2.5 2.6 2.7 Current
> >
> It is unclear whether MacOS X 10.7.5 installed all four of these Python
> versions. The older one(s) may be left over from the previous MacOS X
> release on the machine

For compatibility with applications linked on older OS X releases, Apple
customarily ships more than one version of Python frameworks with OS X.
There are actually three versions of the system Python frameworks there:
you should see that "Current" is actually a symbolic link to "2.7". All
of those versions are shipped as part of OS X 10.7.

--
Ned Deily,
n...@acm.org

MrJean1

unread,
May 29, 2015, 2:32:57 PM5/29/15
to
Correct, the "Current" version is just a link to "2.7". Also, the binaries '/usr/bin/python{,w}" seem to be copies of the "/System/Library/.../Versions/2.7/bin/python{,w}" files.

/Jean

rand...@fastmail.us

unread,
May 29, 2015, 3:44:15 PM5/29/15
to pytho...@python.org
On Fri, May 29, 2015, at 12:11, Ned Deily wrote:
> As others
> have noted, running third-party apps like CleanMyMac is probably not a
> good idea, but, even if it is as crappy as its sounds, I would think it
> unlikely that it would be fooling with the Apple-supplied system Python
> in /System/Library/Frameworks.

It sounds very likely to me. These "cleaner" apps are often designed to
remove "unnecessary" system components where the author doesn't know
what they are and doesn't think anyone needs them because his system
runs fine without it, along with the mistaken belief that these take up
a lot of space or that their existence slows down performance.

Looking at the version history of this page:
https://software.com/mac/utilities/cleanmymac/1.10.0

It looks like python is removed or otherwise messed-with by a module
called "System Junk" (earlier "Development Junk").

Version 1.9.4 _claims_ that it fixed: ""Sytem Junk" module reliability
improved and fixed issues with python applications." - but this is
basically an admission that it was messing with the sort of thing that
could cause these issues in the first place.
0 new messages