How can I support Python packages on OS X Lion?

What is the correct way to install and upgrade Python packages on OS X Mountain Lion using Apple's built-in Python?

I tried everything that I can find here and in the documentation for various packages, but all the time I meet all kinds of errors that lead to unsuccessful or interrupted installations or updates. It is noteworthy that with pip I often get errors such as

RuntimeError: maximum recursion depth exceeded in cmp

or

SError: [Errno 24] Too many open files: '/Library/Python/2.7/site-packages'

and some pip commands (like list ) just don't exist at all.

I have an uptodate pip version that works fine with some packages and contains the latest Xcode command line tools.

The only thing that seems to work - and it works all the time - is

 python setup.py install 

Is this the right way to maintain and install python packages on Lion? Is there a reason not to use this method as the main method for storing packages? Should pip work for me or not work with Apple Python?


UPDATE: I spoke too soon. I also have problems with

 python setup.py install 

Sometimes (often) I get:

error: /Library/Python/2.7/site-packages: Too many open files

When nothing starts up in the new terminal, I get about 50 when I

 lsof | grep python | wc -l 

and if I exit Dropbox, which seems to be the source of this data, and reduce the number to 0, I still get β€œToo many open files” for most package installation operations using any tool that I use, even after rebooting my system.

Why do I often get the error "too many open files"?

+6
source share
3 answers

You should be able to maintain the same as you, but you probably need to update PYTHONPATH somewhere outside of / Library, so the reason everyone else mentions this and / or using homebrew to install python.

I install python packages with pip and maintain them using:

https://github.com/nvie/pip-tools

+1
source

First of all, download and install full Python from the python website .
Then use pip (or homebrew ). Built-in python is incomplete in many ways, including mainly the ability to install new packages. I ran into similar problems when the fist got my MacBookPro and installed full python on top of the built-in solution to all my problems.

0
source

Why use the built-in Python for Apple? I think this is incomplete.

I am using Homebrew and brew install python works fine for me.

From https://github.com/mxcl/homebrew/wiki/Homebrew-and-Python :

We recommend brew install python because:

  • Comes with pip (and distribution)
  • Python (distutils) finds software (including libs) cooked, knows about the compiler and flags, even if the command line tools for Xcode are not installed.
  • No need to set PYTHONPATH for Homebrew bindings.
  • No need to work around the sudo -is-needed-for- easy_install issue
-1
source

All Articles