[SciPy-User] NumPy error

nitin chandra nitinchandra1@gmail....
Thu Oct 8 14:45:44 CDT 2009


Hello Everyone , David

As per your suggested steps i did the installation procedure.

But no luck ..... there is the same error ....

Still there could be a probability that i have done some thing
unwanted during my installation...
please look at the file attached.

As i cannot past the whole lot in the message .. due to
limitations.... again .... please have a look at the attached file.

ERROR

[root@mi ~]# python
Python 2.6.2 (r262:71600, Sep 28 2009, 21:33:37)
[GCC 4.3.2 20081105 (Red Hat 4.3.2-7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/python262/lib/python2.6/site-packages/numpy/__init__.py",
line 130, in <module>
    import add_newdocs
  File "/opt/python262/lib/python2.6/site-packages/numpy/add_newdocs.py",
line 9, in <module>
    from lib import add_newdoc
  File "/opt/python262/lib/python2.6/site-packages/numpy/lib/__init__.py",
line 13, in <module>
    from polynomial import *
  File "/opt/python262/lib/python2.6/site-packages/numpy/lib/polynomial.py",
line 18, in <module>
    from numpy.linalg import eigvals, lstsq
  File "/opt/python262/lib/python2.6/site-packages/numpy/linalg/__init__.py",
line 47, in <module>
    from linalg import *
  File "/opt/python262/lib/python2.6/site-packages/numpy/linalg/linalg.py",
line 22, in <module>
    from numpy.linalg import lapack_lite
ImportError: liblapack.so: cannot open shared object file: No such
file or directory
>>>

I did NOT INSTALL XBLAS. But will need FFTW (GIS??).


Thanks

Nitin
-------------- next part --------------
start with 

# yum install tcl-devel

and

#yum install tk-devel

Then python-2.6.2

#./configure --prefix=/opt/python25 --enable-shared --with-threads --enable-ipv6 \
--with-pth --enable-unicode --with-libm=/lib/libm-2.9.so --with-libc=/lib/libc-2.9.so

;;; --without-gcc  ;; removes GNU License
;;; --with-cxx-main=<compiler> ;; Boost  shoudl (?) include BSD license
;;; 
;;; Above Still needs to be clarified ... can this be done ? will it work?
;;;FOR 64bit
;;;  --with-universal-arch=64-bit 
;;;
;;;  CPPFLAGS    C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
;;;              you have headers in a nonstandard directory <include dir>
;;;  CPP         C preprocessor
;;; If we can make a SPEC file after giving all the above variables during 
;;; ./configure, then we can do an RPM rebuild and have other programmes also 
;;; installed for this version.

                  ============================

UNCOMMNET THESE LINES IN "Modules/Setup" AFTER RUNNING THE ABOVE LINE.

[PYTHON UNTAR DIR]#
#joe / vi Modules/Setup


# *** Always uncomment this (leave the leading underscore in!):
 _tkinter _tkinter.c tkappinit.c -DWITH_APPINIT \
# *** Uncomment and edit to reflect where your Tcl/Tk libraries are:
        -L/usr/lib \
# *** Uncomment and edit to reflect where your Tcl/Tk headers are:
        -I/usr/include \
# *** Uncomment and edit to reflect where your X11 header files are:
        -I/usr/X11R6/include \
# *** Or uncomment this for Solaris:
#       -I/usr/openwin/include \
# *** Uncomment and edit for Tix extension only:
        -DWITH_TIX -ltix \
# *** Uncomment and edit for BLT extension only:
#       -DWITH_BLT -I/usr/local/blt/blt8.0-unoff/include -lBLT8.0 \
# *** Uncomment and edit for PIL (TkImaging) extension only:
#     (See http://www.pythonware.com/products/pil/ for more info)
        -DWITH_PIL -I../Imaging-1.1.6/libImaging tkImaging.c \

                =========================================


# Modules that should always be present (non UNIX dependent):

array arraymodule.c     # array objects
cmath cmathmodule.c # -lm # complex math library functions
math mathmodule.c # -lm # math library functions, e.g. sin()
#_struct _struct.c      # binary structure packing/unpacking
time timemodule.c # -lm # time operations and variables
operator operator.c     # operator.add() and similar goodies
#_weakref _weakref.c    # basic weak reference support
#_testcapi _testcapimodule.c    # Python C API test module
_random _randommodule.c # Random number generator
#collections collectionsmodule.c # Container types
itertools itertoolsmodule.c     # Functions creating iterators for efficient looping
strop stropmodule.c             # String manipulations

unicodedata unicodedata.c    # static Unicode character database

                  =====================================

# Andrew Kuchling's zlib module.
# This require zlib 1.1.3 (or later).
# See http://www.gzip.org/zlib/
zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz

                  ==========================================

# Socket module helper for socket(2)
_socket socketmodule.c

# Socket module helper for SSL support; you must comment out the other
# socket line above, and possibly edit the SSL variable:
SSL=/usr/local/ssl
_ssl _ssl.c \
        -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
        -L$(SSL)/lib -lssl -lcrypto

                  =====================================
THIS IS NOT TO BE REPEATED EVERY TIME

* Adding Tkinter support

1. Compile Python's _tkinter.c with the WITH_APPINIT and WITH_PIL
   flags set, and link it with tkImaging.c and tkappinit.c.  To
   do this, copy the former to the Modules directory, and edit
   the _tkinter line in Setup (or Setup.in) according to the
   instructions in that file.


   You must also change the _tkinter line in Setup (or Setup.in)
   to something like:

   _tkinter _tkinter.c tkImaging.c tkappinit.c -DWITH_APPINIT
        -I/usr/local/include -L/usr/local/lib -ltk8.0 -ltcl8.0 -lX11

               ===========================================

THIS IS NOT TO BE REPEATED EVERY TIME

Copy (don't Move) all Dir/files Imaging-1.1.6/libImaging/*.* to 
../Python2.6.2/Modules

AND then copy ONLY files from 
Imaging-1.16/libImaging/*.* to /home/nitin/newpy/Python2.6/Modules/*.*

                  ======================================

Step 6
Build and install Python 2.6.2. Now, there are some important things to discuss here. 
First and foremost we have given the option ?prefix=/opt/python2.6. This option installs 
the python binaries and the python library in /opt/python262 (it will make the dir for us) 
rather than in /usr/local/ which would, as we stated above, replace the standard python 
interpreter and inherently be bad juju. The /opt directory in redhat based distributions 
is a directory provides a home for larger, mostly custom built, binaries and applications.

Also, we made sure that the interpreter is going to make use of multiple threads by adding 
the ?with-threads option. I believe that by default, with-threads is true, but better to 
be safe than sorry. Finally, the ?enable-shared option just allows python to be embedded 
into other apps:


view sourceprint?1.cd
2.tar xfz Python-2.6.2.tgz 
3.cd Python-2.6.2 
4../configure --prefix=/opt/python2.6 --with-threads --enable-shared 
5.make
6.make install


Step 7
We need to now make sure that all the users of the system access the new interpreter 
when python is typed into standard in. To do this, we will need to add a couple of 
aliases and an addidtion to the $PATH to each users .bash_profile. This file is kept 
in the home directory of each user (ie: /home/usera/.bash_profile):

          OR

joe ~/.bashrc

export PYTHONPATH=/opt/python262/lib/python2.6/site-packages:$PYTHONPATH

SAVE and EXIT

source ~/.bashrc


contd....
view sourceprint?01.su - root 
02.cd
03.nano .bash_profile (vi OR joe instead of nano)

04.# add the following lines to the bottom of the file 
05.alias python='/opt/python2.6/bin/python' 
06.alias python2.6='/opt/python2.6/bin/python' 
07.PATH=$PATH:/opt/python2.6/bin 

08.# 'ctrl + o' to save the file and 'ctrl+x' to close the file 

09.# now do the same for every other user, like this: 
10.nano /home/usera/.bash_profile (vi OR joe instead of nano)


11.# add the following lines to the bottom of the file 
12.alias python='/opt/python2.6/bin/python' 
13.alias python2.6='/opt/python2.6/bin/python' 
14.PATH=$PATH:/opt/python2.6/bin 

15.# 'ctrl + o' to save the file and 'ctrl+x' to close the file


Step 8
Now we need to update BASH so that it knows about the new shared libraries that we have put on the 
system. Lets create a symlink to them and then reload the cache of the shared libraries:

view sourceprint?1.su - root 
2.cd
3.cat >> /etc/ld.so.conf.d/opt-python2.6.conf 
4.-->/opt/python2.6/lib    #hit 'enter' and then 'ctrl+d' 
5.ldconfig

Step 9
Now lets roll up some setup tools. This will also give us our conduit to the cheese shop 
(aka: pypi) which I am a complete fan of, despite the nay sayers. Also, we will add some more symlinks :

view sourceprint?1.cd
2.wget http://pypi.python.org/packages/2.6/s/setuptools/setuptools-0.6c9-py2.6.egg#md5=ca37b1ff16fa2ede6e19383e7b59245a 
3.sh setuptools-0.6c9-py2.6.egg 
4.cd /opt/python2.6/lib/python2.6/config 
5.ln -s ../../libpython2.6.so .
Step 10
Ignore Bridgett Cherry.

Step 11
You are done senior! Logout and log back in, to get the new bash profile stuff and continue on your way!

===========================================================================================================

INSTALLING FFTW

;;;this is for double precision

#./configure --prefix=/opt/fftw332 --enable-shared --enable-threads --enable-sse2 --enable-portable-binary

#make

#make install

RUN THE ./configure 2nd TIME
;;;This is for single precesion

#./configure --prefix=/opt/fftw332 --enable-shared --enable-threads --enable-sse --enable-portable-binary \
--enable-float

#make >make.log

#make install >make.install.log


============================================================================================================
XBLAS.tar.gz INSTALLAITON

# tar zxvf xblas.tar.gz

# cd xblas-1.0.248

# autoconf

# CC=gcc FC=gfortran ./configure --prefix=/opt/xblas 

# m4 Makefile.m4 >Makefile

# make makefiles > makefiles.log

# make > make.log

To UNINSTALL

# make clean

============================================================================================================
LAPACK-LITE-3.1.1 INSTALLATION

#tar zxvf lapack-lite-3.1.1.tgz

#cd lapack-lite-3.1.1

#cp INSTALL/make.inc.gfortran make.inc

IMPORTANT

INSTALL ATLAS IN A BOGUS/TEMP DIR, WHICH YOU WILL DELETE AFTER DOING THE FOLLOWING:
"BOGUS INSTALL"

# tar zxvf atlas3.8.3.tgz

# mv ATLAS ATLAS-3.8.3

# mkdir ATLAS_tmp

# cd ATLAS_tmp

# /home/nitin/newpy/ATLAS-3.8.3/configure -Si cputhrchk 0 -b 32 -D c -DPentiumP4=1790\
 -dylib -Fa alg 


AFTER RUNNING THE ./configure (above), THIS WILL MAKE A make.inc FILE


EDIT LAPACK/make.inc : COPY from ATLAS_tmp (./configure creates) make.inc


SEARCH FOR THE FOLLOWING LINE AND Copy after = 

    F77FLAGS = -fomit-frame-pointer -mfpmath=387 -O2 -falign-loops=4 -m32



PASTE into LAPACK/make.inc OPT= :


FORTRAN = gfortran -fimplicit-none -g
OPTS    = -fomit-frame-pointer -mfpmath=387 -O2 -falign-loops=4 -m32
DRVOPTS = $(OPTS)
NOOPT   = -fomit-frame-pointer -mfpmath=387 -m32
LOADER  = gfortran -g
LOADOPTS= $(OPTS)


{ following NOT in lapack-lite

;;;  further down Un-Commnet the lines and add the path:
;;;  USEXBLAS    = Yes
;;;  XBLASLIB    = /home/nitin/newpy/xblas-1.0.248/libxblas.a
;;;  #XBLASLIB    = -lxblas
}

save and exit


{{{ following is default

#joe Makefile (nano/pico/vi)

edit 

  all: lapack_install lib lapack_testing blas_testing

save and exit

}}}


# make blaslib > laplit311_blaslib.log

# make > laplit311_make.log

# cp lapack_LINUX.a liblapack.a



{{{ ;;; did not do this step
OR 
# ld -o /opt/atlas/lib/liblapack.so -shared --whole-archive\
--export-dynamic /home/nitin/newpy/lapack-3.2.1/liblapack.a
}}}




# rm -Rf ATLAS_tmp/

The following is in Makefile

   all:lapack_install lib lapack_testing blas_testing ;;; for the time being 
                                                      ;;; removed 'testing' & 
                                                      ;;; 'timing'

TO UNINSTALL 

[ LAPACK ]#rm -vfr lapack_LINUX.a blas_LINUX.a tmglib_LINUX.a lapacklib.a

# make clean

==========================================================================================

ATLAS INSTALLATIONS INSTRUCTIONS

# tar jxvf atlas-3.8.3.tgz


# mv ATLAS ATLAS-3.8.3  ;;; Rename the directory, convenient

;;; Turn off CPU throttling when installing ATLAS ,  Fedora 

# /usr/bin/cpufreq-selector -g performance

;;; On my Core2Duo, cpufreq-selector only changes the parameters of the first CPU, 
;;; regardless of which cpu you specify. I suspect this is a bug, because on earlier 
;;; systems, the remaining CPUs were controlled via a logical link to 
;;; /sys/devices/system/cpu/cpu0/. In this case, the only way I found to force the 
;;; second processor to also run at its peak frequency was to issue the following as 
;;; root after setting CPU0 to performance: 

 
   cp /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor \
      /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor


# cd .. (one up dir)  ;;; Out of ATLAS-3.8.3 dir
/home/nitin/newpy

# mkdir linux_P4ESSE2 ;;; Make a new dir Or as.... Linux_C2D64SSE3 (Core2Duo)


# /home/nitin/newpy/ATLAS-3.8.3/configure --with-netlib-lapack=/home/nitin/newpy/lapack-lite-3.1.1/lapack_LINUX.a\
 -dylib -b 32 -D c -DPentiumP4=1790 --prefix=/opt/atlas -Ss flapack /home/nitin/newpy/lapack-lite-3.1.1/SRC\
 -Fa alg -fPIC -Si cputhrchk 0 > config.log

;;; takes a good amount of an hour ...frankly depending on your machine config.

# make build > at383_build.log

# make check > at383_check.log

# make > at383_make.log

                            ;;; # make time > time.log


# make install > at383_install.log


[linux_P4ESSE2]# cd lib

# cp /home/nitin/newpy/lapack-lite-3.1.1/liblapack.a . (Overwrite? y) ;; copy current dir

;;; this liblapack.a = lapack_LINUX.a = 13MB approx (at least more than 6MB)

# make shared > at311_shared.log

# cp -f *.so /opt/atlas/lib/.

# cd ..

                         ;;; [linux_P4ESSE2]# cd bin

                         ;;;; # make xdlutst_dyn > at311_xdlutst.log


( export ATLAS=/usr/local/lib/atlas )


UNINSTALL 

[Linux_P4ESSE2]# make clean


=====================================================================================

INSTALLING nose

#tar zxvf nose-0.11.1.tar.tar

# cd nose-0.11.1

#/opt/python262/bin/python setup.py install --prefix=/opt/python262 2>&1 | tee nose.log


=====================================================================================
INSTALLING numpy

# tar zxvf numpy-1.3.0rc2.tar.gz

# cd numpy-1.3.0rc2

# cp site.cfg.example site.cfg

# joe site.cfg

[DEFAULT]
library_dirs = /usr/local/lib:/opt/atlas/lib:/opt/fftw332/lib:/opt/python262/lib
include_dirs = /usr/local/include:/opt/atlas/include:/opt/fftw332/include:/opt/python262/include

[blas_opt]
libraries = f77blas, cblas, atlas

[lapack_opt]
libraries = lapack, f77blas, cblas, atlas, g2c

[fftw]
libraries = fftw3, fftw3f

[fftw_opt]
libraries = fftw3_threads, fftw3f_threads

SAVE and EXIT


# /opt/python262/bin/python setup.py -v config_fc build_ext --fcompiler=gnu95 build | tee num130_build.log


# /opt/python262/bin/python setup.py install --prefix=/opt/python262 2>&1 | tee num130_install.log


# source ~/.bashrc

TO UN-INSTALL numpy

Remove dir 'build'

Remove /opt/python262/lib/python2.6/site-packages/numpy-*.egg

and 

Remove -rvf /opt/python262/lib/python2.6/site-packages/numpy/  ;;; numpy/ direcotry


================================================================================

INSTALLING SciPy

/home/nitin/newpy/scipy-0.7.1.tar.gz

# tar zxvf scipy-0.7.1.tar.gz

# cd scipy-0.7.1

# 




XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX




More information about the SciPy-User mailing list