2

I'm trying to update the python installation on an Apple machine running Mavericks. I fear I've mangled things with homebrew.

I get the following output when I try to tab-complete python:

python            python2.5-config  python2.7         python3-config    pythonw           pythonw2.7
python-config     python2.6         python2.7-config  python3.3         pythonw2.5        pythonw3.3
python2.5         python2.6-config  python3           python3.3-config  pythonw2.6

Running where python results in the following output /usr/bin/python. Similarly, running where python3 results in /usr/local/bin/python3 and where python3.3 results in /usr/local/bin/python3.3.

I get the following output when I run each of the different python executables, respectively:

$ python
Python 2.7.5 (default, Aug 25 2013, 00:04:04)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
$ python3
Python 3.3.5 (default, Mar 17 2014, 21:17:03)
[GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.38)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
$ python3.3
Python 3.3.5 (default, Mar 17 2014, 21:17:03)
[GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.38)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>

In PyCharm, the default available interpreter paths are:

  • /System/Library/Frameworks/Python.framework/Versions/2.5/bin/python
  • /System/Library/Frameworks/Python.framework/Versions/2.6/bin/python
  • /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python
  • /usr/local/bin/pypy
  • /usr/local/bin/python3
  • /usr/local/bin/python3.3

Selecting /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python as my interpreter in PyCharm shows me that several of the packages are out of date. These out of date packages are the same that are shown when I run pip list -o:

Warning: cannot find svn location for setuptools==0.6c12dev-r88846
bdist-mpkg (Current: 0.4.4 Latest: 0.5.0)
Could not find any downloads that satisfy the requirement bonjour-py
Some externally hosted files were ignored (use --allow-external bonjour-py to allow).
matplotlib (Current: 1.1.1 Latest: 1.3.1)
numpy (Current: 1.6.2 Latest: 1.8.0)
pyOpenSSL (Current: 0.13 Latest: 0.14)
python-dateutil (Current: 1.5 Latest: 2.2)
pytz (Current: 2012d Latest: 2014.1)
scipy (Current: 0.11.0 Latest: 0.13.3)
setuptools (Current: 0.6c12dev-r88846 Latest: 3.3)
Twisted (Current: 12.2.0 Latest: 13.2.0)
xattr (Current: 0.6.4 Latest: 0.7.4)
zope.interface (Current: 3.8.0 Latest: 4.1.0)
pyobjc-core (Current: 2.3.2a0 Latest: 2.5.1)
pyobjc-framework-AddressBook (Current: 2.3.2a0 Latest: 2.5.1)
pyobjc-framework-AppleScriptKit (Current: 2.3.2a0 Latest: 2.5.1)
pyobjc-framework-AppleScriptObjC (Current: 2.3.2a0 Latest: 2.5.1)
pyobjc-framework-Automator (Current: 2.3.2a0 Latest: 2.5.1)
pyobjc-framework-CFNetwork (Current: 2.3.2a0 Latest: 2.5.1)
pyobjc-framework-Cocoa (Current: 2.3.2a0 Latest: 2.5.1)
pyobjc-framework-Collaboration (Current: 2.3.2a0 Latest: 2.5.1)
pyobjc-framework-CoreData (Current: 2.3.2a0 Latest: 2.5.1)
pyobjc-framework-CoreLocation (Current: 2.3.2a0 Latest: 2.5.1)
pyobjc-framework-CoreText (Current: 2.3.2a0 Latest: 2.5.1)
pyobjc-framework-DictionaryServices (Current: 2.3.2a0 Latest: 2.5.1)
pyobjc-framework-ExceptionHandling (Current: 2.3.2a0 Latest: 2.5.1)
pyobjc-framework-FSEvents (Current: 2.3.2a0 Latest: 2.5.1)
pyobjc-framework-InputMethodKit (Current: 2.3.2a0 Latest: 2.5.1)
pyobjc-framework-InstallerPlugins (Current: 2.3.2a0 Latest: 2.5.1)
pyobjc-framework-InstantMessage (Current: 2.3.2a0 Latest: 2.5.1)
pyobjc-framework-InterfaceBuilderKit (Current: 2.3.2a0 Latest: 2.5.1)
pyobjc-framework-LatentSemanticMapping (Current: 2.3.2a0 Latest: 2.5.1)
pyobjc-framework-LaunchServices (Current: 2.3.2a0 Latest: 2.5.1)
pyobjc-framework-Message (Current: 2.3.2a0 Latest: 2.5.1)
pyobjc-framework-OpenDirectory (Current: 2.3.2a0 Latest: 2.5.1)
pyobjc-framework-PreferencePanes (Current: 2.3.2a0 Latest: 2.5.1)
pyobjc-framework-PubSub (Current: 2.3.2a0 Latest: 2.5.1)
pyobjc-framework-QTKit (Current: 2.3.2a0 Latest: 2.5.1)
pyobjc-framework-Quartz (Current: 2.3.2a0 Latest: 2.5.1)
pyobjc-framework-ScreenSaver (Current: 2.3.2a0 Latest: 2.5.1)
pyobjc-framework-ScriptingBridge (Current: 2.3.2a0 Latest: 2.5.1)
pyobjc-framework-SearchKit (Current: 2.3.2a0 Latest: 2.5.1)
pyobjc-framework-ServiceManagement (Current: 2.3.2a0 Latest: 2.5.1)
pyobjc-framework-SyncServices (Current: 2.3.2a0 Latest: 2.5.1)
pyobjc-framework-SystemConfiguration (Current: 2.3.2a0 Latest: 2.5.1)
pyobjc-framework-WebKit (Current: 2.3.2a0 Latest: 2.5.1)
pyobjc-framework-XgridFoundation (Current: 2.3.2a0 Latest: 2.5.1)

Trying to update numpy through PyCharm results in the following error:

Upgrade packages failed.


The following command was executed:

/Applications/PyCharm CE.app/helpers/packaging_tool.py install --build-dir /private/var/folders/7r/9rtxb7c94bv_k4szp8lnkpmm0000gn/T/pycharm-packaging258144586042338380.tmp -U numpy

The error output of the command:

Storing debug log for failure in /Users/myusername/Library/Logs/pip.log (1)

Examining the log file it seems that this is what caused the failure

clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
failure.

I get the same error as above when I run sudo pip install -U numpy

Based on this information I (hopefully correctly) concluded that I'm trying to update the Apple provided python and that MacPorts might be better suited to solving this task. I installed MacPorts and ran port upgrade outdated which resulted in Nothing to upgrade.

How can I update from 2.7.5 to 2.7.6 and update the associated packages?

Paymahn Moghadasian
  • 9,301
  • 13
  • 56
  • 94

1 Answers1

2

The issue is that mavericks seems to have broke building python extensions. The python on mavericks is built with an older compiler with older options. Those options are stored for later use in

/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/_sysconfigdata.py

You can edit this file manually to remove the bad compiler option, or you can have sed do it for you:

sed -i 's/-mno-fused-madd//' /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/_sysconfigdata.py

I've only tested and used this on the system Python 2.7. I do not know if the same will work on your /usr/local python versions. It might be easier to use homebrew or other to rebuild those python instances with the latest compiler options.

UPDATE: you might also prefer to use gcc instead of clang. see: https://stackoverflow.com/a/20295014/16998

Community
  • 1
  • 1
jrwren
  • 17,465
  • 8
  • 35
  • 56
  • you should have at least gotten a different error. If you didn't get a different error, then your removal of -mno-fused-madd didnt work. You must have edited the wrong file or are running the wrong python. – jrwren Mar 20 '14 at 14:30
  • I ended up reinstalling Mavericks. I know that doesn't help others who might be having this problem but now everything works. I think the problem was that the OSX provided python isn't meant to up updated manually (which is what I was trying to do). – Paymahn Moghadasian Mar 20 '14 at 19:26