我无法使用pip
在我的Anaconda环境中安装petsc4py
使用conda
安装不起作用,因为它在安装过程中不会检查预定义的PETSC_DIR和PETSC_ARCH环境变量numpy
和cython
已安装
{
我已经安装了ananconda2020.02和python3.7。我的操作系统是Ubuntu 18.04
配置使用
--prefix="/home/$USER/.openmpi" CC=gcc FC=gfortran
然后make
和make install
将.openmpi/bin
文件添加到路径,并将.openmpi/lib
添加到LD_LIBRARY_路径:
export PATH=/home/$USER/.openmpi/bin:$PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/$USER/.openmpi/lib/
配置从{ 然后 根据Iliev在this link in Stack Overflow中对我的问题的回答,我是使用 我使用--no cache dir编写: 构建失败。下一节将显示终端中显示的信息 错误如下所示 (奖金元问题:有没有办法在堆栈溢出的代码围栏中设置自动换行?)./configure
中还指示PETSC_DIR
文件夹位置和PETSC_ARCH
名称。我选择了没有C++编译器的选项。make all
和make check
。我还做了一个make test
,花了很长时间。没有失败,只有成功,跳过去做export
{PETSC_ARCH
(对pets4py
很重要)3) 使用
pip
安装mpi4py
pip
安装的,因为mpi4py
不能在指示自定义mpicc路径时使用conda
安装的4) 尝试使用
pip
安装petsc4py
pip install --no-cache-dir petsc4py
四) 错误
Collecting petsc4py
Downloading petsc4py-3.12.0.tar.gz (1.8 MB)
|████████████████████████████████| 1.8 MB 2.8 MB/s
Requirement already satisfied: numpy in ./anaconda3/lib/python3.7/site-packages (from petsc4py) (1.18.1)
Building wheels for collected packages: petsc4py
Building wheel for petsc4py (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /home/breno/anaconda3/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-5qdqmoex/petsc4py/setup.py'"'"'; __file__='"'"'/tmp/pip-install-5qdqmoex/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/pip-wheel-khk8pv9d
cwd: /tmp/pip-install-5qdqmoex/petsc4py/
Complete output (97 lines):
running bdist_wheel
running build
running build_src
running build_py
creating build
creating build/lib.linux-x86_64-3.7
creating build/lib.linux-x86_64-3.7/petsc4py
copying src/PETSc.py -> build/lib.linux-x86_64-3.7/petsc4py
copying src/__init__.py -> build/lib.linux-x86_64-3.7/petsc4py
copying src/__main__.py -> build/lib.linux-x86_64-3.7/petsc4py
creating build/lib.linux-x86_64-3.7/petsc4py/lib
copying src/lib/__init__.py -> build/lib.linux-x86_64-3.7/petsc4py/lib
creating build/lib.linux-x86_64-3.7/petsc4py/include
creating build/lib.linux-x86_64-3.7/petsc4py/include/petsc4py
copying src/include/petsc4py/petsc4py.PETSc_api.h -> build/lib.linux-x86_64-3.7/petsc4py/include/petsc4py
copying src/include/petsc4py/petsc4py.h -> build/lib.linux-x86_64-3.7/petsc4py/include/petsc4py
copying src/include/petsc4py/petsc4py.PETSc.h -> build/lib.linux-x86_64-3.7/petsc4py/include/petsc4py
copying src/include/petsc4py/numpy.h -> build/lib.linux-x86_64-3.7/petsc4py/include/petsc4py
copying src/include/petsc4py/petsc4py.i -> build/lib.linux-x86_64-3.7/petsc4py/include/petsc4py
copying src/include/petsc4py/PETSc.pxd -> build/lib.linux-x86_64-3.7/petsc4py/include/petsc4py
copying src/include/petsc4py/__init__.pxd -> build/lib.linux-x86_64-3.7/petsc4py/include/petsc4py
copying src/include/petsc4py/__init__.pyx -> build/lib.linux-x86_64-3.7/petsc4py/include/petsc4py
copying src/PETSc.pxd -> build/lib.linux-x86_64-3.7/petsc4py
copying src/lib/petsc.cfg -> build/lib.linux-x86_64-3.7/petsc4py/lib
running build_ext
PETSC_DIR: /home/breno/Documents/petsc
PETSC_ARCH: MUMPS-mkl-real-opt
version: 3.13.0 release
integer-size: 32-bit
scalar-type: real
precision: double
language: CONLY
compiler: /home/breno/.openmpi/bin/mpicc
linker: /home/breno/.openmpi/bin/mpicc
building 'PETSc' extension
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/MUMPS-mkl-real-opt
creating build/temp.linux-x86_64-3.7/MUMPS-mkl-real-opt/src
/home/breno/.openmpi/bin/mpicc -pthread -B /home/breno/anaconda3/compiler_compat -Wl,--sysroot=/ -fPIC -Wall -Wwrite-strings -Wno-strict-aliasing -Wno-unknown-pragmas -fstack-protector -O2 -march=native -mtune=native -fPIC -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -I/home/breno/Documents/petsc/MUMPS-mkl-real-opt/include -I/home/breno/Documents/petsc/include -Isrc/include -I/home/breno/anaconda3/lib/python3.7/site-packages/numpy/core/include -I/home/breno/anaconda3/include/python3.7m -c src/PETSc.c -o build/temp.linux-x86_64-3.7/MUMPS-mkl-real-opt/src/PETSc.o
In file included from src/PETSc.c:4:0:
src/petsc4py.PETSc.c: In function ‘__pyx_pf_8petsc4py_5PETSc_3Sys_28infoAllow’:
src/petsc4py.PETSc.c:65427:47: error: too many arguments to function ‘PetscInfoAllow’
__pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscInfoAllow(__pyx_v_tval, NULL)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(27, 163, __pyx_L1_error)
^~~~~~~~~~~~~~
In file included from /home/breno/Documents/petsc/include/petscsys.h:1474:0,
from /home/breno/Documents/petsc/include/petscbag.h:4,
from /home/breno/Documents/petsc/include/petsc.h:5,
from src/petsc4py.PETSc.c:596,
from src/PETSc.c:4:
/home/breno/Documents/petsc/include/petsclog.h:56:29: note: declared here
PETSC_EXTERN PetscErrorCode PetscInfoAllow(PetscBool);
^~~~~~~~~~~~~~
In file included from src/PETSc.c:4:0:
src/petsc4py.PETSc.c: In function ‘__pyx_pf_8petsc4py_5PETSc_3Mat_304matMultSymbolic’:
src/petsc4py.PETSc.c:148044:47: warning: implicit declaration of function ‘MatMatMultSymbolic’; did you mean ‘MatProductSymbolic’? [-Wimplicit-function-declaration]
__pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatMatMultSymbolic(__pyx_v_self->mat, __pyx_v_mat->mat, __pyx_v_rval, (&__pyx_v_result->mat))); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(36, 1309, __pyx_L1_error)
^~~~~~~~~~~~~~~~~~
MatProductSymbolic
src/petsc4py.PETSc.c: In function ‘__pyx_pf_8petsc4py_5PETSc_3Mat_306matMultNumeric’:
src/petsc4py.PETSc.c:148235:47: warning: implicit declaration of function ‘MatMatMultNumeric’; did you mean ‘MatProductNumeric’? [-Wimplicit-function-declaration]
__pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatMatMultNumeric(__pyx_v_self->mat, __pyx_v_mat->mat, __pyx_v_result->mat)); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(36, 1317, __pyx_L1_error)
^~~~~~~~~~~~~~~~~
MatProductNumeric
src/petsc4py.PETSc.c: In function ‘__pyx_pf_8petsc4py_5PETSc_6DMStag_54get1DCoordinateLocationSlot’:
src/petsc4py.PETSc.c:265960:3: warning: ‘DMStagGet1dCoordinateLocationSlot’ is deprecated [-Wdeprecated-declarations]
__pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMStagGet1dCoordinateLocationSlot(__pyx_v_self->__pyx_base.dm, __pyx_v_sloc, (&__pyx_v_slot))); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(47, 274, __pyx_L1_error)
^~~~~~~~~
In file included from /home/breno/Documents/petsc/include/petsc.h:22:0,
from src/petsc4py.PETSc.c:596,
from src/PETSc.c:4:
/home/breno/Documents/petsc/include/petscdmstag.h:127:130: note: declared here
PETSC_DEPRECATED_FUNCTION("Use DMStagGetProductCoordinateLocationSlot() (since version 3.13") PETSC_STATIC_INLINE PetscErrorCode DMStagGet1dCoordinateLocationSlot(DM dm,DMStagStencilLocation loc,PetscInt *s) {return DMStagGetProductCoordinateLocationSlot(dm,loc,s);}
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/PETSc.c:4:0:
src/petsc4py.PETSc.c: In function ‘__pyx_pymod_exec_PETSc’:
src/petsc4py.PETSc.c:309773:43: error: ‘MATLMVMBRDN’ undeclared (first use in this function); did you mean ‘MATLMVMBROYDEN’?
__pyx_t_7 = __pyx_f_8petsc4py_5PETSc_S_(MATLMVMBRDN); if (unlikely(!__pyx_t_7)) __PYX_ERR(36, 78, __pyx_L1_error)
^~~~~~~~~~~
MATLMVMBROYDEN
src/petsc4py.PETSc.c:309773:43: note: each undeclared identifier is reported only once for each function it appears in
src/petsc4py.PETSc.c:309785:43: error: ‘MATLMVMBADBRDN’ undeclared (first use in this function); did you mean ‘MATLMVMBRDN’?
__pyx_t_7 = __pyx_f_8petsc4py_5PETSc_S_(MATLMVMBADBRDN); if (unlikely(!__pyx_t_7)) __PYX_ERR(36, 79, __pyx_L1_error)
^~~~~~~~~~~~~~
MATLMVMBRDN
src/petsc4py.PETSc.c:309797:43: error: ‘MATLMVMSYMBRDN’ undeclared (first use in this function); did you mean ‘MATLMVMBADBRDN’?
__pyx_t_7 = __pyx_f_8petsc4py_5PETSc_S_(MATLMVMSYMBRDN); if (unlikely(!__pyx_t_7)) __PYX_ERR(36, 80, __pyx_L1_error)
^~~~~~~~~~~~~~
MATLMVMBADBRDN
src/petsc4py.PETSc.c:309809:43: error: ‘MATLMVMSYMBADBRDN’ undeclared (first use in this function); did you mean ‘MATLMVMSYMBRDN’?
__pyx_t_7 = __pyx_f_8petsc4py_5PETSc_S_(MATLMVMSYMBADBRDN); if (unlikely(!__pyx_t_7)) __PYX_ERR(36, 81, __pyx_L1_error)
^~~~~~~~~~~~~~~~~
MATLMVMSYMBRDN
src/petsc4py.PETSc.c:309821:43: error: ‘MATLMVMDIAGBRDN’ undeclared (first use in this function); did you mean ‘MATLMVMBADBRDN’?
__pyx_t_7 = __pyx_f_8petsc4py_5PETSc_S_(MATLMVMDIAGBRDN); if (unlikely(!__pyx_t_7)) __PYX_ERR(36, 82, __pyx_L1_error)
^~~~~~~~~~~~~~~
MATLMVMBADBRDN
error: command '/home/breno/.openmpi/bin/mpicc' failed with exit status 1
----------------------------------------
ERROR: 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
ERROR: Command errored out with exit status 1:
command: /home/breno/anaconda3/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-5qdqmoex/petsc4py/setup.py'"'"'; __file__='"'"'/tmp/pip-install-5qdqmoex/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-record-_npojm20/install-record.txt --single-version-externally-managed --compile --install-headers /home/breno/anaconda3/include/python3.7m/petsc4py
cwd: /tmp/pip-install-5qdqmoex/petsc4py/
Complete output (97 lines):
running install
running build
running build_src
running build_py
creating build
creating build/lib.linux-x86_64-3.7
creating build/lib.linux-x86_64-3.7/petsc4py
copying src/PETSc.py -> build/lib.linux-x86_64-3.7/petsc4py
copying src/__init__.py -> build/lib.linux-x86_64-3.7/petsc4py
copying src/__main__.py -> build/lib.linux-x86_64-3.7/petsc4py
creating build/lib.linux-x86_64-3.7/petsc4py/lib
copying src/lib/__init__.py -> build/lib.linux-x86_64-3.7/petsc4py/lib
creating build/lib.linux-x86_64-3.7/petsc4py/include
creating build/lib.linux-x86_64-3.7/petsc4py/include/petsc4py
copying src/include/petsc4py/petsc4py.PETSc_api.h -> build/lib.linux-x86_64-3.7/petsc4py/include/petsc4py
copying src/include/petsc4py/petsc4py.h -> build/lib.linux-x86_64-3.7/petsc4py/include/petsc4py
copying src/include/petsc4py/petsc4py.PETSc.h -> build/lib.linux-x86_64-3.7/petsc4py/include/petsc4py
copying src/include/petsc4py/numpy.h -> build/lib.linux-x86_64-3.7/petsc4py/include/petsc4py
copying src/include/petsc4py/petsc4py.i -> build/lib.linux-x86_64-3.7/petsc4py/include/petsc4py
copying src/include/petsc4py/PETSc.pxd -> build/lib.linux-x86_64-3.7/petsc4py/include/petsc4py
copying src/include/petsc4py/__init__.pxd -> build/lib.linux-x86_64-3.7/petsc4py/include/petsc4py
copying src/include/petsc4py/__init__.pyx -> build/lib.linux-x86_64-3.7/petsc4py/include/petsc4py
copying src/PETSc.pxd -> build/lib.linux-x86_64-3.7/petsc4py
copying src/lib/petsc.cfg -> build/lib.linux-x86_64-3.7/petsc4py/lib
running build_ext
PETSC_DIR: /home/breno/Documents/petsc
PETSC_ARCH: MUMPS-mkl-real-opt
version: 3.13.0 release
integer-size: 32-bit
scalar-type: real
precision: double
language: CONLY
compiler: /home/breno/.openmpi/bin/mpicc
linker: /home/breno/.openmpi/bin/mpicc
building 'PETSc' extension
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/MUMPS-mkl-real-opt
creating build/temp.linux-x86_64-3.7/MUMPS-mkl-real-opt/src
/home/breno/.openmpi/bin/mpicc -pthread -B /home/breno/anaconda3/compiler_compat -Wl,--sysroot=/ -fPIC -Wall -Wwrite-strings -Wno-strict-aliasing -Wno-unknown-pragmas -fstack-protector -O2 -march=native -mtune=native -fPIC -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -I/home/breno/Documents/petsc/MUMPS-mkl-real-opt/include -I/home/breno/Documents/petsc/include -Isrc/include -I/home/breno/anaconda3/lib/python3.7/site-packages/numpy/core/include -I/home/breno/anaconda3/include/python3.7m -c src/PETSc.c -o build/temp.linux-x86_64-3.7/MUMPS-mkl-real-opt/src/PETSc.o
In file included from src/PETSc.c:4:0:
src/petsc4py.PETSc.c: In function ‘__pyx_pf_8petsc4py_5PETSc_3Sys_28infoAllow’:
src/petsc4py.PETSc.c:65427:47: error: too many arguments to function ‘PetscInfoAllow’
__pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscInfoAllow(__pyx_v_tval, NULL)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(27, 163, __pyx_L1_error)
^~~~~~~~~~~~~~
In file included from /home/breno/Documents/petsc/include/petscsys.h:1474:0,
from /home/breno/Documents/petsc/include/petscbag.h:4,
from /home/breno/Documents/petsc/include/petsc.h:5,
from src/petsc4py.PETSc.c:596,
from src/PETSc.c:4:
/home/breno/Documents/petsc/include/petsclog.h:56:29: note: declared here
PETSC_EXTERN PetscErrorCode PetscInfoAllow(PetscBool);
^~~~~~~~~~~~~~
In file included from src/PETSc.c:4:0:
src/petsc4py.PETSc.c: In function ‘__pyx_pf_8petsc4py_5PETSc_3Mat_304matMultSymbolic’:
src/petsc4py.PETSc.c:148044:47: warning: implicit declaration of function ‘MatMatMultSymbolic’; did you mean ‘MatProductSymbolic’? [-Wimplicit-function-declaration]
__pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatMatMultSymbolic(__pyx_v_self->mat, __pyx_v_mat->mat, __pyx_v_rval, (&__pyx_v_result->mat))); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(36, 1309, __pyx_L1_error)
^~~~~~~~~~~~~~~~~~
MatProductSymbolic
src/petsc4py.PETSc.c: In function ‘__pyx_pf_8petsc4py_5PETSc_3Mat_306matMultNumeric’:
src/petsc4py.PETSc.c:148235:47: warning: implicit declaration of function ‘MatMatMultNumeric’; did you mean ‘MatProductNumeric’? [-Wimplicit-function-declaration]
__pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatMatMultNumeric(__pyx_v_self->mat, __pyx_v_mat->mat, __pyx_v_result->mat)); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(36, 1317, __pyx_L1_error)
^~~~~~~~~~~~~~~~~
MatProductNumeric
src/petsc4py.PETSc.c: In function ‘__pyx_pf_8petsc4py_5PETSc_6DMStag_54get1DCoordinateLocationSlot’:
src/petsc4py.PETSc.c:265960:3: warning: ‘DMStagGet1dCoordinateLocationSlot’ is deprecated [-Wdeprecated-declarations]
__pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMStagGet1dCoordinateLocationSlot(__pyx_v_self->__pyx_base.dm, __pyx_v_sloc, (&__pyx_v_slot))); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(47, 274, __pyx_L1_error)
^~~~~~~~~
In file included from /home/breno/Documents/petsc/include/petsc.h:22:0,
from src/petsc4py.PETSc.c:596,
from src/PETSc.c:4:
/home/breno/Documents/petsc/include/petscdmstag.h:127:130: note: declared here
PETSC_DEPRECATED_FUNCTION("Use DMStagGetProductCoordinateLocationSlot() (since version 3.13") PETSC_STATIC_INLINE PetscErrorCode DMStagGet1dCoordinateLocationSlot(DM dm,DMStagStencilLocation loc,PetscInt *s) {return DMStagGetProductCoordinateLocationSlot(dm,loc,s);}
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/PETSc.c:4:0:
src/petsc4py.PETSc.c: In function ‘__pyx_pymod_exec_PETSc’:
src/petsc4py.PETSc.c:309773:43: error: ‘MATLMVMBRDN’ undeclared (first use in this function); did you mean ‘MATLMVMBROYDEN’?
__pyx_t_7 = __pyx_f_8petsc4py_5PETSc_S_(MATLMVMBRDN); if (unlikely(!__pyx_t_7)) __PYX_ERR(36, 78, __pyx_L1_error)
^~~~~~~~~~~
MATLMVMBROYDEN
src/petsc4py.PETSc.c:309773:43: note: each undeclared identifier is reported only once for each function it appears in
src/petsc4py.PETSc.c:309785:43: error: ‘MATLMVMBADBRDN’ undeclared (first use in this function); did you mean ‘MATLMVMBRDN’?
__pyx_t_7 = __pyx_f_8petsc4py_5PETSc_S_(MATLMVMBADBRDN); if (unlikely(!__pyx_t_7)) __PYX_ERR(36, 79, __pyx_L1_error)
^~~~~~~~~~~~~~
MATLMVMBRDN
src/petsc4py.PETSc.c:309797:43: error: ‘MATLMVMSYMBRDN’ undeclared (first use in this function); did you mean ‘MATLMVMBADBRDN’?
__pyx_t_7 = __pyx_f_8petsc4py_5PETSc_S_(MATLMVMSYMBRDN); if (unlikely(!__pyx_t_7)) __PYX_ERR(36, 80, __pyx_L1_error)
^~~~~~~~~~~~~~
MATLMVMBADBRDN
src/petsc4py.PETSc.c:309809:43: error: ‘MATLMVMSYMBADBRDN’ undeclared (first use in this function); did you mean ‘MATLMVMSYMBRDN’?
__pyx_t_7 = __pyx_f_8petsc4py_5PETSc_S_(MATLMVMSYMBADBRDN); if (unlikely(!__pyx_t_7)) __PYX_ERR(36, 81, __pyx_L1_error)
^~~~~~~~~~~~~~~~~
MATLMVMSYMBRDN
src/petsc4py.PETSc.c:309821:43: error: ‘MATLMVMDIAGBRDN’ undeclared (first use in this function); did you mean ‘MATLMVMBADBRDN’?
__pyx_t_7 = __pyx_f_8petsc4py_5PETSc_S_(MATLMVMDIAGBRDN); if (unlikely(!__pyx_t_7)) __PYX_ERR(36, 82, __pyx_L1_error)
^~~~~~~~~~~~~~~
MATLMVMBADBRDN
error: command '/home/breno/.openmpi/bin/mpicc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /home/breno/anaconda3/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-5qdqmoex/petsc4py/setup.py'"'"'; __file__='"'"'/tmp/pip-install-5qdqmoex/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-record-_npojm20/install-record.txt --single-version-externally-managed --compile --install-headers /home/breno/anaconda3/include/python3.7m/petsc4py Check the logs for full command output.
我试图用当时最新发布的版本3.12.0安装
petsc4py
,同时安装并配置了PETSc版本3.13.0。这个现在似乎很明显是行不通的,但在documentation中没有明确提到这一点您可以使用
pip install https://bitbucket.org/petsc/petsc4py/issues/137/error-installing-in-anaconda-environment
安装未发布的版本,也可以等待正式发布重要结论
确保您的PETSc版本与
petsc4py
相同相关问题 更多 >
编程相关推荐