python

A propos de python

On trouve plusieurs versions de python sur nemo:

origine chemin version PYTHONPATH 32/64
SUNWPython /usr/bin/python 2.4.4 /local/apps/lib/python2.4/site-packages
SMCpython /usr/local/bin/python 2.5.1 /local/apps/smc/lib/python2.5/site-packages
CSWpython /opt/csw/bin/python 2.5.1 /local/apps/csw/lib/python2.5/site-packages
sources /local/apps/bin/python 2.5.2 /local/apps/lib/python2.5/site-packages
./configure --prefix=/local/apps \
CC=cc CXX=CC \
CPPFLAGS="-I/usr/sfw/include" \
LDFLAGS="-L/usr/sfw/lib -R/usr/sfw/lib"

Penser à commenter OPT: dans le Makefile

./configure --prefix=/local/apps/64 \
CC=cc CXX=CC \
CPPFLAGS="-m64 -I/usr/sfw/include" \
LDFLAGS="-m64 -L/usr/sfw/lib/64 -R/usr/sfw/lib/64"

erreur:

"/local/apps/src/Python-2.5.2/./Include/pyport.h", line 761: #error: "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
cc: acomp failed for /local/apps/src/Python-2.5.2/Modules/_struct.c

voir http://mail.python.org/pipermail/python-bugs-list/2007-January/036647.html

numpy-1.2.1

mêmes corrections que pour la version 1.0.4

> python setup.py install --prefix=$HOME/ | & tee INSTALL.LOG

numpy-1.0.4

se logger devel1 sur nemo:

module load ss12 hpc

fichier site.cfg dans numpy/distutils/

[DEFAULT]
library_dirs = /opt/studio12/SUNWspro/lib
include_dirs = /opt/studio12/SUNWspro/include

[blas]
blas_libs = sunperf

[lapack]
lapack_libs = sunperf

remove numpy/distutils/fcompiler/sun.py f77compact from the optionlist

> diff -u numpy/distutils/fcompiler/sun.py-dist numpy/distutils/fcompiler/sun.py 
--- numpy/distutils/fcompiler/sun.py-dist       Tue Oct 28 12:21:48 2008
+++ numpy/distutils/fcompiler/sun.py    Thu Nov  6 18:22:50 2008
@@ -38,7 +38,7 @@
         return ['-xtarget=generic']
     def get_libraries(self):
         opt = []
-        opt.extend(['fsu','sunmath','mvec','f77compat'])
+        opt.extend(['fsu','sunmath','mvec'])
         return opt
 
 if __name__ == '__main__':

, et enfin:

> python setup.py install --prefix=$HOME/lib | & tee INSTALL.LOG

et s'installe dans /local/apps/lib/lib/python2.4/site-packages/

Le test:

setenv PYTHONPATH /local/apps/lib/lib/python2.4/site-packages/
python -c 'import numpy; numpy.test()'

échoue sur:

======================================================================
FAIL: check_large_types (numpy.core.tests.test_scalarmath.TestPower)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/local/apps/lib/lib/python2.4/site-packages/numpy/core/tests/test_scalarmath.py", line 52, in check_large_types
    assert b == 6765201, "error with %r: got %r" % (t,b)
AssertionError: error with <type 'numpy.float96'>: got 6765201.00000000000364

et pourtant:

nemo-henry% /usr/bin/python
Python 2.4.4 (#1, Jan  9 2007, 23:31:33) [C] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> 6765201 == 6765201.00000000000364
True
>>>

se logger devel1 sur nemo:

module load ss12 hpc

fichier site.cfg dans numpy/distutils/

[DEFAULT]
library_dirs = /opt/studio12/SUNWspro/lib:/opt/csw/lib
include_dirs = /opt/studio12/SUNWspro/include:/opt/csw/include

[blas]
blas_libs = sunperf

[lapack]
lapack_libs = sunperf

et enfin:

> setenv LDFLAGS "-L/opt/csw/lib -R/opt/csw/lib"                                
> /opt/csw/bin/python setup.py install --prefix=$HOME/lib/blastwave | & tee INSTALL_BLASTWAVE.LOG

et s'installe dans /local/apps/lib/blastwave/lib/python/site-packages

Le test:

setenv PYTHONPATH /local/apps/lib/blastwave/lib/python/site-packages
/opt/csw/bin/python -c 'import numpy; numpy.test()'

python a été recompilé à partir des sources:

> module load ss12 hpc
> setenv PATH /local/apps/lib/bin:/opt/SUNWhpc/bin:/opt/studio12/SUNWspro/bin:/usr/local/wrapper/bin:/usr/bin:/usr/bin:/usr/ccs/bin:/usr/sfw/bin
> python setup.py install --prefix=$HOME/lib | & tee INSTALL.LOG

scipy

> setenv PYTHONPATH /local/apps/lib/python2.4/site-packages/
> mkdir -p scipy/distutils/fcompiler/
> cp ../numpy-1.2.1/numpy/distutils/fcompiler/sun.py scipy/distutils/fcompiler/
> setenv LDFLAGS "-lCrun -lCstd"
> setenv LAPACK /opt/SUNWspro/lib/libsunmath.so
> setenv BLAS /opt/SUNWspro/lib/libsunperf.so
> cp -rp scipy/sparse/sparsetools/sparsetools.h scipy/sparse/sparsetools/sparsetools.h-dist
> diff -u scipy/sparse/sparsetools/sparsetools.h-dist scipy/sparse/sparsetools/sparsetools.h
--- scipy/sparse/sparsetools/sparsetools.h-dist Sat Sep 22 09:55:25 2007
+++ scipy/sparse/sparsetools/sparsetools.h      Fri Nov  7 08:47:39 2008
@@ -22,8 +22,8 @@

 #include <vector>
 #include <algorithm>
+#include <functional>

-
 /*
  * Extract main diagonal of CSR matrix A
  *
  • scipy-0.6.0.tar.gz
> which python
/usr/bin/python
> python -c 'import os,sys;print os.name,sys.platform'
posix sunos5
> python -c 'import sys;print sys.version'
2.4.4 (#1, Jan  9 2007, 23:31:33) [C]
> 
> python setup.py config_fc --help-fcompiler

SunFCompiler instance properties:
  archiver        = None
  compile_switch  = '-c'
  compiler_f77    = ['/opt/studio12/SUNWspro/bin/f90', '-ftrap=%none', '-
                    f77', '-xcode=pic32']
  compiler_f90    = ['/opt/studio12/SUNWspro/bin/f90', '-xcode=pic32']
  compiler_fix    = ['/opt/studio12/SUNWspro/bin/f90', '-fixed', '-
                    xcode=pic32']
  libraries       = ['fsu', 'sunmath', 'mvec']
  library_dirs    = []
  linker_exe      = None
  linker_so       = ['/opt/studio12/SUNWspro/bin/f90', '-Bdynamic', '-G', '-
                    Bdynamic', '-G']
  object_switch   = '-o '
  ranlib          = None
  version         = LooseVersion ('8.3')
  version_cmd     = ['/opt/studio12/SUNWspro/bin/f90', '-V']
Fortran compilers found:
  --fcompiler=sun  Sun or Forte Fortran 95 Compiler (8.3)

Puis, en s'inspirant du message

> setenv LD_PRELOAD /usr/lib/libmtsk.so
> wget "http://downloads.sourceforge.net/scipy/scipy-0.5.2.1.tar.gz?modtime=1187640016&big_mirror=0"
> tar xzf ../downloads/scipy-0.5.2.1.tar.gz 
> cd scipy-0.5.2.1/
> python setup.py install --prefix=$HOME/lib | & tee INSTALL.LOG

     
> which python
/opt/csw/bin/python
> /opt/csw/bin/python -c 'import os,sys;print os.name,sys.platform'
posix sunos5
> /opt/csw/bin/python -c 'import sys;print sys.version'
2.5.1 (r251:54863, Nov  3 2007, 02:54:36) [C]

Puis, en s'inspirant du message

> setenv LD_PRELOAD /usr/lib/libmtsk.so
> wget "http://downloads.sourceforge.net/scipy/scipy-0.5.2.1.tar.gz?modtime=1187640016&big_mirror=0"
> tar xzf ../downloads/scipy-0.5.2.1.tar.gz 
> cd scipy-0.5.2.1/
> /opt/csw/bin/python setup.py install --prefix=$HOME/lib/blastwave | & tee INSTALL.LOG

     

PyStemmer

s'installe sans problème

/local/apps/src/PyStemmer-1.0.1
> python setup.py install --prefix=$HOME/lib
running install
running build
running build_ext
running install_lib
copying build/lib.solaris-2.10-i86pc-2.4/Stemmer.so -> /local/apps/lib/lib/python2.4/site-packages

PyML

NetworkX

sur nemo, compte devel1:

python setup.py install --prefix=$HOME | & tee INSTALL.LOG

Pygraphviz

> pwd
/local/apps/src/pygraphviz-0.37
bash-3.00$ export PYTHONPATH=/local/apps/lib/python2.4/site-packages
bash-3.00$ export PATH=/opt/csw/graphviz2/bin:$PATH
bash-3.00$ python setup.py install --prefix=$HOME | tee INSTALL.LOG
Package libagraph was not found in the pkg-config search path.
Perhaps you should add the directory containing `libagraph.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libagraph' found
Package libagraph was not found in the pkg-config search path.
Perhaps you should add the directory containing `libagraph.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libagraph' found
Trying pkg-config
Trying dotneato-config
library_path=/opt/csw/graphviz2/lib/graphviz
include_path=/opt/csw/graphviz2/include/graphviz
running install
running build
running build_py
...

pour nettoyer, effacer:

/local/apps/lib/python2.4/site-packages/pygraphviz/
\rm -rf build/*

Pour tester:

python -c 'import pygraphviz; pygraphviz.test()'
  • python.txt
  • Dernière modification : 2017/08/25 09:56
  • de 127.0.0.1