installing numpy

G

Gary Wessle

Hi

I am trying to install NumPy in my debian/testing linux
2.6.15-1-686.

with no numpy for debian/testing, I am left alone, since the
experimental version available by debian will result in a dependency
nightmares,

so after unpacking the downloaded file "numpy-0.9.6.tar.gz"
which crated a directory in my home directory called numpy-0.9.6 with

****************************************************************
-rw-r--r-- 1 fred fred 1537 2006-01-21 19:12 LICENSE.txt
-rw-r--r-- 1 fred fred 246 2006-01-22 12:44 MANIFEST.in
drwxr-xr-x 11 fred fred 4096 2006-05-08 20:06 numpy
-rw-r--r-- 1 fred fred 1472 2006-03-14 19:27 PKG-INFO
-rw-r--r-- 1 fred fred 476 2006-01-07 08:29 README.txt
-rw-r--r-- 1 fred fred 1164 2006-05-08 20:06 semantic.cache
-rwxr-xr-x 1 fred fred 2516 2006-03-13 18:02 setup.py
****************************************************************

****************************************************************
$cat README.txt
....
To install:

python setup.py install

The setup.py script will take advantage of fast BLAS on your system if
it can find it. You can help the process with a site.cfg file.

If fast BLAS and LAPACK cannot be found, then a slower default version
is used.
....
****************************************************************

do I issue the command above "python setup.py install" from the
unpacked directory numpy-0.9.6, would it put the packages in the
correct places in my system, I was under the impression that a
numpy.py is unpacked and then I place it the sys.path but this is not
the case here.


thanks
 
C

Christoph Haas

I am trying to install NumPy in my debian/testing linux
2.6.15-1-686.

with no numpy for debian/testing, I am left alone, since the
experimental version available by debian will result in a dependency
nightmares,

What about "python-numeric"? Found through "apt-cache search numpy".

Kindly
Christoph
 
G

Gary Wessle

Christoph Haas said:
What about "python-numeric"? Found through "apt-cache search numpy".

is no longer maintained, notice my previous post titled "Numerical
Python Tutorial errors"
 
C

Christoph Haas

is no longer maintained, notice my previous post titled "Numerical
Python Tutorial errors"

Are you sure? The last update of the Debian package was slightly over a
month ago (http://packages.qa.debian.org/p/python-numeric.html).

And the description text reads:
"""
Description: Numerical (matrix-oriented) Mathematics for Python
The Numeric Extensions to Python (NumPy) ...
"""

And finally the /usr/share/doc/python-numeric/copyright.Debian reads:
"It was downloaded from http://numpy.sourceforge.net/"

Kindly
Christoph

P.S.: Your mail client seems break the references. Your reply doesn't show
up as a proper followup to my posting.
 
C

Christoph Haas

(Replying to my own posting... how I hate that...)

Are you sure? The last update of the Debian package was slightly over a
month ago (http://packages.qa.debian.org/p/python-numeric.html).

Yes, you are right. "python-numeric" refers to NumPy but contains the
"Numeric" version of it (24-2). It's pretty misleading.

I'll ask the package maintainer about the status of python-numpy in Debian
and hopefully come back with news.

Kindly
Christoph
 
R

Raymond L. Buvel

Gary said:
Hi

I am trying to install NumPy in my debian/testing linux
2.6.15-1-686.
<snip>

When installing from source on a Debian system, you want the installed
package to wind up in /usr/local/lib/python2.x/site-packages (where x
represents the version of Python you are running the installer from).
This allows you to keep it separate from the apt managed directories and
allows for easy removal/upgrade. So the command you want to execute
from root is

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

By the way, to get NymPy to use the high-performance libraries, you must
install these libraries and the associated -dev packages before running
the Python install.
 
R

Robert Kern

Christoph said:
P.S.: Your mail client seems break the references. Your reply doesn't show
up as a proper followup to my posting.

This probably has nothing to do with his mail/news client but rather the
mail-news gateway that links python-list and comp.lang.python .

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
 
R

Robert Kern

Christoph said:
Yes, you are right. "python-numeric" refers to NumPy but contains the
"Numeric" version of it (24-2). It's pretty misleading.

It's an unfortunate consequence of letting software packages acquire nicknames.
C.f.:

http://www.scipy.net/pipermail/scipy-user/2006-May/007847.html

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
 
G

Gary Wessle

Raymond L. Buvel said:
<snip>

When installing from source on a Debian system, you want the installed
package to wind up in /usr/local/lib/python2.x/site-packages (where x
represents the version of Python you are running the installer from).
This allows you to keep it separate from the apt managed directories and
allows for easy removal/upgrade. So the command you want to execute
from root is

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


sorry if this is boring since I am not a seasoned Linux user.

setup.py isn't located at the root, do you mean, execute the command above
from root, as to do this
:~$ cd /
:/$ python setup.py install --prefix=/usr/local
or
:/$ python home/fred/numpy-0.9.6/setup.py install --pref...
or AS root
:/# python setup.py install --prefix=/usr/local
or
:/# python home/fred/numpy-0.9.6/setup.py install --pref...

By the way, to get NymPy to use the high-performance libraries, you must
install these libraries and the associated -dev packages before running
the Python install.

I wish to know the debian names for those packages, my first guess
would be refblas3 under testing since blas is not available for
debian/testing, there is also
refblas3-dev Basic Linear Algebra Subroutines 3, static library
which I don't have installed.

would refblas3 be all what NymPy need to the high-performance?

thanks
 
R

Robert Kern

Gary said:
sorry if this is boring since I am not a seasoned Linux user.

setup.py isn't located at the root, do you mean, execute the command above
from root, as to do this
:~$ cd /
:/$ python setup.py install --prefix=/usr/local
or
:/$ python home/fred/numpy-0.9.6/setup.py install --pref...
or AS root
:/# python setup.py install --prefix=/usr/local
or
:/# python home/fred/numpy-0.9.6/setup.py install --pref...

I think he meant "as the root user". You will probably want to build numpy as a
regular user and then only install as the root user. You will probably want to
use sudo(1) to gain root privileges. You can read the sudo man-page for more
information on how to do that.

~$ cd numpy-0.9.6
~/numpy-0.9.6$ python setup.py build
~/numpy-0.9.6$ sudo python setup.py install --prefix=/usr/local

However, instead of setting --prefix every time you execute setup.py for every
Python package, it will be easier for you to create the file ~/.pydistutils.cfg
with the contents

[install]
prefix=/usr/local

See http://docs.python.org/inst/config-syntax.html for more information.

Then, you can just do

~$ cd numpy-0.9.6
~/numpy-0.9.6$ python setup.py build
~/numpy-0.9.6$ sudo python setup.py install
I wish to know the debian names for those packages, my first guess
would be refblas3 under testing since blas is not available for
debian/testing, there is also
refblas3-dev Basic Linear Algebra Subroutines 3, static library
which I don't have installed.

would refblas3 be all what NymPy need to the high-performance?

No. refblas3 provides the reference (unoptimized) implementation of the BLAS. In
Ubuntu (a Debian-based distribution) the package that you would want is
atlas3-base-dev. It should have a similar name in your version of Debian
(possibly atlas-dev or atlas3-dev or some other variant).

If you need more help, you will probably get more focused help on the
numpy-discussion mailing list.

http://lists.sourceforge.net/lists/listinfo/numpy-discussion

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
 
R

Raymond L. Buvel

Robert said:
Gary said:
sorry if this is boring since I am not a seasoned Linux user.

setup.py isn't located at the root, do you mean, execute the command above
from root, as to do this
:~$ cd /
:/$ python setup.py install --prefix=/usr/local
or
:/$ python home/fred/numpy-0.9.6/setup.py install --pref...
or AS root
:/# python setup.py install --prefix=/usr/local
or
:/# python home/fred/numpy-0.9.6/setup.py install --pref...


I think he meant "as the root user". You will probably want to build numpy as a
regular user and then only install as the root user. You will probably want to
use sudo(1) to gain root privileges. You can read the sudo man-page for more
information on how to do that.

~$ cd numpy-0.9.6
~/numpy-0.9.6$ python setup.py build
~/numpy-0.9.6$ sudo python setup.py install --prefix=/usr/local

However, instead of setting --prefix every time you execute setup.py for every
Python package, it will be easier for you to create the file ~/.pydistutils.cfg
with the contents

[install]
prefix=/usr/local

See http://docs.python.org/inst/config-syntax.html for more information.

Then, you can just do

~$ cd numpy-0.9.6
~/numpy-0.9.6$ python setup.py build
~/numpy-0.9.6$ sudo python setup.py install

I wish to know the debian names for those packages, my first guess
would be refblas3 under testing since blas is not available for
debian/testing, there is also
refblas3-dev Basic Linear Algebra Subroutines 3, static library
which I don't have installed.

would refblas3 be all what NymPy need to the high-performance?


No. refblas3 provides the reference (unoptimized) implementation of the BLAS. In
Ubuntu (a Debian-based distribution) the package that you would want is
atlas3-base-dev. It should have a similar name in your version of Debian
(possibly atlas-dev or atlas3-dev or some other variant).

If you need more help, you will probably get more focused help on the
numpy-discussion mailing list.

http://lists.sourceforge.net/lists/listinfo/numpy-discussion

Since you are a new Linux user, you should definitely follow Robert's
advice about building as an ordinary user separately from the install.
I sometimes take a shortcut and just do the install as user root.
However, I then wind up cleaning out the build directory as user root
(not a very safe thing to do).

The Debian/testing package you want to install is indeed
atlas3-base-dev. This package contains the header files needed to build
against the optimized blas library. Note that the dependancies listed
in this package will cause the library package to be installed as well.

There are packages that are optimized for the extended instruction sets
available on some processors. If you want to try and install one of
these instead of atlas3-base, just search the package list for anything
with atlas3 in the name. Then carefully read the package descriptions
to find one that is optimized for your hardware. Make sure you install
the -dev package or you will wind up using the unoptimized default in NumPy.
 
R

Robert Kern

Raymond said:
Since you are a new Linux user, you should definitely follow Robert's
advice about building as an ordinary user separately from the install.
I sometimes take a shortcut and just do the install as user root.
However, I then wind up cleaning out the build directory as user root
(not a very safe thing to do).

For small, pure Python packages, that may be fine. numpy's build is complicated
enough that you really, *really* want to build as a regular user.

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
 
G

Gary Wessle

Robert Kern said:
For small, pure Python packages, that may be fine. numpy's build is complicated
enough that you really, *really* want to build as a regular user.

I have read as much as I can form the python installation manual.
as a regular user, I created a personal configuration file here

****************
:~$ cat .pydistutils.cfg
[install]
prefix=/usr/local
****************

now to build as a regular user, I am getting some errors

****************************************************************
$ cd numpy-0.9.6
$ python setup.py build
Running from numpy source directory.
Warning: not existing path in numpy/distutils: site.cfg
F2PY Version 2_2236
Traceback (most recent call last):
File "setup.py", line 76, in ?
setup_package()
File "setup.py", line 63, in setup_package
config.add_subpackage('numpy')
File "/home/fred/numpy-0.9.6/numpy/distutils/misc_util.py", line 592, in add_s ubpackage
config_list = self.get_subpackage(subpackage_name,subpackage_path)
File "/home/fred/numpy-0.9.6/numpy/distutils/misc_util.py", line 582, in get_s ubpackage
subpackage_path)
File "/home/fred/numpy-0.9.6/numpy/distutils/misc_util.py", line 539, in _get_ configuration_from_setup_py
config = setup_module.configuration(*args)
File "/home/fred/numpy-0.9.6/numpy/setup.py", line 10, in configuration
config.add_subpackage('core')
File "/home/fred/numpy-0.9.6/numpy/distutils/misc_util.py", line 592, in add_s ubpackage
config_list = self.get_subpackage(subpackage_name,subpackage_path)
File "/home/fred/numpy-0.9.6/numpy/distutils/misc_util.py", line 582, in get_s ubpackage
subpackage_path)
File "/home/fred/numpy-0.9.6/numpy/distutils/misc_util.py", line 539, in _get_ configuration_from_setup_py
config = setup_module.configuration(*args)
File "numpy/core/setup.py", line 11, in configuration
from numpy.distutils.system_info import get_info, default_lib_dirs
File "/home/fred/numpy-0.9.6/numpy/distutils/system_info.py", line 151, in ?
so_ext = get_config_vars('SO')[0] or ''
File "/usr/lib/python2.4/distutils/sysconfig.py", line 488, in get_config_vars
func()
File "/usr/lib/python2.4/distutils/sysconfig.py", line 358, in _init_posix
raise DistutilsPlatformError(my_msg)
distutils.errors.DistutilsPlatformError: invalid Python installation: unable to open /usr/lib/python2.4/config/Makefile (No such file or directory)
 
R

Raymond L. Buvel

Gary said:
Raymond L. Buvel wrote:



For small, pure Python packages, that may be fine. numpy's build is complicated
enough that you really, *really* want to build as a regular user.


I have read as much as I can form the python installation manual.
as a regular user, I created a personal configuration file here

****************
:~$ cat .pydistutils.cfg
[install]
prefix=/usr/local
****************

now to build as a regular user, I am getting some errors

****************************************************************
$ cd numpy-0.9.6
$ python setup.py build
Running from numpy source directory.
Warning: not existing path in numpy/distutils: site.cfg
F2PY Version 2_2236
Traceback (most recent call last):
File "setup.py", line 76, in ?
setup_package()
File "setup.py", line 63, in setup_package
config.add_subpackage('numpy')
File "/home/fred/numpy-0.9.6/numpy/distutils/misc_util.py", line 592, in add_s ubpackage
config_list = self.get_subpackage(subpackage_name,subpackage_path)
File "/home/fred/numpy-0.9.6/numpy/distutils/misc_util.py", line 582, in get_s ubpackage
subpackage_path)
File "/home/fred/numpy-0.9.6/numpy/distutils/misc_util.py", line 539, in _get_ configuration_from_setup_py
config = setup_module.configuration(*args)
File "/home/fred/numpy-0.9.6/numpy/setup.py", line 10, in configuration
config.add_subpackage('core')
File "/home/fred/numpy-0.9.6/numpy/distutils/misc_util.py", line 592, in add_s ubpackage
config_list = self.get_subpackage(subpackage_name,subpackage_path)
File "/home/fred/numpy-0.9.6/numpy/distutils/misc_util.py", line 582, in get_s ubpackage
subpackage_path)
File "/home/fred/numpy-0.9.6/numpy/distutils/misc_util.py", line 539, in _get_ configuration_from_setup_py
config = setup_module.configuration(*args)
File "numpy/core/setup.py", line 11, in configuration
from numpy.distutils.system_info import get_info, default_lib_dirs
File "/home/fred/numpy-0.9.6/numpy/distutils/system_info.py", line 151, in ?
so_ext = get_config_vars('SO')[0] or ''
File "/usr/lib/python2.4/distutils/sysconfig.py", line 488, in get_config_vars
func()
File "/usr/lib/python2.4/distutils/sysconfig.py", line 358, in _init_posix
raise DistutilsPlatformError(my_msg)
distutils.errors.DistutilsPlatformError: invalid Python installation: unable to open /usr/lib/python2.4/config/Makefile (No such file or directory)

I think this is another example where you don't have the -dev package
you need installed on your system. In order to build just about
anything that requires header files on a Debian system, you need to
install the -dev packages. Debian usually packages things into a
package for regular users and another package of the same name with a
-dev suffix for developers. In this case, it looks like distutils is
complaining about a missing Makefile. But this is just the start of the
problems. Checking on my system, it looks like you need to install the
python2.4-dev package. Note that installing python-dev won't work in
your case since that is for the default Python which is still Python2.3
in Debian testing.

Using NumPy as your first introduction to building Python extension
modules is a real challenge.

Good luck!
Ray Buvel
 
G

Gary Wessle

thanks
I followed your suggestions, it built the package ok, while it was
building, I noticed lots of lines going by the screen in groups of
different colors, white, yellow, red.
the red got my attention:

****************
Could not locate executable gfortran
Could not locate executable f95
****************

is there a way to find out if the built is fine and it is using the
high performance libraries?

thanks
 
R

Robert Kern

Gary said:
thanks
I followed your suggestions, it built the package ok, while it was
building, I noticed lots of lines going by the screen in groups of
different colors, white, yellow, red.
the red got my attention:

****************
Could not locate executable gfortran
Could not locate executable f95
****************

Don't worry about those. numpy does not require a Fortran compiler to build.
Some projects using numpy.distutils, like scipy, will. The information flow in
distutils is not ideal, so the checks are done regardless of whether you need
Fortran or not.
is there a way to find out if the built is fine and it is using the
high performance libraries?

You can use the ldd(1) program on the extension modules (they're the ones with
the .so extension) to see what libraries they link against.

To run all of the unit tests:

[~]$ python
Python 2.4.1 (#2, Mar 31 2005, 00:05:10)
[GCC 3.3 20030304 (Apple Computer, Inc. build 1666)] on darwin
Type "help", "copyright", "credits" or "license" for more information. Found 5 tests for numpy.distutils.misc_util
Found 3 tests for numpy.lib.getlimits
Found 30 tests for numpy.core.numerictypes
Found 13 tests for numpy.core.umath
Found 8 tests for numpy.lib.arraysetops
Found 42 tests for numpy.lib.type_check
Found 93 tests for numpy.core.multiarray
Found 3 tests for numpy.dft.helper
Found 36 tests for numpy.core.ma
Found 9 tests for numpy.lib.twodim_base
Found 2 tests for numpy.core.oldnumeric
Found 8 tests for numpy.core.defmatrix
Found 1 tests for numpy.lib.ufunclike
Found 34 tests for numpy.lib.function_base
Found 1 tests for numpy.lib.polynomial
Found 6 tests for numpy.core.records
Found 19 tests for numpy.core.numeric
Found 4 tests for numpy.lib.index_tricks
Found 46 tests for numpy.lib.shape_base
Found 0 tests for __main__
............................................................................................................................................................................................................................................................................................................................................................................
----------------------------------------------------------------------
Ran 363 tests in 2.812s

OK

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
 
Joined
Oct 22, 2010
Messages
1
Reaction score
0
I'm going to piggy-back on this thread.
I have Centos 5.4 (I actually need to use that OS), and it comes with python 2.4.3 installed. I was also able to install numpy and matplotlib using yum. However, a simple program using matplotlib fails to run, complaining that numpy.ma cannot be imported.

Well, the same program worked fine on Windows with python 2.6 and recent numpy and matplotlib, so I decided to try to install python 2.6.

Centos 5.4 actually has "python 2.6" as an installable in yum, but it does NOT take the place of the default python 2.4.3 (which apparently is required for yum itself!). So I have "python" (2.4.3) and "python26".

python26 does not have numpy installed and I can't figure out how to get yum to install to /usr/lib/python2.6/site-packages. Therefore I downloaded a recent numpy and hoped to simply install it. I see that there is a --prefix option, but that will not install to "python26", will it?

The notion of actually having to build it is just a nightmare to me. Makes we want to return to the truly write-once world of Java.

Any clues to how I can install numpy and matplotlib to python26? Many thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,190
Members
46,736
Latest member
zacharyharris

Latest Threads

Top