[Numpy-discussion] Installing numpy on py 3.1.2 , osx

Zachary Pincus zachary.pincus@yale....
Tue Jun 8 11:06:18 CDT 2010


> On Tue, Jun 8, 2010 at 7:58 AM, Zachary Pincus <zachary.pincus@yale.edu 
> > wrote:
>> This is unexpected, from the error log:
>>> /Library/Frameworks/Python.framework/Versions/3.1/include/python3.1/
>>> Python.h:11:20: error: limits.h: No such file or directory
>>
>> No good... it can't find basic system headers. Perhaps it's due to  
>> the
>> MACOSX_DEPLOYMENT_TARGET environment variable that was warned about
>> earlier? (I think I'd seen that sort of thing before... regardless of
>> whether you have the 10.4 SDK, if MACOSX_DEPLOYMENT_TARGET is 10.3 I
>> think it doesn't get used? Not sure.) Try setting
>> MACOSX_DEPLOYMENT_TARGET to 10.4:
>> MACOSX_DEPLOYMENT_TARGET=10.4
>> export MACOSX_DEPLOYMENT_TARGET
>> (if you're using bash, the default OS X shell; for tcsh use "setenv
>> MACOSX_DEPLOYMENT_TARGET 10.4")
>>
> Before I make any changes I wanted to make sure I kinda know what I am
> doing and how :)
> I have several versions of python installed. The python 3.1.2 is clean
> except for nose being installed. to access python 3 on my system I
> have a terminal alias to py 3.1.2 as python3

Basic summary of environment variables:
http://en.wikipedia.org/wiki/Environment_variable

In a unix shell, setting an environment variable will apply to the  
processes that are started from within that shell session. To  
permanently set environment variables, you'd need to add the relevant  
commands to the bash .profile or other startup files (a topic in and  
of itself). So the good news is that nothing you do will w/r/t  
environment vars will persist past exiting that particular shell.

Anyhow, from the below, you don't have MACOSX_DEPLOYMENT_TARGET set at  
all, which is what would be expected. I wonder if perhaps the python/ 
numpy build process is setting MACOSX_DEPLOYMENT_TARGET to 10.3 when  
there is none already set? If so this is not good.

Anyhow, given that you're using bash, here's what to do to try to build:

cd /path/to/numpy/src
MACOSX_DEPLOYMENT_TARGET=10.4
export MACOSX_DEPLOYMENT_TARGET
python3 setup.py build

and see if that fixes the issue? If so there's some bug in the numpy  
build process you've stumbled across.

Zach



>
> So when in the terminal typing env returns
> MacBookPro-new-2:numpy vmd$ env
> TERM_PROGRAM=Apple_Terminal
> TERM=xterm-color
> SHELL=/bin/bash
> TMPDIR=/var/folders/2f/2fiXYQSSE+CgAzDQPp9+k++++TI/-Tmp-/
> Apple_PubSub_Socket_Render=/tmp/launch-4g8LJN/Render
> TERM_PROGRAM_VERSION=273
> OLDPWD=/Users/vmd/DropBox/numpy
> USER=vmd
> COMMAND_MODE=unix2003
> SSH_AUTH_SOCK=/tmp/launch-fxsj0I/Listeners
> __CF_USER_TEXT_ENCODING=0x1F5:0:0
> PATH=/Library/Frameworks/EPD64.framework/Versions/Current/bin:/ 
> Library/Frameworks/EPD64.framework/Versions/Current/bin:/usr/bin:/ 
> bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin:/ 
> opt/local/bin
> MKL_NUM_THREADS=1
> PWD=/Users/vmd/DropBox/numpy/numpy
> LANG=en_US.UTF-8
> SHLVL=1
> HOME=/Users/vmd
> LOGNAME=vmd
> DISPLAY=/tmp/launch-HlM7T8/org.x:0
> _=/usr/bin/env
> MacBookPro-new-2:numpy vmd$
>
> So looking into this a bit more.
> MacBookPro-new-2:numpy vmd$ python3
> Python 3.1.2 (r312:79360M, Mar 24 2010, 01:33:18)
> [GCC 4.0.1 (Apple Inc. build 5493)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
>
>>>> import os
>>>> for x in os.environ.items(): print(x)
> ...
> ('MKL_NUM_THREADS', '1')
> ('LANG', 'en_US.UTF-8')
> ('TERM', 'xterm-color')
> ('Apple_PubSub_Socket_Render', '/tmp/launch-4g8LJN/Render')
> ('TMPDIR', '/var/folders/2f/2fiXYQSSE+CgAzDQPp9+k++++TI/-Tmp-/')
> ('SHLVL', '1')
> ('OLDPWD', '/Users/vmd/DropBox/numpy')
> ('SSH_AUTH_SOCK', '/tmp/launch-fxsj0I/Listeners')
> ('TERM_PROGRAM_VERSION', '273')
> ('__CF_USER_TEXT_ENCODING', '0x1F5:0:0')
> ('PWD', '/Users/vmd/DropBox/numpy/numpy')
> ('SHELL', '/bin/bash')
> ('LOGNAME', 'vmd')
> ('USER', 'vmd')
> ('PATH', '/Library/Frameworks/EPD64.framework/Versions/Current/bin:/ 
> Library/Frameworks/EPD64.framework/Versions/Current/bin:/usr/bin:/ 
> bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin:/ 
> opt/local/bin')
> ('HOME', '/Users/vmd')
> ('TERM_PROGRAM', 'Apple_Terminal')
> ('DISPLAY', '/tmp/launch-HlM7T8/org.x:0')
> ('_', '/usr/local/bin/python3')
> ('COMMAND_MODE', 'legacy')
>>>>
>
>
> In the end I am not sure how to set the what env belongs to, is this a
> python setting or a system setting? Does setting env as you suggest
> apply to py3.1.2 as I have it installed?
> setenv MACOSX_DEPLOYMENT_TARGET 10.4
>
> Thanks
> Vincent
>
>
>
>> If this fixes things, I suspect that the build process should  
>> probably
>> give an error about MACOSX_DEPLOYMENT_TARGET instead of a warning...
>>
>> Zach
>>
>>
>>
>> On Jun 7, 2010, at 11:49 PM, Vincent Davis wrote:
>>
>>> On Mon, Jun 7, 2010 at 7:59 PM, Vincent Davis <vincent@vincentdavis.net
>>>> wrote:
>>>> On Mon, Jun 7, 2010 at 7:26 PM, Ralf Gommers
>>>> <ralf.gommers@googlemail.com> wrote:
>>>>>
>>>>>
>>>>> On Tue, Jun 8, 2010 at 4:46 AM, Vincent Davis <vincent@vincentdavis.net
>>>>>>
>>>>> wrote:
>>>>>>
>>>>>> On Mon, Jun 7, 2010 at 2:11 PM, Skipper Seabold <jsseabold@gmail.com
>>>>>>>
>>>>>> wrote:
>>>>>>> On Mon, Jun 7, 2010 at 4:02 PM, Vincent Davis <vincent@vincentdavis.net
>>>>>>>>
>>>>>>> wrote:
>>>>>>>>   "Cannot compile 'Python.h'. Perhaps you need to "\
>>>>>>>> SystemError: Cannot compile 'Python.h'. Perhaps you need to
>>>>>>>> install
>>>>>>>> python-dev|python-devel.
>>>>>>>
>>>>>>> Not sure about this.  Might be the compiler issue, but I know on
>>>>>>> Linux
>>>>>>> you need to install the python-dev (or python-devel) package,
>>>>>>> but I
>>>>>>> don't see that as a pre-req on the Mac page.
>>>>>>
>>>>>> So it seems to be seeing the newly installed fortran, but I do
>>>>>> get an
>>>>>> error at the end.
>>>>>>  File "numpy/core/setup.py", line 260, in check_types
>>>>>>    "Cannot compile 'Python.h'. Perhaps you need to "\
>>>>>> SystemError: Cannot compile 'Python.h'. Perhaps you need to  
>>>>>> install
>>>>>> python-dev|python-devel.
>>>>>>
>>>>>> Any ideas, I looked into how python-dev|python-devel applied to
>>>>>> python
>>>>>> but could make much of what I found. I tried to build python  
>>>>>> 3.1.2
>>>>>> from source but that didn't work out. If I need to go that
>>>>>> direction I
>>>>>> guess I need to.
>>>>>>
>>>>> You are probably missing the 10.4 SDK. It's an optional install of
>>>>> XCode on
>>>>> your Snow Leopard DVD.
>>>>
>>>> True I have 10.5 and 10.6 SDK I will install the 10.4 and try  
>>>> again.
>>>> Thanks
>>>> Vincent
>>>
>>> Still no go after installing 10.4 sdk
>>> Attached terminal output.
>>>
>>>>>
>>>>> Cheers,
>>>>> Ralf
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> NumPy-Discussion mailing list
>>>>> NumPy-Discussion@scipy.org
>>>>> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>>>>>
>>>>>
>>>>
>>> <Terminal Saved
>>> Output.txt.zip>_______________________________________________
>>> NumPy-Discussion mailing list
>>> NumPy-Discussion@scipy.org
>>> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>>
>> _______________________________________________
>> NumPy-Discussion mailing list
>> NumPy-Discussion@scipy.org
>> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion



More information about the NumPy-Discussion mailing list