1

I have upgraded from Mountain Lion to Mavericks ande also updated Macports and its outdated packages. I have installed numpy 1.7, but the problem is the one used by python is still numpy 1.6. The following are some information about my system.

>> python -c 'import numpy; print numpy.__version__' gives

1.6.2

which shows the active numpy version is 1.6.2

>> port installed | grep numpy gives

py27-numpy @1.7.1_0 (active)

which shows the active numpy version is 1.7.1_0

>> port installed | grep python gives

gnome-doc-utils @0.20.10_0+python27 (active)
gtk-doc @1.18_0+python27 (active)
ipython_select @0.3_1 (active)
opencv @2.4.6.1_2+python27 (active)
py27-ipython @0.13.2_0+notebook+parallel+scientific
py27-ipython @1.1.0_0+scientific
py27-ipython @1.1.0_0+notebook+parallel+scientific (active)
py27-wxpython-3.0 @2.9.5.0_0 (active)
py27-wxpython-devel @2.9.4.0_0
python24 @2.4.6_10 (active)
python27 @2.7.5_0
python27 @2.7.5_1 (active)
python_select @0.3_2
python_select @0.3_3 (active)
swig-python @2.0.9_0
swig-python @2.0.10_0 (active)
xorg-libxcb @1.9.1_0+python27 (active)
xorg-xcb-proto @1.8_0+python27 (active)

which shows, the active python version is python27.

Also, port select python gives

Available versions for python:
    none
    python24
    python25-apple
    python26-apple
    python27
    python27-apple (active)
9
  • 1
    And what is numpy.__file__? You're probably picking up the system one. Does which python tells you it's in /opt/local? Commented Oct 31, 2013 at 12:42
  • On the command line, run which python or ls -l $(which python) to check for links. Also, please type port select python, to see which python port is telling the system to use. Commented Oct 31, 2013 at 13:22
  • 1
    @void: what is wrong with macports? I am using it because it is suggested as similar tool as apt in Ubuntu. Actually, I start to use Mac only a few months ago. Commented Oct 31, 2013 at 13:30
  • @skyuuka Nothing, but a lot of users prefer homebrew. Commented Oct 31, 2013 at 13:32
  • @Evert:numpy.__file__=/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/__init__.pyc and which python gives /opt/local/bin/python Commented Oct 31, 2013 at 13:34

1 Answer 1

1

You're using the apple-installed version of python, you can see this by the fact that

port select python

gives you

python27-apple (active)

Remedy this with:

sudo port select python python27

If this:

import sys
print sys.path

still shows that python is looking in /System/Library instead of (or before) /opt/local/Library for packages, then the apple versions of packages might be imported. To solve this, you might be able to fix it by using a .pth file with site to modify your sys.path.

Sign up to request clarification or add additional context in comments.

4 Comments

Thanks, but it does not solve the problem. I tried to switch the python version, it never works.
Can you switch to python27 (not -apple) and then run python, and import sys; print sys.path and see if it's looking in /opt/local/Library or /System/Library? IT could be related to trac.macports.org/ticket/34763
Sure, I am using the one without -apple, but sys.path is looking into both opt/local/Library and /System/Library.
So that's the problem, the old numpy is in /System/Library and due to that bug, that path must come first before the /opt/local/Library. You might be able to fix it by using site to modify your sys.path.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.