Installing Python with pythonbrew on Mac OS-X

Virtualenv, virtualenvwrapper and pythonbrew are fantastic tools for developing with Python.

Using Pythonbrew to install Python on OS-X triggers some failures which prevent it being installed.


The issue is discussed on Github here.

Looking at ~/.pythonbrew/Logs/build.log, we see the following errors:

3 tests failed:
    test_ctypes test_distutils test_platform
test test_platform failed -- Traceback (most recent call last):
  File "/Users/adamgriffiths/.pythonbrew/build/Python-2.7.2/Lib/test/", line 194, in test_mac_ver
    self.assertEqual(res[2], 'i386')
AssertionError: 'x86_64' != 'i386'
i686-apple-darwin11-llvm-gcc-4.2: /private/var/folders/bz/9564twzd2f95kgzvzvt1w1yr0000gn/T/tmpE9o8JJ/ No such file or directory
test test_distutils failed -- Traceback (most recent call last):
  File "/Users/adamgriffiths/.pythonbrew/build/Python-2.7.2/Lib/distutils/tests/", line 291, in test_get_outputs
  File "/Users/adamgriffiths/.pythonbrew/build/Python-2.7.2/Lib/distutils/command/", line 340, in run
  File "/Users/adamgriffiths/.pythonbrew/build/Python-2.7.2/Lib/distutils/command/", line 449, in build_extensions
  File "/Users/adamgriffiths/.pythonbrew/build/Python-2.7.2/Lib/distutils/command/", line 531, in build_extension
  File "/Users/adamgriffiths/.pythonbrew/build/Python-2.7.2/Lib/distutils/", line 741, in link_shared_object
    extra_preargs, extra_postargs, build_temp, target_lang)
  File "/Users/adamgriffiths/.pythonbrew/build/Python-2.7.2/Lib/distutils/", line 258, in link
    raise LinkError, msg
LinkError: command 'gcc' failed with exit status 1

I’ve commented about this issue here. Unfortunately, there isn’t a response from any authority on the issue.


Delving into the logs, it seems these errors (test_platform fails, etc) are just the results of bad tests.

If we take a look at ~/.pythonbrew/build/Python-2.7.2/Lib/test/ at line 194, we see the following:

if sys.byteorder == 'little':
 self.assertEqual(res[2], 'i386')
 self.assertEqual(res[2], 'PowerPC')

Doing a uname -a gives the following:

Vibur:~ adamgriffiths$ uname -a
Darwin Vibur.local 11.2.0 Darwin Kernel Version 11.2.0: Tue Aug 9 20:54:00 PDT 2011; root:xnu-1699.24.8~1/RELEASE_X86_64 x86_64

So obviously this test is not appropriate and we can ignore the error.

It looks like the other errors are similar too.

The code builds successfully, so I think its safe to ignore these.


Until these are patched out, it seems the only way to install Python with Pythonbrew is to use the –force command.

pythonbrew install 2.7.2 --force

3 Responses to “Installing Python with pythonbrew on Mac OS-X”

  1. jason Says:

    Thank you for this post.
    I had the same problem.

  2. cbrevard Says:

    One possible alternative to “–force” would be “-n” (thereby skipping ‘make test’). I used it like so: “pythonbrew install –universal –framework -n -v 2.7.2” and it worked.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: