user2015601
user2015601

Reputation:

Building NumPy on RedHat

I installed a local version of Python 2.7 in my home directory (Linux RedHat) under ~/opt using the --prefix flag. More specifically, Python was placed in ~/home/opt/bin.

Now, I want to install NumPy, but I am not really sure how I would achieve this. All I found in the INSTALL.txt and online documentation was the command to use the compiler. I tried gfortran, and it worked without any error message: python setup.py build --fcompiler=gnu95

However, I am not sure how to install it for my local version of Python. Also, I have to admit that I don't really understand how this whole approach works in general. E.g., what is the setup.py build doing? Is it creating module files that I have to move to a specific folder?

I hope anyone can give me some help here, and I would also appreciate a few lines of information how this approach works, or maybe some resources where I can read it up (I didn't find anything on the NumPy pages).

Upvotes: 0

Views: 203

Answers (1)

mgilson
mgilson

Reputation: 310227

Your local version of python should keep all of it's files somewhere in ~/opt (presumably). As long as this is the python installation that gets used when you issue the command

python setup.py build --fcompiler=gnu95

you should be all set because in the sys module, there are a bunch of constants which the setup script uses to determine where to put the modules once they are built.

So -- running python setup.py build issues all of the necessary commands to build the module (compiling the C/Fortran code into shared object libraries that python can load dynamically and copying the pure python code to create the proper directory structure). The module is actually built somewhere in the build subdirectory which gets created during the process if it doesn't already exist. Once the library has been built (successfully), installing it should be as simple as:

python setup.py install

(You might need to sudo if you don't have write privileges in the install directory).

Upvotes: 1

Related Questions