Opened 15 years ago

Closed 14 years ago

#22165 closed defect (fixed)

can't import py26-numpy without +no_atlas

Reported by: ajb78@… Owned by: MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)
Priority: Normal Milestone:
Component: ports Version: 1.8.1
Keywords: Cc: jameskyle@…, skymoo (Adam Mercer), macports@…, mf2k (Frank Schima), michaelld (Michael Dickens)
Port: py26-numpy

Description (last modified by mf2k (Frank Schima))

I am reinstalling my macports system since upgrading to snow leopard. I tried to install py26-numpy and the compilation goes fine, but then when I try to import it I get the error

Fatal Python error: Interpreter not initialized (version mismatch?)

Change History (26)

comment:1 Changed 15 years ago by mf2k (Frank Schima)

Description: modified (diff)
Port: py26-numpy added

Did you use python_select to select python26?

comment:2 Changed 15 years ago by ajb78@…

Initially I did not use python_select since I was installing a long list of ports, which included python26. When I ran into the error, first I ran python_select and tried to import numpy, then I uninstalled numpy, reran python_select, reinstalled numpy and again tried to import numpy. Both times I got the same error. Thanks!

comment:3 Changed 14 years ago by ajb78@…

I narrowed it down further:

import of numpy works when I compile it with +no_atlas (no matter what compiler I select). So I am testing now to see whether the problem was that atlas that I did not yet run python_select when I installed atlas.

comment:4 Changed 14 years ago by jmroot (Joshua Root)

Cc: jameskyle@… added
Owner: changed from macports-tickets@… to mcalhoun@…
Summary: can't import py26-numpycan't import py26-numpy without +no_atlas

comment:5 Changed 14 years ago by ajb78@…

Tested: ran python_select python26, then reinstalled both atlas and py26-numpy.

Still no luck - same error as before.

comment:6 Changed 14 years ago by skymoo (Adam Mercer)

Cc: ram@… added

Cc Me!

comment:7 in reply to:  description Changed 14 years ago by macports@…

I think this is likely to be a 64 vs 32 bit issue.

I was seaarching for tickets about ATLAS - ATLAS currently builds as 32 bit, and has no universal variant (so I was going to open a ticket for a universal variant for atlas).

I understand by default python is built 64 bit now - so I think that is why it is unable to load the 32 bit numpy that is built against 32 bit atlas. (Not sure why the numpy build doesn't fail - perhaps if you are building numpy universal the 32 bit succeeds and just the 64 bit fails).

comment:8 Changed 14 years ago by macports@…

Cc: macports@… added

Cc Me!

comment:9 Changed 14 years ago by macports@…

Ticket #21548 seems relevant - evidently 64 bit ATLAS was explicitly disabled.

comment:10 Changed 14 years ago by ajb78@…

Is the 32 bit vs 64 bit issue still relevant given that I have a 1st generation (32 bit) macbook pro?

comment:11 in reply to:  10 Changed 14 years ago by macports@…

Replying to ajb78@…:

Is the 32 bit vs 64 bit issue still relevant given that I have a 1st generation (32 bit) macbook pro?

If you are running snow leopard on an intel mac. All intel macbooks are 64 bit capable and in snow leopard this is the default.

comment:12 Changed 14 years ago by ajb78@…

I have a 2GHz yonah intel core duo processor in my machine, it is a first generation macbook pro (they came out in January 2006 and I purchased mine in February/March 2006). The first 64bit capable macbook pro was with the core 2 duo processor and that came out in July of 2006. So I am fairly certain that my machine is 32 bit. I though I also read that the default snow leopard behavior is to boot up in 32 bit mode and you have to hold down the 6 and the 4 together boot into 64 bit mode.

comment:13 in reply to:  12 ; Changed 14 years ago by macports@…

Replying to ajb78@…:

I have a 2GHz yonah intel core duo processor in my machine, it is a first generation macbook pro (they came out in January 2006 and I purchased mine in February/March 2006). The first 64bit capable macbook pro was with the core 2 duo processor and that came out in July of 2006. So I am fairly certain that my machine is 32 bit. I though I also read that the default snow leopard behavior is to boot up in 32 bit mode and you have to hold down the 6 and the 4 together boot into 64 bit mode.

I do apologise - I was under the impression that all intel chips since about 2005 supported x86_64 but it seems your right. In which case I don't know...

But although SL kernel is 32 bit the userland is moving to 64 bit (gcc and macports now build x86_64 by default).

One way you can check the status of your python build to confirm is to do:

robin-mbp:~ robince$ /opt/local/bin/python2.6 -c "import sys; print sys.maxint"
9223372036854775807

If it is as above python is 64 bit (even though I am running deault 32 bit kernel), if it is 2147483647 python is 32 bit (and as you say then that is unlikely to be your problem with atlas).

Sorry for bringing confusion if thats the case...

comment:14 in reply to:  13 Changed 14 years ago by Veence (Vincent)

Replying to macports@…:

Replying to ajb78@…:

I have a 2GHz yonah intel core duo processor in my machine, it is a first generation macbook pro (they came out in January 2006 and I purchased mine in February/March 2006). The first 64bit capable macbook pro was with the core 2 duo processor and that came out in July of 2006. So I am fairly certain that my machine is 32 bit. I though I also read that the default snow leopard behavior is to boot up in 32 bit mode and you have to hold down the 6 and the 4 together boot into 64 bit mode.

I do apologise - I was under the impression that all intel chips since about 2005 supported x86_64 but it seems your right. In which case I don't know...

Try this:

sysctl hw.cpu64bit_capable

If you get 1, your system is x86_64 capable.

comment:15 Changed 14 years ago by ajb78@…

Nope, it returns:

hw.cpu64bit_capable: 0

comment:16 Changed 14 years ago by Veence (Vincent)

Then you have a 32-bit only CPU. No surprise 64-bit code does not run.

comment:17 Changed 14 years ago by ajb78@…

I'm confused: it was stated a few posts up that atlas and, as a consequence, atlas enabled numpy is 32-bit right now. Python, on the other hand, is 64 bit by default. I can run python just fine, I cannot import numpy (which is also 32-bit only).

I guess the problem might be numpy being 32-bit only while python is universal (as also stated a few posts up). In any case, it's not a big deal since, with atlas disabled, numpy runs just fine and I will upgrade to a 64-bit machine soon.

comment:18 Changed 14 years ago by Veence (Vincent)

On my Mac I have both numpy and scipy universal!

-> port installed py26-numpy
The following ports are currently installed:
  py26-numpy @1.3.0_0+universal (active)
-> port installed py26-scipy
The following ports are currently installed:
  py26-scipy @0.7.1_0+universal (active)

comment:19 Changed 14 years ago by jameskyle@…

The universal could be the issue since atlas is not currently universal capable.

But the 64b vs. 32b should have been taking care of in this ticket and revision:

http://trac.macports.org/ticket/21433

http://trac.macports.org/changeset/57851

I'll look at this again to make sure it's doing what it should. But it checks the build_arch from macports options and builds the specified arch (in my testing).

comment:20 in reply to:  19 Changed 14 years ago by macports@…

Replying to jameskyle@…:

The universal could be the issue since atlas is not currently universal capable.

But the 64b vs. 32b should have been taking care of in this ticket and revision:

http://trac.macports.org/ticket/21433

http://trac.macports.org/changeset/57851

It builds fine with numpy for me on SL with 64 bit. I'm sorry that I introduced confusion to this ticket. I'm afraid I was using the portfile from darwinports dot com as a reference (where it's still hardcoded 32 bit), before I found out that this was not recommended/out of date.

comment:21 Changed 14 years ago by jameskyle@…

the darwinports guy is a scammer/domain squatter hehe.

I would like to clarify the 64 vs 32 bit kernel issue. Last I checked, only the most recent xserves with osx server installed actually boot to the 64 bit kernel by default. This, however, has no bearing on whether you can run 32 bit or 64 compiled programs in userland.

The sysctl command is the best way to see if your system is capable. Since yours is returning 0, it would indicate that you cannot run 64 runtimes.

You can also check in Activity Monitor. It will show a (64 bit) in parenthesis next to applications in Snow Leopard if they are 64 bit.

My atlas build checks the macports options ${build_arch} to determine whether it should build 32 or 64 bit. If it is building 64 bit, it may be an issue with macports core.

Of course, I'll continue to check variant build options and try to find a non-64bit machine in an attempt to duplicate this problem.

comment:22 Changed 14 years ago by mf2k (Frank Schima)

Cc: macsforever2000@… added

Cc Me!

comment:23 Changed 14 years ago by skymoo (Adam Mercer)

does the solution proposed in #19397 fix this issue?

comment:24 Changed 14 years ago by michaelld (Michael Dickens)

Cc: michaelld@… added

Cc Me!

comment:25 Changed 14 years ago by michaelld (Michael Dickens)

There's a potential fix for this issue on ticket #24942; please try the last diff & see if it works for you on this issue.

comment:26 Changed 14 years ago by michaelld (Michael Dickens)

Resolution: fixed
Status: newclosed

I've checked in the changes in r72220; please do:

sudo port clean py26-numpy
sudo port selfupdate
sudo port install py26-numpy [+variants]

and see if it works. I'm closing this ticket as fixed; please reopen if the changes do not work for you.

Note: See TracTickets for help on using tickets.