Fixing Python install on the Mac after running 'CleanMyMac'

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Fixing Python install on the Mac after running 'CleanMyMac'

Laura Creighton-2
webmaster at 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




Reply | Threaded
Open this post in threaded view
|

Fixing Python install on the Mac after running 'CleanMyMac'

Ned Deily
In article <201505290347.t4T3lYjC006610 at fido.openend.se>,
 Laura Creighton <lac at openend.se> wrote:

> webmaster at 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?

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,
 nad at acm.org



Reply | Threaded
Open this post in threaded view
|

Fixing Python install on the Mac after running 'CleanMyMac'

Laura Creighton-2
In a message of Thu, 28 May 2015 23:07:42 -0700, Ned Deily writes:

>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,
> nad at acm.org

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 ...

Laura



Reply | Threaded
Open this post in threaded view
|

Fixing Python install on the Mac after running 'CleanMyMac'

Cem Karan
In reply to this post by Laura Creighton-2

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

> webmaster at 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

Reply | Threaded
Open this post in threaded view
|

Fixing Python install on the Mac after running 'CleanMyMac'

William Ray Wing

> On May 29, 2015, at 9:12 AM, Cem Karan <cfkaran2 at gmail.com> wrote:
>
>
> On May 28, 2015, at 11:47 PM, Laura Creighton <lac at openend.se> wrote:
>
>> webmaster at 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



Reply | Threaded
Open this post in threaded view
|

Fixing Python install on the Mac after running 'CleanMyMac'

Ned Deily
In reply to this post by Laura Creighton-2
In article <201505290959.t4T9xpDK016524 at fido.openend.se>,
 Laura Creighton <lac at 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,
 nad at acm.org



Reply | Threaded
Open this post in threaded view
|

Fixing Python install on the Mac after running 'CleanMyMac'

Skip Montanaro
On Fri, May 29, 2015 at 11:11 AM, Ned Deily <nad at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20150529/dafbf6d4/attachment.html>

Reply | Threaded
Open this post in threaded view
|

Fixing Python install on the Mac after running 'CleanMyMac'

Ned Deily
In article
<CANc-5Uy3Shm870E7G0tM2S64aX8MC_6jqzdZ0T3=KaRNiTZQCw at mail.gmail.com>,
 Skip Montanaro <skip.montanaro at gmail.com> wrote:

> On Fri, May 29, 2015 at 11:11 AM, Ned Deily <nad at 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.

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,
 nad at acm.org



Reply | Threaded
Open this post in threaded view
|

Fixing Python install on the Mac after running 'CleanMyMac'

random832@fastmail.us
In reply to this post by Ned Deily
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.