![](https://secure.gravatar.com/avatar/a1b8e09be89d21ab15895655a9fe5a92.jpg?s=120&d=mm&r=g)
Hi Ralf, Maybe I'm misunderstanding how to handle site.cfg, so I'm trying easy tests about CFLAGS and site.cfg. These tests are done on independent snapshots (already installed Python 2.7.3) of VMware. My libpython2.7.so and libpython2.7.so.1.0 are on /usr/local/python-2.7.3/lib. Lapack and ATLAS are not installed yet. With CFLAGS:
export CFLAGS="-L/usr/local/python-2.7.3/lib" python setup.py config
Running from numpy source directory.non-existing path in 'numpy/distutils': 'site.cfg' F2PY Version 2 blas_opt_info: blas_mkl_info: libraries mkl,vml,guide not found in /usr/local/python-2.7.3/lib libraries mkl,vml,guide not found in /usr/local/lib64 libraries mkl,vml,guide not found in /usr/local/lib libraries mkl,vml,guide not found in /usr/lib64 libraries mkl,vml,guide not found in /usr/lib NOT AVAILABLE
atlas_blas_threads_info: Setting PTATLAS=ATLAS libraries ptf77blas,ptcblas,atlas not found in /usr/local/python-2.7.3/lib libraries ptf77blas,ptcblas,atlas not found in /usr/local/lib64 libraries ptf77blas,ptcblas,atlas not found in /usr/local/lib libraries ptf77blas,ptcblas,atlas not found in /usr/lib64/atlas libraries ptf77blas,ptcblas,atlas not found in /usr/lib64/sse2 libraries ptf77blas,ptcblas,atlas not found in /usr/lib64 libraries ptf77blas,ptcblas,atlas not found in /usr/lib NOT AVAILABLE
atlas_blas_info: libraries f77blas,cblas,atlas not found in /usr/local/python-2.7.3/lib libraries f77blas,cblas,atlas not found in /usr/local/lib64 libraries f77blas,cblas,atlas not found in /usr/local/lib libraries f77blas,cblas,atlas not found in /usr/lib64/atlas libraries f77blas,cblas,atlas not found in /usr/lib64/sse2 libraries f77blas,cblas,atlas not found in /usr/lib64 libraries f77blas,cblas,atlas not found in /usr/lib NOT AVAILABLE
/home/magician/Desktop/numpy-1.6.1/numpy/distutils/system_info.py:1414: UserWarning: Atlas (http://math-atlas.sourceforge.net/) libraries not found. Directories to search for the libraries can be specified in the numpy/distutils/site.cfg file (section [atlas]) or by setting the ATLAS environment variable. warnings.warn(AtlasNotFoundError.__doc__) blas_info: libraries blas not found in /usr/local/python-2.7.3/lib libraries blas not found in /usr/local/lib64 libraries blas not found in /usr/local/lib libraries blas not found in /usr/lib64 libraries blas not found in /usr/lib NOT AVAILABLE
/home/magician/Desktop/numpy-1.6.1/numpy/distutils/system_info.py:1423: UserWarning: Blas (http://www.netlib.org/blas/) libraries not found. Directories to search for the libraries can be specified in the numpy/distutils/site.cfg file (section [blas]) or by setting the BLAS environment variable. warnings.warn(BlasNotFoundError.__doc__) blas_src_info: NOT AVAILABLE
/home/magician/Desktop/numpy-1.6.1/numpy/distutils/system_info.py:1426: UserWarning: Blas (http://www.netlib.org/blas/) sources not found. Directories to search for the sources can be specified in the numpy/distutils/site.cfg file (section [blas_src]) or by setting the BLAS_SRC environment variable. warnings.warn(BlasSrcNotFoundError.__doc__) NOT AVAILABLE
lapack_opt_info: lapack_mkl_info: mkl_info: libraries mkl,vml,guide not found in /usr/local/python-2.7.3/lib libraries mkl,vml,guide not found in /usr/local/lib64 libraries mkl,vml,guide not found in /usr/local/lib libraries mkl,vml,guide not found in /usr/lib64 libraries mkl,vml,guide not found in /usr/lib NOT AVAILABLE
NOT AVAILABLE
atlas_threads_info: Setting PTATLAS=ATLAS libraries ptf77blas,ptcblas,atlas not found in /usr/local/python-2.7.3/lib libraries lapack_atlas not found in /usr/local/python-2.7.3/lib libraries ptf77blas,ptcblas,atlas not found in /usr/local/lib64 libraries lapack_atlas not found in /usr/local/lib64 libraries ptf77blas,ptcblas,atlas not found in /usr/local/lib libraries lapack_atlas not found in /usr/local/lib libraries ptf77blas,ptcblas,atlas not found in /usr/lib64/atlas libraries lapack_atlas not found in /usr/lib64/atlas libraries ptf77blas,ptcblas,atlas not found in /usr/lib64/sse2 libraries lapack_atlas not found in /usr/lib64/sse2 libraries ptf77blas,ptcblas,atlas not found in /usr/lib64 libraries lapack_atlas not found in /usr/lib64 libraries ptf77blas,ptcblas,atlas not found in /usr/lib libraries lapack_atlas not found in /usr/lib numpy.distutils.system_info.atlas_threads_info NOT AVAILABLE
atlas_info: libraries f77blas,cblas,atlas not found in /usr/local/python-2.7.3/lib libraries lapack_atlas not found in /usr/local/python-2.7.3/lib libraries f77blas,cblas,atlas not found in /usr/local/lib64 libraries lapack_atlas not found in /usr/local/lib64 libraries f77blas,cblas,atlas not found in /usr/local/lib libraries lapack_atlas not found in /usr/local/lib libraries f77blas,cblas,atlas not found in /usr/lib64/atlas libraries lapack_atlas not found in /usr/lib64/atlas libraries f77blas,cblas,atlas not found in /usr/lib64/sse2 libraries lapack_atlas not found in /usr/lib64/sse2 libraries f77blas,cblas,atlas not found in /usr/lib64 libraries lapack_atlas not found in /usr/lib64 libraries f77blas,cblas,atlas not found in /usr/lib libraries lapack_atlas not found in /usr/lib numpy.distutils.system_info.atlas_info NOT AVAILABLE
/home/magician/Desktop/numpy-1.6.1/numpy/distutils/system_info.py:1330: UserWarning: Atlas (http://math-atlas.sourceforge.net/) libraries not found. Directories to search for the libraries can be specified in the numpy/distutils/site.cfg file (section [atlas]) or by setting the ATLAS environment variable. warnings.warn(AtlasNotFoundError.__doc__) lapack_info: libraries lapack not found in /usr/local/python-2.7.3/lib libraries lapack not found in /usr/local/lib64 libraries lapack not found in /usr/local/lib libraries lapack not found in /usr/lib64 libraries lapack not found in /usr/lib NOT AVAILABLE
/home/magician/Desktop/numpy-1.6.1/numpy/distutils/system_info.py:1341: UserWarning: Lapack (http://www.netlib.org/lapack/) libraries not found. Directories to search for the libraries can be specified in the numpy/distutils/site.cfg file (section [lapack]) or by setting the LAPACK environment variable. warnings.warn(LapackNotFoundError.__doc__) lapack_src_info: NOT AVAILABLE
/home/magician/Desktop/numpy-1.6.1/numpy/distutils/system_info.py:1344: UserWarning: Lapack (http://www.netlib.org/lapack/) sources not found. Directories to search for the sources can be specified in the numpy/distutils/site.cfg file (section [lapack_src]) or by setting the LAPACK_SRC environment variable. warnings.warn(LapackSrcNotFoundError.__doc__) NOT AVAILABLE
running config Then I executed "python setup.py build", NumPy was built successfully.
Next with site.cfg:
[DEFAULT] library_dirs = /usr/local/python-2.7.3/lib include_dirs = /usr/local/python-2.7.3/include
cp site.cfg.example site.cfg vi site.cfg python setup.py config
Running from numpy source directory.F2PY Version 2 blas_opt_info: blas_mkl_info: libraries mkl,vml,guide not found in /usr/local/python-2.7.3/lib NOT AVAILABLE
atlas_blas_threads_info: Setting PTATLAS=ATLAS libraries ptf77blas,ptcblas,atlas not found in /usr/local/python-2.7.3/lib NOT AVAILABLE
atlas_blas_info: libraries f77blas,cblas,atlas not found in /usr/local/python-2.7.3/lib NOT AVAILABLE
/home/magician/Desktop/numpy-1.6.1/numpy/distutils/system_info.py:1414: UserWarning: Atlas (http://math-atlas.sourceforge.net/) libraries not found. Directories to search for the libraries can be specified in the numpy/distutils/site.cfg file (section [atlas]) or by setting the ATLAS environment variable. warnings.warn(AtlasNotFoundError.__doc__) blas_info: libraries blas not found in /usr/local/python-2.7.3/lib NOT AVAILABLE
/home/magician/Desktop/numpy-1.6.1/numpy/distutils/system_info.py:1423: UserWarning: Blas (http://www.netlib.org/blas/) libraries not found. Directories to search for the libraries can be specified in the numpy/distutils/site.cfg file (section [blas]) or by setting the BLAS environment variable. warnings.warn(BlasNotFoundError.__doc__) blas_src_info: NOT AVAILABLE
/home/magician/Desktop/numpy-1.6.1/numpy/distutils/system_info.py:1426: UserWarning: Blas (http://www.netlib.org/blas/) sources not found. Directories to search for the sources can be specified in the numpy/distutils/site.cfg file (section [blas_src]) or by setting the BLAS_SRC environment variable. warnings.warn(BlasSrcNotFoundError.__doc__) NOT AVAILABLE
lapack_opt_info: lapack_mkl_info: mkl_info: libraries mkl,vml,guide not found in /usr/local/python-2.7.3/lib NOT AVAILABLE
NOT AVAILABLE
atlas_threads_info: Setting PTATLAS=ATLAS libraries ptf77blas,ptcblas,atlas not found in /usr/local/python-2.7.3/lib libraries lapack_atlas not found in /usr/local/python-2.7.3/lib numpy.distutils.system_info.atlas_threads_info NOT AVAILABLE
atlas_info: libraries f77blas,cblas,atlas not found in /usr/local/python-2.7.3/lib libraries lapack_atlas not found in /usr/local/python-2.7.3/lib numpy.distutils.system_info.atlas_info NOT AVAILABLE
/home/magician/Desktop/numpy-1.6.1/numpy/distutils/system_info.py:1330: UserWarning: Atlas (http://math-atlas.sourceforge.net/) libraries not found. Directories to search for the libraries can be specified in the numpy/distutils/site.cfg file (section [atlas]) or by setting the ATLAS environment variable. warnings.warn(AtlasNotFoundError.__doc__) lapack_info: libraries lapack not found in /usr/local/python-2.7.3/lib NOT AVAILABLE
/home/magician/Desktop/numpy-1.6.1/numpy/distutils/system_info.py:1341: UserWarning: Lapack (http://www.netlib.org/lapack/) libraries not found. Directories to search for the libraries can be specified in the numpy/distutils/site.cfg file (section [lapack]) or by setting the LAPACK environment variable. warnings.warn(LapackNotFoundError.__doc__) lapack_src_info: NOT AVAILABLE
/home/magician/Desktop/numpy-1.6.1/numpy/distutils/system_info.py:1344: UserWarning: Lapack (http://www.netlib.org/lapack/) sources not found. Directories to search for the sources can be specified in the numpy/distutils/site.cfg file (section [lapack_src]) or by setting the LAPACK_SRC environment variable. warnings.warn(LapackSrcNotFoundError.__doc__) NOT AVAILABLE
running config Then I executed "python setup.py build", I got errors about -lpython which I posted before.
If I edit site.cfg as below, config messages become same as CFLAGS, but same -lpython errors are dumped:
vi site.cfg
[DEFAULT] library_dirs = /usr/local/python-2.7.3/lib:/usr/local/lib64:/usr/local/lib:/usr/lib64:/usr/lib include_dirs = /usr/local/python-2.7.3/include
Magician On 2012/05/27, at 17:16, Ralf Gommers wrote:
On Sun, May 27, 2012 at 4:05 AM, Magician <f_magician@mac.com> wrote:
Hi Ralf and Sergio,
I thought my problems inclined to NumPy, and I posted to NumPy mailing list. But I couldn't get any answers for several days, so I'd like to ask again.
I tried to build NumPy again with site.cfg, but I got these errors:
building 'numpy.core._sort' extension compiling C sources C compiler: gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC
compile options: '-Inumpy/core/include -Ibuild/src.linux-x86_64-2.7/numpy/core/include/numpy -Inumpy/core/src/private -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/include -I/usr/local/python-2.7.3/include/python2.7 -Ibuild/src.linux-x86_64-2.7/numpy/core/src/multiarray -Ibuild/src.linux-x86_64-2.7/numpy/core/src/umath -c' gcc: build/src.linux-x86_64-2.7/numpy/core/src/_sortmodule.c gcc -pthread -shared build/temp.linux-x86_64-2.7/build/src.linux-x86_64-2.7/numpy/core/src/_sortmodule.o -L. -Lbuild/temp.linux-x86_64-2.7 -lnpymath -lm -lpython2.7 -o build/lib.linux-x86_64-2.7/numpy/core/_sort.so /usr/bin/ld: cannot find -lpython2.7 collect2: ld returned 1 exit status /usr/bin/ld: cannot find -lpython2.7 collect2: ld returned 1 exit status error: Command "gcc -pthread -shared build/temp.linux-x86_64-2.7/build/src.linux-x86_64-2.7/numpy/core/src/_sortmodule.o -L. -Lbuild/temp.linux-x86_64-2.7 -lnpymath -lm -lpython2.7 -o build/lib.linux-x86_64-2.7/numpy/core/_sort.so" failed with exit status 1
Before I built NumPy, I uncommented and modified site.cfg as below:
[DEFAULT] library_dirs = /usr/local/python-2.7.3/lib:/usr/lib64:/usr/lib64/atlas include_dirs = /usr/local/python-2.7.3/include:/usr/include:/usr/include/atlas
[blas_opt] libraries = f77blas, cblas, atlas
[lapack_opt] libraries = lapack, f77blas, cblas, atlas
And "setup.py config" dumped these messages:
Running from numpy source directory.F2PY Version 2 blas_opt_info: blas_mkl_info: libraries mkl,vml,guide not found in /usr/local/python-2.7.3/lib libraries mkl,vml,guide not found in /usr/lib64 libraries mkl,vml,guide not found in /usr/lib64/atlas NOT AVAILABLE
atlas_blas_threads_info: Setting PTATLAS=ATLAS libraries ptf77blas,ptcblas,atlas not found in /usr/local/python-2.7.3/lib Setting PTATLAS=ATLAS customize GnuFCompiler Could not locate executable g77 Could not locate executable f77 customize IntelFCompiler Could not locate executable ifort Could not locate executable ifc customize LaheyFCompiler Could not locate executable lf95 customize PGroupFCompiler Could not locate executable pgf90 Could not locate executable pgf77 customize AbsoftFCompiler Could not locate executable f90 customize NAGFCompiler Found executable /usr/bin/f95 customize VastFCompiler customize CompaqFCompiler Could not locate executable fort customize IntelItaniumFCompiler Could not locate executable efort Could not locate executable efc customize IntelEM64TFCompiler customize Gnu95FCompiler Found executable /usr/bin/gfortran customize Gnu95FCompiler customize Gnu95FCompiler using config compiling '_configtest.c':
/* This file is generated from numpy/distutils/system_info.py */ void ATL_buildinfo(void); int main(void) { ATL_buildinfo(); return 0; }
C compiler: gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC
compile options: '-c' gcc: _configtest.c gcc -pthread _configtest.o -L/usr/lib64/atlas -lptf77blas -lptcblas -latlas -o _configtest ATLAS version 3.8.4 built by mockbuild on Wed Dec 7 18:04:21 GMT 2011: UNAME : Linux c6b5.bsys.dev.centos.org 2.6.32-44.2.el6.x86_64 #1 SMP Wed Jul 21 12:48:32 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux INSTFLG : -1 0 -a 1 ARCHDEFS : -DATL_OS_Linux -DATL_ARCH_PII -DATL_CPUMHZ=2261 -DATL_SSE2 -DATL_SSE1 -DATL_USE64BITS -DATL_GAS_x8664 F2CDEFS : -DAdd_ -DF77_INTEGER=int -DStringSunStyle CACHEEDGE: 8388608 F77 : gfortran, version GNU Fortran (GCC) 4.4.6 20110731 (Red Hat 4.4.6-3) F77FLAGS : -fomit-frame-pointer -mfpmath=387 -O2 -falign-loops=4 -g -Wa,--noexecstack -fPIC -m64 SMC : gcc, version gcc (GCC) 4.4.6 20110731 (Red Hat 4.4.6-3) SMCFLAGS : -fomit-frame-pointer -mfpmath=387 -O2 -falign-loops=4 -g -Wa,--noexecstack -fPIC -m64 SKC : gcc, version gcc (GCC) 4.4.6 20110731 (Red Hat 4.4.6-3) SKCFLAGS : -fomit-frame-pointer -mfpmath=387 -O2 -falign-loops=4 -g -Wa,--noexecstack -fPIC -m64 success! removing: _configtest.c _configtest.o _configtest Setting PTATLAS=ATLAS FOUND: libraries = ['ptf77blas', 'ptcblas', 'atlas'] library_dirs = ['/usr/lib64/atlas'] language = c define_macros = [('ATLAS_INFO', '"\\"3.8.4\\""')] include_dirs = ['/usr/include']
FOUND: libraries = ['ptf77blas', 'ptcblas', 'atlas'] library_dirs = ['/usr/lib64/atlas'] language = c define_macros = [('ATLAS_INFO', '"\\"3.8.4\\""')] include_dirs = ['/usr/include']
lapack_opt_info: lapack_mkl_info: mkl_info: libraries mkl,vml,guide not found in /usr/local/python-2.7.3/lib libraries mkl,vml,guide not found in /usr/lib64 libraries mkl,vml,guide not found in /usr/lib64/atlas NOT AVAILABLE
NOT AVAILABLE
atlas_threads_info: Setting PTATLAS=ATLAS libraries ptf77blas,ptcblas,atlas not found in /usr/local/python-2.7.3/lib libraries lapack_atlas not found in /usr/local/python-2.7.3/lib libraries lapack_atlas not found in /usr/lib64/atlas numpy.distutils.system_info.atlas_threads_info Setting PTATLAS=ATLAS Setting PTATLAS=ATLAS FOUND: libraries = ['lapack', 'ptf77blas', 'ptcblas', 'atlas'] library_dirs = ['/usr/lib64/atlas'] language = f77 define_macros = [('ATLAS_INFO', '"\\"3.8.4\\""')] include_dirs = ['/usr/include']
FOUND: libraries = ['lapack', 'ptf77blas', 'ptcblas', 'atlas'] library_dirs = ['/usr/lib64/atlas'] language = f77 define_macros = [('ATLAS_INFO', '"\\"3.8.4\\""')] include_dirs = ['/usr/include']
running config
I couldn't get enough informations about numscons/bento, so I'm still trying to build it with site.cfg and CFLAGS.
You specified the additional library dir you need in site.cfg. You therefore don't need to use CFLAGS anymore. This is probably still what's going wrong, because the build error says it can't find Python itself anymore. So make sure that CFLAGS is not defined and try again.
Ralf