[petsc-users] Trouble installing petsc4py in Anaconda environment

William T. Jones w.t.jones at nasa.gov
Wed Oct 11 21:13:20 CDT 2017



On 10/11/17 7:06 PM, Matthew Knepley wrote:
> On Wed, Oct 11, 2017 at 5:29 PM, William T Jones <w.t.jones at nasa.gov 
> <mailto:w.t.jones at nasa.gov>> wrote:
> 
>     I have created an Anaconda Pytyoh 2.7 environment on an SGI-ICE
>     machine and included cython, numpy=1.12, scipy, and mpi4py (based
>     SGI-MPT). While petsc installs fine with:
> 
>     % PETSC_CONFIGURE_OPTIONS="--download-fblaslapack=1" pip install
>     https://bitbucket.org/petsc/petsc/get/maint.tar.gz
>     <https://bitbucket.org/petsc/petsc/get/maint.tar.gz>
> 
>     I cannot get petsc4py to build/install.  I am attempting with:
> 
>     % export
>     PETSC_DIR=${PREFIX}/envs/myenv/lib/python2.7/site-packages/petsc
>     % pip install --no-dependencies petsc4py
> 
>     Note, I am using "--no-dependencies" because I want to leave numpy
>     at 1.12 and do not want it to be upgraded.  Either way I get the
>     output below.  It appears that the link command has been corrupted
>     with the addition of the "gcc" command in the middle of the link
>     command.
> 
> 
> /vendor/sgi/mpt/2.14r19/bin/mpicc is being called. Does this actually 
> work? I would suspect it of calling 'gcc'
> 

Matt, Thanks for the response.

Yes, `/vendor/sgi/mpt/2.14r19/bin/mpicc` is a compiler wrapper that 
ultimately calls gcc.  The problem is that in the middle of the link 
line there is an extraneous "...-fstack-protector -g -O gcc -pthread 
-shared -B...".  From the error message, it is this embedded "gcc" that 
is the problem.

I cannot see where petsc4py gets its compiler and linker commands.  It 
would appear that they come from petsc.  Again, it appears that the link 
line is being constructed inappropriately.

>     Matt
> 
>     Any help is appreciated,
> 
> 
>     % pip install --no-dependencies petsc4py
>     Collecting petsc4py
>        Using cached petsc4py-3.8.0.tar.gz
>     Building wheels for collected packages: petsc4py
>        Running setup.py bdist_wheel for petsc4py ... error
>        Complete output from command
>     /home/login/anaconda2/envs/myenv/bin/python -u -c "import
>     setuptools,
>     tokenize;__file__='/tmp/pip-build-v6lDIk/petsc4py/setup.py';f=getattr(tokenize,
>     'open', open)(__file__);code=f.read().replace('\r\n',
>     '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel
>     -d /tmp/tmpD2KqLjpip-wheel- --python-tag cp27:
>        running bdist_wheel
>        running build
>        running build_src
>        running build_py
>        creating build
>        creating build/lib.linux-x86_64-2.7
>        creating build/lib.linux-x86_64-2.7/petsc4py
>        copying src/PETSc.py -> build/lib.linux-x86_64-2.7/petsc4py
>        copying src/__init__.py -> build/lib.linux-x86_64-2.7/petsc4py
>        copying src/__main__.py -> build/lib.linux-x86_64-2.7/petsc4py
>        creating build/lib.linux-x86_64-2.7/petsc4py/lib
>        copying src/lib/__init__.py ->
>     build/lib.linux-x86_64-2.7/petsc4py/lib
>        creating build/lib.linux-x86_64-2.7/petsc4py/include
>        creating build/lib.linux-x86_64-2.7/petsc4py/include/petsc4py
>        copying src/include/petsc4py/petsc4py.PETSc.h ->
>     build/lib.linux-x86_64-2.7/petsc4py/include/petsc4py
>        copying src/include/petsc4py/numpy.h ->
>     build/lib.linux-x86_64-2.7/petsc4py/include/petsc4py
>        copying src/include/petsc4py/petsc4py.PETSc_api.h ->
>     build/lib.linux-x86_64-2.7/petsc4py/include/petsc4py
>        copying src/include/petsc4py/petsc4py.h ->
>     build/lib.linux-x86_64-2.7/petsc4py/include/petsc4py
>        copying src/include/petsc4py/petsc4py.i ->
>     build/lib.linux-x86_64-2.7/petsc4py/include/petsc4py
>        copying src/include/petsc4py/__init__.pxd ->
>     build/lib.linux-x86_64-2.7/petsc4py/include/petsc4py
>        copying src/include/petsc4py/PETSc.pxd ->
>     build/lib.linux-x86_64-2.7/petsc4py/include/petsc4py
>        copying src/include/petsc4py/__init__.pyx ->
>     build/lib.linux-x86_64-2.7/petsc4py/include/petsc4py
>        copying src/PETSc.pxd -> build/lib.linux-x86_64-2.7/petsc4py
>        copying src/lib/petsc.cfg -> build/lib.linux-x86_64-2.7/petsc4py/lib
>        running build_ext
>        PETSC_DIR:
>     /home/login/anaconda2/envs/myenv/lib/python2.7/site-packages/petsc
>        PETSC_ARCH:
>        version:      3.8.0 release
>        integer-size: 32-bit
>        scalar-type:  real
>        precision:    double
>        language:     CONLY
>        compiler:     /vendor/sgi/mpt/2.14r19/bin/mpicc
>        linker:       /vendor/sgi/mpt/2.14r19/bin/mpicc
>        building 'PETSc' extension
>        creating build/temp.linux-x86_64-2.7
>        creating build/temp.linux-x86_64-2.7/src
>        /vendor/sgi/mpt/2.14r19/bin/mpicc -pthread -B
>     /home/login/anaconda2/envs/myenv/compiler_compat -fPIC -Wall
>     -Wwrite-strings -Wno-strict-aliasing -Wno-unknown-pragmas
>     -fstack-protector -g -O -fPIC -fno-strict-aliasing -g -O2 -DNDEBUG
>     -g -fwrapv -O3 -Wall
>     -DPETSC_DIR=/home/login/anaconda2/envs/myenv/lib/python2.7/site-packages/petsc
>     -I/home/login/anaconda2/envs/myenv/lib/python2.7/site-packages/petsc/include
>     -Isrc/include
>     -I/home/login/anaconda2/envs/myenv/lib/python2.7/site-packages/numpy/core/include
>     -I/home/login/anaconda2/envs/myenv/include/python2.7 -c src/PETSc.c
>     -o build/temp.linux-x86_64-2.7/src/PETSc.o
>        In file included from
>     /home/login/anaconda2/envs/myenv/lib/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1788:0,
> 
>                         from
>     /home/login/anaconda2/envs/myenv/lib/python2.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:18,
> 
>                         from
>     /home/login/anaconda2/envs/myenv/lib/python2.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,
> 
>                         from src/include/petsc4py/numpy.h:11,
>                         from src/petsc4py.PETSc.c:519,
>                         from src/PETSc.c:3:
> 
>     /home/login/anaconda2/envs/myenv/lib/python2.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2:
>     warning: #warning "Using deprecated NumPy API, disable it by "
>     "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
>         #warning "Using deprecated NumPy API, disable it by " \
>          ^
>        /vendor/sgi/mpt/2.14r19/bin/mpicc -pthread -B
>     /home/login/anaconda2/envs/myenv/compiler_compat -fPIC -Wall
>     -Wwrite-strings -Wno-strict-aliasing -Wno-unknown-pragmas
>     -fstack-protector -g -O -fPIC -fno-strict-aliasing -g -O2 -DNDEBUG
>     -g -fwrapv -O3 -Wall
>     -DPETSC_DIR=/home/login/anaconda2/envs/myenv/lib/python2.7/site-packages/petsc
>     -I/home/login/anaconda2/envs/myenv/lib/python2.7/site-packages/petsc/include
>     -Isrc/include
>     -I/home/login/anaconda2/envs/myenv/lib/python2.7/site-packages/numpy/core/include
>     -I/home/login/anaconda2/envs/myenv/include/python2.7 -c
>     src/libpetsc4py.c -o build/temp.linux-x86_64-2.7/src/libpetsc4py.o
>        /vendor/sgi/mpt/2.14r19/bin/mpicc -pthread -B
>     /home/login/anaconda2/envs/myenv/compiler_compat -fPIC -Wall
>     -Wwrite-strings -Wno-strict-aliasing -Wno-unknown-pragmas
>     -fstack-protector -g -O gcc -pthread -shared -B
>     /home/login/anaconda2/envs/myenv/compiler_compat
>     -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall
>     -L/home/login/anaconda2/envs/myenv/lib
>     -Wl,-rpath=/home/login/anaconda2/envs/myenv/lib -Wl,--no-as-needed
>     -Wl,--sysroot=/ build/temp.linux-x86_64-2.7/src/PETSc.o
>     build/temp.linux-x86_64-2.7/src/libpetsc4py.o
>     -L/home/login/anaconda2/envs/myenv/lib/python2.7/site-packages/petsc/lib
>     -L/home/login/anaconda2/envs/myenv/lib
>     -Wl,-rpath,/home/login/anaconda2/envs/myenv/lib/python2.7/site-packages/petsc/lib
>     -Wl,-rpath,/home/login/anaconda2/envs/myenv/lib -lpetsc -lpython2.7
>     -o build/lib.linux-x86_64-2.7/petsc4py/lib/PETSc.so
>        gcc: error: gcc: No such file or directory
>        error: command '/vendor/sgi/mpt/2.14r19/bin/mpicc' failed with
>     exit status 1
> 
> 
>        ----------------------------------------
>        Failed building wheel for petsc4py
>        Running setup.py clean for petsc4py
>     Failed to build petsc4py
>     Installing collected packages: petsc4py
>        Running setup.py install for petsc4py ... error
>          Complete output from command
>     /home/login/anaconda2/envs/myenv/bin/python -u -c "import
>     setuptools,
>     tokenize;__file__='/tmp/pip-build-v6lDIk/petsc4py/setup.py';f=getattr(tokenize,
>     'open', open)(__file__);code=f.read().replace('\r\n',
>     '\n');f.close();exec(compile(code, __file__, 'exec'))" install
>     --record /tmp/pip-d6NYW8-record/install-record.txt
>     --single-version-externally-managed --compile:
>          running install
>          running build
>          running build_src
>          running build_py
>          creating build
>          creating build/lib.linux-x86_64-2.7
>          creating build/lib.linux-x86_64-2.7/petsc4py
>          copying src/PETSc.py -> build/lib.linux-x86_64-2.7/petsc4py
>          copying src/__init__.py -> build/lib.linux-x86_64-2.7/petsc4py
>          copying src/__main__.py -> build/lib.linux-x86_64-2.7/petsc4py
>          creating build/lib.linux-x86_64-2.7/petsc4py/lib
>          copying src/lib/__init__.py ->
>     build/lib.linux-x86_64-2.7/petsc4py/lib
>          creating build/lib.linux-x86_64-2.7/petsc4py/include
>          creating build/lib.linux-x86_64-2.7/petsc4py/include/petsc4py
>          copying src/include/petsc4py/petsc4py.PETSc.h ->
>     build/lib.linux-x86_64-2.7/petsc4py/include/petsc4py
>          copying src/include/petsc4py/numpy.h ->
>     build/lib.linux-x86_64-2.7/petsc4py/include/petsc4py
>          copying src/include/petsc4py/petsc4py.PETSc_api.h ->
>     build/lib.linux-x86_64-2.7/petsc4py/include/petsc4py
>          copying src/include/petsc4py/petsc4py.h ->
>     build/lib.linux-x86_64-2.7/petsc4py/include/petsc4py
>          copying src/include/petsc4py/petsc4py.i ->
>     build/lib.linux-x86_64-2.7/petsc4py/include/petsc4py
>          copying src/include/petsc4py/__init__.pxd ->
>     build/lib.linux-x86_64-2.7/petsc4py/include/petsc4py
>          copying src/include/petsc4py/PETSc.pxd ->
>     build/lib.linux-x86_64-2.7/petsc4py/include/petsc4py
>          copying src/include/petsc4py/__init__.pyx ->
>     build/lib.linux-x86_64-2.7/petsc4py/include/petsc4py
>          copying src/PETSc.pxd -> build/lib.linux-x86_64-2.7/petsc4py
>          copying src/lib/petsc.cfg ->
>     build/lib.linux-x86_64-2.7/petsc4py/lib
>          running build_ext
>          PETSC_DIR:
>     /home/login/anaconda2/envs/myenv/lib/python2.7/site-packages/petsc
>          PETSC_ARCH:
>          version:      3.8.0 release
>          integer-size: 32-bit
>          scalar-type:  real
>          precision:    double
>          language:     CONLY
>          compiler:     /vendor/sgi/mpt/2.14r19/bin/mpicc
>          linker:       /vendor/sgi/mpt/2.14r19/bin/mpicc
>          building 'PETSc' extension
>          creating build/temp.linux-x86_64-2.7
>          creating build/temp.linux-x86_64-2.7/src
>          /vendor/sgi/mpt/2.14r19/bin/mpicc -pthread -B
>     /home/login/anaconda2/envs/myenv/compiler_compat -fPIC -Wall
>     -Wwrite-strings -Wno-strict-aliasing -Wno-unknown-pragmas
>     -fstack-protector -g -O -fPIC -fno-strict-aliasing -g -O2 -DNDEBUG
>     -g -fwrapv -O3 -Wall
>     -DPETSC_DIR=/home/login/anaconda2/envs/myenv/lib/python2.7/site-packages/petsc
>     -I/home/login/anaconda2/envs/myenv/lib/python2.7/site-packages/petsc/include
>     -Isrc/include
>     -I/home/login/anaconda2/envs/myenv/lib/python2.7/site-packages/numpy/core/include
>     -I/home/login/anaconda2/envs/myenv/include/python2.7 -c src/PETSc.c
>     -o build/temp.linux-x86_64-2.7/src/PETSc.o
>          In file included from
>     /home/login/anaconda2/envs/myenv/lib/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1788:0,
> 
>                           from
>     /home/login/anaconda2/envs/myenv/lib/python2.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:18,
> 
>                           from
>     /home/login/anaconda2/envs/myenv/lib/python2.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,
> 
>                           from src/include/petsc4py/numpy.h:11,
>                           from src/petsc4py.PETSc.c:519,
>                           from src/PETSc.c:3:
> 
>     /home/login/anaconda2/envs/myenv/lib/python2.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2:
>     warning: #warning "Using deprecated NumPy API, disable it by "
>     "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
>           #warning "Using deprecated NumPy API, disable it by " \
>            ^
>          /vendor/sgi/mpt/2.14r19/bin/mpicc -pthread -B
>     /home/login/anaconda2/envs/myenv/compiler_compat -fPIC -Wall
>     -Wwrite-strings -Wno-strict-aliasing -Wno-unknown-pragmas
>     -fstack-protector -g -O -fPIC -fno-strict-aliasing -g -O2 -DNDEBUG
>     -g -fwrapv -O3 -Wall
>     -DPETSC_DIR=/home/login/anaconda2/envs/myenv/lib/python2.7/site-packages/petsc
>     -I/home/login/anaconda2/envs/myenv/lib/python2.7/site-packages/petsc/include
>     -Isrc/include
>     -I/home/login/anaconda2/envs/myenv/lib/python2.7/site-packages/numpy/core/include
>     -I/home/login/anaconda2/envs/myenv/include/python2.7 -c
>     src/libpetsc4py.c -o build/temp.linux-x86_64-2.7/src/libpetsc4py.o
>          /vendor/sgi/mpt/2.14r19/bin/mpicc -pthread -B
>     /home/login/anaconda2/envs/myenv/compiler_compat -fPIC -Wall
>     -Wwrite-strings -Wno-strict-aliasing -Wno-unknown-pragmas
>     -fstack-protector -g -O gcc -pthread -shared -B
>     /home/login/anaconda2/envs/myenv/compiler_compat
>     -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall
>     -L/home/login/anaconda2/envs/myenv/lib
>     -Wl,-rpath=/home/login/anaconda2/envs/myenv/lib -Wl,--no-as-needed
>     -Wl,--sysroot=/ build/temp.linux-x86_64-2.7/src/PETSc.o
>     build/temp.linux-x86_64-2.7/src/libpetsc4py.o
>     -L/home/login/anaconda2/envs/myenv/lib/python2.7/site-packages/petsc/lib
>     -L/home/login/anaconda2/envs/myenv/lib
>     -Wl,-rpath,/home/login/anaconda2/envs/myenv/lib/python2.7/site-packages/petsc/lib
>     -Wl,-rpath,/home/login/anaconda2/envs/myenv/lib -lpetsc -lpython2.7
>     -o build/lib.linux-x86_64-2.7/petsc4py/lib/PETSc.so
>          gcc: error: gcc: No such file or directory
>          error: command '/vendor/sgi/mpt/2.14r19/bin/mpicc' failed with
>     exit status 1
> 
>          ----------------------------------------
>     Command "/home/login/anaconda2/envs/myenv/bin/python -u -c "import
>     setuptools,
>     tokenize;__file__='/tmp/pip-build-v6lDIk/petsc4py/setup.py';f=getattr(tokenize,
>     'open', open)(__file__);code=f.read().replace('\r\n',
>     '\n');f.close();exec(compile(code, __file__, 'exec'))" install
>     --record /tmp/pip-d6NYW8-record/install-record.txt
>     --single-version-externally-managed --compile" failed with error
>     code 1 in /tmp/pip-build-v6lDIk/petsc4py/
> 
> 
>     -- 
>     =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> 
>          Bill Jones W.T.JONES at NASA.GOV <mailto:W.T.JONES at NASA.GOV>
>          Mail Stop 128                     Computational AeroSciences Branch
>          15 Langley Boulevard                           Research Directorate
>          NASA Langley Research Center               Building 1268, Room 1044
>          Hampton, VA  23681-2199                       Phone +1 757
>     864-5318 <tel:%2B1%20757%20864-5318>
>                                                          Fax +1 757
>     864-8816 <tel:%2B1%20757%20864-8816>
>     http://fun3d.larc.nasa.gov
> 
> 
> 
> 
> -- 
> What most experimenters take for granted before they begin their 
> experiments is infinitely more interesting than any results to which 
> their experiments lead.
> -- Norbert Wiener
> 
> https://www.cse.buffalo.edu/~knepley/ <http://www.caam.rice.edu/~mk51/>

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

     Bill Jones                                        W.T.JONES at NASA.GOV
     Mail Stop 128                      Computational AeroSciences Branch
     15 Langley Boulevard                            Research Directorate
     NASA Langley Research Center                Building 1268, Room 1060
     Hampton, VA  23681-2199                        Phone +1 757 864-5318
                                                      Fax +1 757 864-8816
                                               http://fun3d.larc.nasa.gov


More information about the petsc-users mailing list