conda-forge / mpi4py-feedstock

A conda-smithy repository for mpi4py.
BSD 3-Clause "New" or "Revised" License
4 stars 20 forks source link

mpi4py directly accesible but not from dolfinx #61

Closed Staudi14 closed 1 year ago

Staudi14 commented 1 year ago

Solution to issue cannot be found in the documentation.

Issue

I tried to install FeniCS under Linux via conda with the following commands:

conda create -n fenicsx-env
conda activate fenicsx-env
conda install -c conda-forge fenics-dolfinx mpich pyvista

When I tried to load the package with following command:

python -c "import dolfinx"

I got following error:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/staudi/.miniconda3/envs/fenicsx-env/lib/python3.10/site-packages/dolfinx/__init__.py", line 31, in <module>
    from dolfinx import fem, geometry, graph, io, jit, la, log, mesh, nls, plot
  File "/home/staudi/.miniconda3/envs/fenicsx-env/lib/python3.10/site-packages/dolfinx/fem/__init__.py", line 11, in <module>
    from dolfinx.fem import petsc
  File "/home/staudi/.miniconda3/envs/fenicsx-env/lib/python3.10/site-packages/dolfinx/fem/petsc.py", line 25, in <module>
    from dolfinx.fem import assemble
  File "/home/staudi/.miniconda3/envs/fenicsx-env/lib/python3.10/site-packages/dolfinx/fem/assemble.py", line 22, in <module>
    from dolfinx.fem.forms import FormMetaClass, form_types
  File "/home/staudi/.miniconda3/envs/fenicsx-env/lib/python3.10/site-packages/dolfinx/fem/forms.py", line 13, in <module>
    from dolfinx.fem.function import FunctionSpace
  File "/home/staudi/.miniconda3/envs/fenicsx-env/lib/python3.10/site-packages/dolfinx/fem/function.py", line 28, in <module>
    from dolfinx import jit, la
  File "/home/staudi/.miniconda3/envs/fenicsx-env/lib/python3.10/site-packages/dolfinx/jit.py", line 18, in <module>
    from mpi4py import MPI
  File "mpi4py/MPI/MPI.pyx", line 12, in init mpi4py.MPI
  File "mpi4py/MPI/atimport.pxi", line 215, in mpi4py.MPI.initialize
  File "mpi4py/MPI/mpierrhdl.pxi", line 7, in mpi4py.MPI.comm_set_eh
RuntimeError: 805918469

As a side note the RuntimeError number changes everytime I execute the command.

When I try to run

python -c "import mp4py"
python -c "from mpi4py import MPI" 

they run without error mesage. conda_install.log conda_list.log

Installed packages

# packages in environment at /home/staudi/.miniconda3/envs/fenicsx-env:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       2_gnu    conda-forge
aiohttp                   3.8.4           py310h1fa729e_0    conda-forge
aiosignal                 1.3.1              pyhd8ed1ab_0    conda-forge
alsa-lib                  1.2.8                h166bdaf_0    conda-forge
aom                       3.5.0                h27087fc_0    conda-forge
async-timeout             4.0.2              pyhd8ed1ab_0    conda-forge
attr                      2.5.1                h166bdaf_1    conda-forge
attrs                     22.2.0             pyh71513ae_0    conda-forge
binutils_impl_linux-64    2.39                 he00db2b_1    conda-forge
binutils_linux-64         2.39                h5fc0e48_11    conda-forge
blosc                     1.21.3               hafa529b_0    conda-forge
boost-cpp                 1.78.0               h75c5d50_1    conda-forge
brotlipy                  0.7.0           py310h5764c6d_1005    conda-forge
bzip2                     1.0.8                h7f98852_4    conda-forge
c-ares                    1.18.1               h7f98852_0    conda-forge
ca-certificates           2022.12.7            ha878542_0    conda-forge
cairo                     1.16.0            ha61ee94_1014    conda-forge
certifi                   2022.12.7          pyhd8ed1ab_0    conda-forge
cffi                      1.15.1          py310h255011f_3    conda-forge
charset-normalizer        2.1.1              pyhd8ed1ab_0    conda-forge
cryptography              39.0.2          py310h34c0648_0    conda-forge
curl                      7.88.1               hdc1c0ab_0    conda-forge
dbus                      1.13.6               h5008d03_3    conda-forge
double-conversion         3.2.0                h27087fc_1    conda-forge
eigen                     3.4.0                h4bd325d_0    conda-forge
expat                     2.5.0                h27087fc_0    conda-forge
fenics-basix              0.6.0           py310hdf3cbec_0    conda-forge
fenics-dolfinx            0.6.0           py310hf97048e_101    conda-forge
fenics-ffcx               0.6.0              pyh56297ac_0    conda-forge
fenics-libbasix           0.6.0                h1284905_0    conda-forge
fenics-libdolfinx         0.6.0              h4cb9d57_101    conda-forge
fenics-ufcx               0.6.0                h56297ac_0    conda-forge
fenics-ufl                2023.1.1           pyhd8ed1ab_1    conda-forge
ffmpeg                    5.1.2           gpl_h8dda1f0_106    conda-forge
fftw                      3.3.10          mpi_mpich_h3e343da_6    conda-forge
font-ttf-dejavu-sans-mono 2.37                 hab24e00_0    conda-forge
font-ttf-inconsolata      3.000                h77eed37_0    conda-forge
font-ttf-source-code-pro  2.038                h77eed37_0    conda-forge
font-ttf-ubuntu           0.83                 hab24e00_0    conda-forge
fontconfig                2.14.2               h14ed4e7_0    conda-forge
fonts-conda-ecosystem     1                             0    conda-forge
fonts-conda-forge         1                             0    conda-forge
freetype                  2.12.1               hca18f0e_1    conda-forge
frozenlist                1.3.3           py310h5764c6d_0    conda-forge
gcc_impl_linux-64         12.2.0              hcc96c02_19    conda-forge
gcc_linux-64              12.2.0              h4798a0e_11    conda-forge
gettext                   0.21.1               h27087fc_0    conda-forge
gl2ps                     1.4.2                h0708190_0    conda-forge
glew                      2.1.0                h9c3ff4c_2    conda-forge
glib                      2.74.1               h6239696_1    conda-forge
glib-tools                2.74.1               h6239696_1    conda-forge
gmp                       6.2.1                h58526e2_0    conda-forge
gnutls                    3.7.8                hf3e180e_0    conda-forge
graphite2                 1.3.13            h58526e2_1001    conda-forge
gst-plugins-base          1.22.0               h4243ec0_2    conda-forge
gstreamer                 1.22.0               h25f0c4b_2    conda-forge
gstreamer-orc             0.4.33               h166bdaf_0    conda-forge
gxx_impl_linux-64         12.2.0              hcc96c02_19    conda-forge
gxx_linux-64              12.2.0              hb41e900_11    conda-forge
harfbuzz                  6.0.0                h8e241bc_0    conda-forge
hdf4                      4.2.15               h9772cbc_5    conda-forge
hdf5                      1.12.2          mpi_mpich_h5d83325_1    conda-forge
hypre                     2.25.0          mpi_mpich_hed3a557_0    conda-forge
icu                       70.1                 h27087fc_0    conda-forge
idna                      3.4                pyhd8ed1ab_0    conda-forge
imageio                   2.26.0             pyh24c5eb1_0    conda-forge
jack                      1.9.22               h11f4161_0    conda-forge
jpeg                      9e                   h0b41bf4_3    conda-forge
jsoncpp                   1.9.5                h4bd325d_1    conda-forge
kernel-headers_linux-64   2.6.32              he073ed8_15    conda-forge
keyutils                  1.6.1                h166bdaf_0    conda-forge
krb5                      1.20.1               h81ceb04_0    conda-forge
lame                      3.100             h166bdaf_1003    conda-forge
lcms2                     2.15                 hfd0df8a_0    conda-forge
ld_impl_linux-64          2.39                 hcc3a1bd_1    conda-forge
lerc                      4.0.0                h27087fc_0    conda-forge
libadios2                 2.8.3           mpi_mpich_h781bc9b_5    conda-forge
libaec                    1.0.6                hcb278e6_1    conda-forge
libblas                   3.9.0           16_linux64_openblas    conda-forge
libcap                    2.66                 ha37c62d_0    conda-forge
libcblas                  3.9.0           16_linux64_openblas    conda-forge
libclang                  15.0.7          default_had23c3d_1    conda-forge
libclang13                15.0.7          default_h3e3d535_1    conda-forge
libcups                   2.3.3                h36d4200_3    conda-forge
libcurl                   7.88.1               hdc1c0ab_0    conda-forge
libdb                     6.2.32               h9c3ff4c_0    conda-forge
libdeflate                1.17                 h0b41bf4_0    conda-forge
libdrm                    2.4.114              h166bdaf_0    conda-forge
libedit                   3.1.20191231         he28a2e2_2    conda-forge
libev                     4.33                 h516909a_1    conda-forge
libevent                  2.1.10               h28343ad_4    conda-forge
libffi                    3.4.2                h7f98852_5    conda-forge
libflac                   1.4.2                h27087fc_0    conda-forge
libgcc-devel_linux-64     12.2.0              h3b97bd3_19    conda-forge
libgcc-ng                 12.2.0              h65d4601_19    conda-forge
libgcrypt                 1.10.1               h166bdaf_0    conda-forge
libgfortran-ng            12.2.0              h69a702a_19    conda-forge
libgfortran5              12.2.0              h337968e_19    conda-forge
libglib                   2.74.1               h606061b_1    conda-forge
libglu                    9.0.0             he1b5a44_1001    conda-forge
libgomp                   12.2.0              h65d4601_19    conda-forge
libgpg-error              1.46                 h620e276_0    conda-forge
libhwloc                  2.9.0                hd6dc26d_0    conda-forge
libiconv                  1.17                 h166bdaf_0    conda-forge
libidn2                   2.3.4                h166bdaf_0    conda-forge
liblapack                 3.9.0           16_linux64_openblas    conda-forge
libllvm15                 15.0.7               hadd5161_0    conda-forge
libnetcdf                 4.9.1           mpi_mpich_hf10a581_1    conda-forge
libnghttp2                1.52.0               h61bc06f_0    conda-forge
libnsl                    2.0.0                h7f98852_0    conda-forge
libogg                    1.3.4                h7f98852_1    conda-forge
libopenblas               0.3.21          pthreads_h78a6416_3    conda-forge
libopus                   1.3.1                h7f98852_1    conda-forge
libpciaccess              0.17                 h166bdaf_0    conda-forge
libpng                    1.6.39               h753d276_0    conda-forge
libpq                     15.2                 hb675445_0    conda-forge
libsanitizer              12.2.0              h46fd767_19    conda-forge
libsndfile                1.2.0                hb75c966_0    conda-forge
libsodium                 1.0.18               h36c2ea0_1    conda-forge
libsqlite                 3.40.0               h753d276_0    conda-forge
libssh2                   1.10.0               hf14f497_3    conda-forge
libstdcxx-devel_linux-64  12.2.0              h3b97bd3_19    conda-forge
libstdcxx-ng              12.2.0              h46fd767_19    conda-forge
libsystemd0               252                  h2a991cd_0    conda-forge
libtasn1                  4.19.0               h166bdaf_0    conda-forge
libtheora                 1.1.1             h7f98852_1005    conda-forge
libtiff                   4.5.0                h6adf6a1_2    conda-forge
libtool                   2.4.7                h27087fc_0    conda-forge
libudev1                  253                  h0b41bf4_0    conda-forge
libunistring              0.9.10               h7f98852_0    conda-forge
libuuid                   2.32.1            h7f98852_1000    conda-forge
libva                     2.17.0               h0b41bf4_0    conda-forge
libvorbis                 1.3.7                h9c3ff4c_0    conda-forge
libvpx                    1.11.0               h9c3ff4c_3    conda-forge
libwebp-base              1.2.4                h166bdaf_0    conda-forge
libxcb                    1.13              h7f98852_1004    conda-forge
libxkbcommon              1.5.0                h79f4944_0    conda-forge
libxml2                   2.10.3               h7463322_0    conda-forge
libzip                    1.9.2                hc929e4a_1    conda-forge
libzlib                   1.2.13               h166bdaf_4    conda-forge
loguru                    0.6.0           py310hff52083_2    conda-forge
lz4-c                     1.9.4                hcb278e6_0    conda-forge
metis                     5.1.0             h58526e2_1006    conda-forge
mpfr                      4.2.0                hb012696_0    conda-forge
mpg123                    1.31.2               hcb278e6_0    conda-forge
mpi                       1.0                       mpich    conda-forge
mpi4py                    3.1.4           py310h37cc914_0    conda-forge
mpich                     4.0.3              h846660c_100    conda-forge
multidict                 6.0.4           py310h1fa729e_0    conda-forge
mumps-include             5.2.1               ha770c72_11    conda-forge
mumps-mpi                 5.2.1               h7ee95aa_11    conda-forge
mysql-common              8.0.32               ha901b37_0    conda-forge
mysql-libs                8.0.32               hd7da12d_0    conda-forge
ncurses                   6.3                  h27087fc_1    conda-forge
nettle                    3.8.1                hc379101_1    conda-forge
nlohmann_json             3.11.2               h27087fc_0    conda-forge
nspr                      4.35                 h27087fc_0    conda-forge
nss                       3.89                 he45b914_0    conda-forge
numpy                     1.24.2          py310h8deb116_0    conda-forge
openh264                  2.3.1                hcb278e6_2    conda-forge
openjpeg                  2.5.0                hfec8fc6_2    conda-forge
openssl                   3.0.8                h0b41bf4_0    conda-forge
p11-kit                   0.24.1               hc5aa10d_0    conda-forge
packaging                 23.0               pyhd8ed1ab_0    conda-forge
parmetis                  4.0.3             h2a9763c_1005    conda-forge
pcre2                     10.40                hc3806b6_0    conda-forge
petsc                     3.17.4          real_h15390b8_101    conda-forge
petsc4py                  3.17.4          real_hce8fbc3_101    conda-forge
pillow                    9.4.0           py310h023d228_1    conda-forge
pip                       23.0.1             pyhd8ed1ab_0    conda-forge
pixman                    0.40.0               h36c2ea0_0    conda-forge
platformdirs              3.1.0              pyhd8ed1ab_0    conda-forge
pooch                     1.7.0              pyhd8ed1ab_0    conda-forge
proj                      9.1.1                h8ffa02c_2    conda-forge
pthread-stubs             0.4               h36c2ea0_1001    conda-forge
ptscotch                  6.0.9                hb499603_2    conda-forge
pugixml                   1.11.4               h9c3ff4c_0    conda-forge
pulseaudio                16.1                 ha8d29e2_1    conda-forge
pycparser                 2.21               pyhd8ed1ab_0    conda-forge
pyopenssl                 23.0.0             pyhd8ed1ab_0    conda-forge
pysocks                   1.7.1              pyha2e5f31_6    conda-forge
python                    3.10.9          he550d4f_0_cpython    conda-forge
python_abi                3.10                    3_cp310    conda-forge
pyvista                   0.38.3             pyhd8ed1ab_0    conda-forge
qt-main                   5.15.8               h5d23da1_6    conda-forge
readline                  8.1.2                h0f457ee_0    conda-forge
requests                  2.28.2             pyhd8ed1ab_0    conda-forge
scalapack                 2.2.0                hd931219_1    conda-forge
scooby                    0.7.1              pyhd8ed1ab_0    conda-forge
scotch                    6.0.9                hb2e6521_2    conda-forge
setuptools                67.6.0             pyhd8ed1ab_0    conda-forge
slepc                     3.17.2          real_hb19a63e_100    conda-forge
slepc4py                  3.17.2          real_h45d0737_101    conda-forge
snappy                    1.1.10               h9fff704_0    conda-forge
sqlite                    3.40.0               h4ff8645_0    conda-forge
suitesparse               5.10.1               h9e50725_1    conda-forge
superlu                   5.2.2                h00795ac_0    conda-forge
superlu_dist              7.2.0                h25dcc4a_0    conda-forge
svt-av1                   1.4.1                hcb278e6_0    conda-forge
sysroot_linux-64          2.12                he073ed8_15    conda-forge
tbb                       2021.8.0             hf52228f_0    conda-forge
tbb-devel                 2021.8.0             hf52228f_0    conda-forge
tk                        8.6.12               h27826a3_0    conda-forge
typing-extensions         4.5.0                hd8ed1ab_0    conda-forge
typing_extensions         4.5.0              pyha770c72_0    conda-forge
tzdata                    2022g                h191b570_0    conda-forge
urllib3                   1.26.14            pyhd8ed1ab_0    conda-forge
utfcpp                    3.2.3                ha770c72_0    conda-forge
vtk                       9.2.6           qt_py310h8908f42_200    conda-forge
wheel                     0.38.4             pyhd8ed1ab_0    conda-forge
wslink                    1.10.1             pyhd8ed1ab_0    conda-forge
x264                      1!164.3095           h166bdaf_2    conda-forge
x265                      3.5                  h924138e_3    conda-forge
xcb-util                  0.4.0                h166bdaf_0    conda-forge
xcb-util-image            0.4.0                h166bdaf_0    conda-forge
xcb-util-keysyms          0.4.0                h166bdaf_0    conda-forge
xcb-util-renderutil       0.3.9                h166bdaf_0    conda-forge
xcb-util-wm               0.4.1                h166bdaf_0    conda-forge
xorg-fixesproto           5.0               h7f98852_1002    conda-forge
xorg-kbproto              1.0.7             h7f98852_1002    conda-forge
xorg-libice               1.0.10               h7f98852_0    conda-forge
xorg-libsm                1.2.3             hd9c2040_1000    conda-forge
xorg-libx11               1.8.4                h0b41bf4_0    conda-forge
xorg-libxau               1.0.9                h7f98852_0    conda-forge
xorg-libxdmcp             1.1.3                h7f98852_0    conda-forge
xorg-libxext              1.3.4                h0b41bf4_2    conda-forge
xorg-libxfixes            5.0.3             h7f98852_1004    conda-forge
xorg-libxrender           0.9.10            h7f98852_1003    conda-forge
xorg-libxt                1.2.1                h7f98852_2    conda-forge
xorg-renderproto          0.11.1            h7f98852_1002    conda-forge
xorg-xextproto            7.3.0             h0b41bf4_1003    conda-forge
xorg-xproto               7.0.31            h7f98852_1007    conda-forge
xz                        5.2.6                h166bdaf_0    conda-forge
yaml                      0.2.5                h7f98852_2    conda-forge
yarl                      1.8.2           py310h5764c6d_0    conda-forge
zeromq                    4.3.4                h9c3ff4c_1    conda-forge
zfp                       0.5.5                h9c3ff4c_8    conda-forge
zlib                      1.2.13               h166bdaf_4    conda-forge
zstd                      1.5.2                h3eb15da_6    conda-forge

Environment info

active environment : fenicsx-env
    active env location : /home/staudi/.miniconda3/envs/fenicsx-env
            shell level : 2
       user config file : /home/staudi/.condarc
 populated config files :
          conda version : 23.1.0
    conda-build version : not installed
         python version : 3.10.9.final.0
       virtual packages : __archspec=1=x86_64
                          __cuda=12.0=0
                          __glibc=2.37=0
                          __linux=6.2.2=0
                          __unix=0=0
       base environment : /home/staudi/.miniconda3  (writable)
      conda av data dir : /home/staudi/.miniconda3/etc/conda
  conda av metadata url : None
           channel URLs : https://repo.anaconda.com/pkgs/main/linux-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/linux-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /home/staudi/.miniconda3/pkgs
                          /home/staudi/.conda/pkgs
       envs directories : /home/staudi/.miniconda3/envs
                          /home/staudi/.conda/envs
               platform : linux-64
             user-agent : conda/23.1.0 requests/2.28.1 CPython/3.10.9 Linux/6.2.2-arch2-1 arch/rolling glibc/2.37
                UID:GID : 1000:984
             netrc file : None
           offline mode : False
dalcinl commented 1 year ago

Does it it work if you create your env WITHOUT specifying the mpich package?

dalcinl commented 1 year ago

Can you run python -c "import mpi4py; print(mpi4py)" and make sure it is being imported from the proper environment?

dalcinl commented 1 year ago

I cannot reproduce the issue in my workstation.

Staudi14 commented 1 year ago

Thank you. Turns out it loaded from the wrong environment as I had previously used pip for my packages. Is there a way to exclude the pip packages from conda environments or do I have to uninstall it?

dalcinl commented 1 year ago

Is there a way to exclude the pip packages from conda environments or do I have to uninstall it?

As far as I know, you have to uninstall them.

If you use to tinker with your environments, I would recommend you get acquainted with the following two commands

conda env export > environment.yml
conda env create -f environment.yml

That way you can save your environment configuration (name, packages, channels) and recreate it from scratch. Not sure what happens with pip packages, though..