install from svn, pick correct of two numpy header locations

Hi all,

I'm trying to install matplotlib from svn. I have two versions of
numpy on my computer: one installed by the Ubuntu package manager in
/usr/lib and one installed from source in /usr/local/lib which takes
precedence based on the order of my PYTHONPATH. I'm trying to install
the latest matplotlib from source, also into /usr/local using

python setup.py install --prefix=/usr/local

but mpl's setup.py appears to not use np.get_include() when working
out where to look for the numpy headers, so is finding the old ones in
/usr/lib. Is this the correct behaviour, and/or am I doing something
wrong? Is there another way to specify where the headers should be
found?

Thanks,

Angus.

···

--
AJC McMorland
Post-doctoral research fellow
Neurobiology, University of Pittsburgh

Hi all,

I'm trying to install matplotlib from svn. I have two versions of
numpy on my computer: one installed by the Ubuntu package manager in
/usr/lib and one installed from source in /usr/local/lib which takes
precedence based on the order of my PYTHONPATH. I'm trying to install
the latest matplotlib from source, also into /usr/local using

python setup.py install --prefix=/usr/local

but mpl's setup.py appears to not use np.get_include() when working
out where to look for the numpy headers, so is finding the old ones in
/usr/lib. Is this the correct behaviour, and/or am I doing something
wrong? Is there another way to specify where the headers should be
found?

I can't investigate properly right now, but get_include() is getting called:

efiring@...2091...:~/programs/py/mpl/mpl_trunk$ grep get_include *.py
setupext.py: module.include_dirs.append(numpy.get_include())

You could try putting in print statements to see what version of numpy has been imported at that point, and if it is the wrong one, how that comes about. When numpy is being imported for the first time in setupext.py, is PYTHONPATH what you think it is?

Eric

···

On 07/07/2010 04:25 AM, Angus McMorland wrote:

Thanks,

Angus.

That was my first thought -- when you call setup.py install are you
running as root. If so, it may not be picking up your userland
PYTHONPATH. Try adding the python path on the install line, eg

PYTHONPATH=/usr/local/lib/python2.6/site-packages python setup.py
install --prefix=/usr/local

···

On Wed, Jul 7, 2010 at 12:12 PM, Eric Firing <efiring@...202...> wrote:

On 07/07/2010 04:25 AM, Angus McMorland wrote:

Hi all,

I'm trying to install matplotlib from svn. I have two versions of
numpy on my computer: one installed by the Ubuntu package manager in
/usr/lib and one installed from source in /usr/local/lib which takes
precedence based on the order of my PYTHONPATH. I'm trying to install
the latest matplotlib from source, also into /usr/local using

python setup.py install --prefix=/usr/local

but mpl's setup.py appears to not use np.get_include() when working
out where to look for the numpy headers, so is finding the old ones in
/usr/lib. Is this the correct behaviour, and/or am I doing something
wrong? Is there another way to specify where the headers should be
found?

I can't investigate properly right now, but get_include() is getting called:

efiring@...2091...:~/programs/py/mpl/mpl_trunk$ grep get_include *.py
setupext.py: module.include_dirs.append(numpy.get_include())

You could try putting in print statements to see what version of numpy
has been imported at that point, and if it is the wrong one, how that
comes about. When numpy is being imported for the first time in
setupext.py, is PYTHONPATH what you think it is?

Thanks guys- that was exactly the problem: sudo not carrying
PYTHONPATH through from userland. In case anyone's interested, I fixed
it by adding

Defaults env_keep+="PYTHONPATH"

to my /etc/sudoers file, so the problem should now be permanently
fixed. Sorry for the noise.

Angus.

···

On 7 July 2010 14:00, John Hunter <jdh2358@...287...> wrote:

On Wed, Jul 7, 2010 at 12:12 PM, Eric Firing <efiring@...202...> wrote:

On 07/07/2010 04:25 AM, Angus McMorland wrote:

Hi all,

I'm trying to install matplotlib from svn. I have two versions of
numpy on my computer: one installed by the Ubuntu package manager in
/usr/lib and one installed from source in /usr/local/lib which takes
precedence based on the order of my PYTHONPATH. I'm trying to install
the latest matplotlib from source, also into /usr/local using

python setup.py install --prefix=/usr/local

but mpl's setup.py appears to not use np.get_include() when working
out where to look for the numpy headers, so is finding the old ones in
/usr/lib. Is this the correct behaviour, and/or am I doing something
wrong? Is there another way to specify where the headers should be
found?

I can't investigate properly right now, but get_include() is getting called:

efiring@...2091...:~/programs/py/mpl/mpl_trunk$ grep get_include *.py
setupext.py: module.include_dirs.append(numpy.get_include())

You could try putting in print statements to see what version of numpy
has been imported at that point, and if it is the wrong one, how that
comes about. When numpy is being imported for the first time in
setupext.py, is PYTHONPATH what you think it is?

That was my first thought -- when you call setup.py install are you
running as root. If so, it may not be picking up your userland
PYTHONPATH. Try adding the python path on the install line, eg

PYTHONPATH=/usr/local/lib/python2.6/site-packages python setup.py
install --prefix=/usr/local