Anaconda Installation of Fenics and Mshr

Thank you for your suggestion but slepc is installed I just checked with conda list
slepc 3.11.2 h1ce4c84_1 conda-forge
slepc4py 3.11.0 py37hc459697_0 conda-forge

By noticing that the error message could not load libslepc.3.12 I I installed slepc 3.12and everything works now.

So the cure is simply to conda install -n fenicsproject -c conda-forge slepc=3.12
replacing fenicsproject by your fenics environement name

1 Like

Hello,

I have the same error, even with slepc 3.12:

ImportError: generic_type: type “CSGGeometry” referenced unknown base type “dolfin::Variable”

conda list
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       1_gnu    conda-forge
backcall                  0.2.0                      py_0  
binutils_impl_linux-64    2.34                 h53a641e_7    conda-forge
binutils_linux-64         2.34                hc952b39_20    conda-forge
boost-cpp                 1.72.0               h7b93d67_2    conda-forge
bzip2                     1.0.8                h516909a_2    conda-forge
c-ares                    1.16.1               h516909a_0    conda-forge
ca-certificates           2020.6.20            hecda079_0    conda-forge
certifi                   2020.6.20        py38h32f6830_0    conda-forge
cloudpickle               1.5.0                      py_0  
cmake                     3.18.0               h5c55442_0    conda-forge
cycler                    0.10.0                     py_2    conda-forge
decorator                 4.4.2                      py_0  
eigen                     3.3.7             hc9558a2_1001    conda-forge
expat                     2.2.9                he1b5a44_2    conda-forge
fastcache                 1.1.0            py38h1e0a361_1    conda-forge
fenics                    2019.1.0        py38h32f6830_10    conda-forge
fenics-dijitso            2019.1.0                  py_10    conda-forge
fenics-dolfin             2019.1.0        py38hd3deb98_10    conda-forge
fenics-ffc                2019.1.0                  py_10    conda-forge
fenics-fiat               2019.1.0                  py_10    conda-forge
fenics-libdolfin          2019.1.0            h8f7d7a8_10    conda-forge
fenics-ufl                2019.1.0                  py_10    conda-forge
freetype                  2.10.2               he06d7ca_0    conda-forge
gcc_impl_linux-64         7.5.0                hd420e75_6    conda-forge
gcc_linux-64              7.5.0               h09487f9_20    conda-forge
gmp                       6.2.0                he1b5a44_2    conda-forge
gmpy2                     2.1.0b1          py38h04dde30_0    conda-forge
gxx_impl_linux-64         7.5.0                hdf63c60_6    conda-forge
gxx_linux-64              7.5.0               h09487f9_20    conda-forge
hdf5                      1.10.6          mpi_mpich_ha7d0aea_1    conda-forge
hypre                     2.18.2               hc98498a_1    conda-forge
icu                       67.1                 he1b5a44_0    conda-forge
ipykernel                 5.3.4            py38h5ca1d4c_0  
ipython                   7.16.1           py38h5ca1d4c_0  
ipython_genutils          0.2.0                    py38_0  
jedi                      0.17.0                   py38_0  
jpeg                      9d                   h516909a_0    conda-forge
jupyter_client            6.1.6                      py_0  
jupyter_core              4.6.3                    py38_0  
kiwisolver                1.2.0            py38hbf85e49_0    conda-forge
krb5                      1.17.1               hfafb76e_2    conda-forge
lcms2                     2.11                 hbd6801e_0    conda-forge
ld_impl_linux-64          2.34                 h53a641e_7    conda-forge
libblas                   3.8.0               17_openblas    conda-forge
libcblas                  3.8.0               17_openblas    conda-forge
libcurl                   7.71.1               hcdd3856_4    conda-forge
libedit                   3.1.20191231         h46ee950_1    conda-forge
libev                     4.33                 h516909a_0    conda-forge
libffi                    3.2.1             he1b5a44_1007    conda-forge
libgcc-ng                 9.3.0               h24d8f2e_14    conda-forge
libgfortran-ng            7.5.0               hdf63c60_14    conda-forge
libgomp                   9.3.0               h24d8f2e_14    conda-forge
liblapack                 3.8.0               17_openblas    conda-forge
libnghttp2                1.41.0               hab1572f_1    conda-forge
libopenblas               0.3.10          pthreads_hb3c22a3_4    conda-forge
libpng                    1.6.37               hed695b0_2    conda-forge
libsodium                 1.0.18               h7b6447c_0  
libssh2                   1.9.0                hab1572f_5    conda-forge
libstdcxx-ng              9.3.0               hdf63c60_14    conda-forge
libtiff                   4.1.0                hc7e4089_6    conda-forge
libuv                     1.38.0               h516909a_0    conda-forge
libwebp-base              1.1.0                h516909a_3    conda-forge
lz4-c                     1.9.2                he1b5a44_1    conda-forge
matplotlib                3.3.0                         1    conda-forge
matplotlib-base           3.3.0            py38h91b0d89_1    conda-forge
metis                     5.1.0             he1b5a44_1005    conda-forge
mpc                       1.1.0             h04dde30_1009    conda-forge
mpfr                      4.0.2                he80fd80_1    conda-forge
mpi                       1.0                       mpich    conda-forge
mpi4py                    3.0.3            py38h4a80816_1    conda-forge
mpich                     3.3.2                hc856adb_0    conda-forge
mpmath                    1.1.0                      py_0    conda-forge
mshr                      2019.1.0         py38hf9f41d3_3    conda-forge
mumps-include             5.2.1                         6    conda-forge
mumps-mpi                 5.2.1                h645f208_6    conda-forge
ncurses                   6.2                  he1b5a44_1    conda-forge
numpy                     1.19.1           py38h8854b6b_0    conda-forge
olefile                   0.46                       py_0    conda-forge
openssl                   1.1.1g               h516909a_1    conda-forge
parmetis                  4.0.3             h9f7b9cf_1005    conda-forge
parso                     0.8.0                      py_0  
petsc                     3.12.4               h432f2ec_0    conda-forge
petsc4py                  3.12.0           py38h30bdb2a_4    conda-forge
pexpect                   4.8.0                    py38_0  
pickleshare               0.7.5                 py38_1000  
pillow                    7.2.0            py38h9776b28_1    conda-forge
pip                       20.2.2                     py_0    conda-forge
pkg-config                0.29.2            h516909a_1006    conda-forge
pkgconfig                 1.4.0            py38h32f6830_0    conda-forge
prompt-toolkit            3.0.5                      py_0  
ptscotch                  6.0.8                he9f2703_1    conda-forge
ptyprocess                0.6.0                    py38_0  
pybind11                  2.5.0            py38hbf85e49_0    conda-forge
pygments                  2.6.1                      py_0  
pyparsing                 2.4.7              pyh9f0ad1d_0    conda-forge
python                    3.8.5           h4d41432_2_cpython    conda-forge
python-dateutil           2.8.1                      py_0  
python_abi                3.8                      1_cp38    conda-forge
pyzmq                     19.0.1           py38he6710b0_1  
readline                  8.0                  he28a2e2_2    conda-forge
rhash                     1.3.6             h14c3975_1001    conda-forge
scalapack                 2.0.2             hfacbc1e_1008    conda-forge
scotch                    6.0.8                h0eec0ba_1    conda-forge
setuptools                49.6.0           py38h32f6830_0    conda-forge
six                       1.15.0             pyh9f0ad1d_0    conda-forge
slepc                     3.12.2               h76dbdef_0    conda-forge
slepc4py                  3.12.0           py38hb2ee469_1    conda-forge
spyder-kernels            1.9.2                    py38_0  
sqlite                    3.32.3               h4cf870e_1    conda-forge
suitesparse               5.6.0                h717dc36_0    conda-forge
superlu                   5.2.1             hfe2efc7_1207    conda-forge
superlu_dist              6.2.0                h5e15a89_2    conda-forge
sympy                     1.6.2            py38h32f6830_0    conda-forge
tbb                       2020.1               hc9558a2_0    conda-forge
tk                        8.6.10               hed695b0_0    conda-forge
tornado                   6.0.4            py38h7b6447c_1  
traitlets                 4.3.3                    py38_0  
wcwidth                   0.2.5                      py_0  
wheel                     0.34.2                     py_1    conda-forge
wurlitzer                 2.0.1                    py38_0  
xz                        5.2.5                h516909a_1    conda-forge
zeromq                    4.3.2                he6710b0_2  
zlib                      1.2.11            h516909a_1007    conda-forge

Sorry for answering so late. Back from vacations.

May be install the latest version of slepc 3.13 instead of 3.12?

From your conda list, some of your packages are more recent than mine.

I provide below the output of conda list on my machine (MacOS 10.14.5), just in case.

conda list

#packages in environment at /anaconda3/envs/fenicsproject:

#Name Version Build Channel
appnope 0.1.0 py37_0
attrs 19.2.0 py_0
autopep8 1.5.2 pypi_0 pypi
backcall 0.1.0 py37_0
blas 2.14 openblas conda-forge
bleach 3.1.0 py37_0
boost-cpp 1.72.0 hdf9ef73_0 conda-forge
bzip2 1.0.8 h01d97ff_1 conda-forge
ca-certificates 2020.4.5.1 hecc5488_0 conda-forge
certifi 2020.4.5.1 py37hc8dfbb8_0 conda-forge
cmake 3.15.4 h6c18c4b_0 conda-forge
curl 7.65.3 h22ea746_0 conda-forge
cycler 0.10.0 py37_0
decorator 4.4.0 py37_1
defusedxml 0.6.0 py_0
eigen 3.3.7 h04f5b5a_1000 conda-forge
entrypoints 0.3 py37_0
expat 2.2.5 h6de7cb9_1003 conda-forge
fastcache 1.1.0 py37h01d97ff_0 conda-forge
fenics 2019.1.0 py37_9 conda-forge
fenics-dijitso 2019.1.0 py_7 conda-forge
fenics-dolfin 2019.1.0 py37hb0736e2_9 conda-forge
fenics-ffc 2019.1.0 py_7 conda-forge
fenics-fiat 2019.1.0 py_7 conda-forge
fenics-libdolfin 2019.1.0 hb974ea8_9 conda-forge
fenics-ufl 2019.1.0 py_7 conda-forge
freetype 2.9.1 hb4e5f40_0
gmp 6.2.0 h4a8c4bd_2 conda-forge
gmpy2 2.1.0b1 py37h1744cca_0 conda-forge
hdf5 1.10.5 mpi_mpich_h3734b49_1004 conda-forge
hypre 2.18.2 hc9ba2bc_1 conda-forge
icu 64.2 h6de7cb9_1 conda-forge
ipykernel 5.1.2 py37h39e3cac_0
ipython 7.8.0 py37h39e3cac_0
ipython_genutils 0.2.0 py37_0
jedi 0.15.1 py37_0
jinja2 2.10.3 py_0
jsonschema 3.0.2 py37_0
jupyter_client 5.3.4 py37_0
jupyter_contrib_core 0.3.3 py_2 conda-forge
jupyter_contrib_nbextensions 0.5.1 py37_0 conda-forge
jupyter_core 4.6.0 py37_0
jupyter_highlight_selected_word 0.2.0 py37_1000 conda-forge
jupyter_latex_envs 1.4.4 py37_1000 conda-forge
jupyter_nbextensions_configurator 0.4.1 py37_0 conda-forge
kiwisolver 1.1.0 py37h0a44026_0
krb5 1.16.3 hcfa6398_1001 conda-forge
libblas 3.8.0 14_openblas conda-forge
libcblas 3.8.0 14_openblas conda-forge
libcurl 7.65.3 h16faf7d_0 conda-forge
libcxx 10.0.0 h1af66ff_2 conda-forge
libcxxabi 4.0.1 hcfea43d_1 conda-forge
libedit 3.1.20170329 hcfe32e1_1001 conda-forge
libffi 3.2.1 h6de7cb9_1006 conda-forge
libgfortran 4.0.0 2 conda-forge
libiconv 1.15 h01d97ff_1005 conda-forge
liblapack 3.8.0 14_openblas conda-forge
liblapacke 3.8.0 14_openblas conda-forge
libopenblas 0.3.7 h4bb4525_2 conda-forge
libpng 1.6.37 ha441bb4_0
libsodium 1.0.16 h3efe00b_0
libssh2 1.8.2 hcdc9a53_2 conda-forge
libuv 1.32.0 h01d97ff_0 conda-forge
libxml2 2.9.10 h53d96d6_0 conda-forge
libxslt 1.1.33 h320ff13_0 conda-forge
llvm-openmp 9.0.0 h40edb58_0 conda-forge
lxml 4.5.1 py37heb1707f_0 conda-forge
markupsafe 1.1.1 py37h1de35cc_0
matplotlib 3.1.1 py37h54f8f79_0
metis 5.1.0 h6de7cb9_1004 conda-forge
mistune 0.8.4 py37h1de35cc_0
mpc 1.1.0 h3aece09_1006 conda-forge
mpfr 4.0.2 h44b798e_0 conda-forge
mpi 1.0 mpich conda-forge
mpi4py 3.0.3 py37h88507a1_1 conda-forge
mpich 3.3.2 hc856adb_0 conda-forge
mpmath 1.1.0 py_0 conda-forge
mshr 2019.1.0 py37h8c59516_3 conda-forge
mumps-include 5.2.1 6 conda-forge
mumps-mpi 5.2.1 hcf7f05f_6 conda-forge
nbconvert 5.6.0 py37_1
nbformat 4.4.0 py37_0
ncurses 6.1 h0a44026_1002 conda-forge
notebook 6.0.1 py37_0
numpy 1.16.4 py37h6b0580a_0 conda-forge
openssl 1.1.1g h0b31af3_0 conda-forge
pandoc 2.2.3.2 0
pandocfilters 1.4.2 py37_1
parmetis 4.0.3 hbc1d92b_1005 conda-forge
parso 0.5.1 py_0
petsc 3.12.4 h6ceeb6d_0 conda-forge
petsc4py 3.12.0 py37h833b260_4 conda-forge
pexpect 4.7.0 py37_0
pickleshare 0.7.5 py37_0
pip 19.3 py37_0 conda-forge
pkg-config 0.29.2 h112b980_1005 conda-forge
pkgconfig 1.3.1 py37_1001 conda-forge
prometheus_client 0.7.1 py_0
prompt_toolkit 2.0.10 py_0
ptscotch 6.0.8 h8c5ff5d_1 conda-forge
ptyprocess 0.6.0 py37_0
pybind11 2.4.3 py37ha1cc60f_3 conda-forge
pycodestyle 2.6.0 pypi_0 pypi
pygments 2.4.2 py_0
pyparsing 2.4.2 py_0
pyrsistent 0.15.4 py37h1de35cc_0
python 3.7.3 h93065d6_1 conda-forge
python-dateutil 2.8.0 py37_0
python_abi 3.7 1_cp37m conda-forge
pytz 2019.3 py_0
pyyaml 5.3.1 py37h9bfed18_0 conda-forge
pyzmq 18.1.0 py37h0a44026_0
readline 8.0 hcfe32e1_0 conda-forge
rhash 1.3.6 h1de35cc_1001 conda-forge
scalapack 2.0.2 h4fb7227_1008 conda-forge
scotch 6.0.8 h01cae8c_0 conda-forge
send2trash 1.5.0 py37_0
setuptools 41.4.0 py37_0 conda-forge
six 1.12.0 py37_1000 conda-forge
slepc 3.12.2 hefb7033_0 conda-forge
slepc4py 3.12.0 py37h00bfe04_1 conda-forge
sqlite 3.30.1 h93121df_0 conda-forge
suitesparse 5.6.0 h0e59142_0 conda-forge
superlu 5.2.1 hc209f47_1207 conda-forge
superlu_dist 6.2.0 h32cdba5_1 conda-forge
sympy 1.4 py37_0 conda-forge
tbb 2019.9 ha1b3eb9_0 conda-forge
terminado 0.8.2 py37_0
testpath 0.4.2 py37_0
tk 8.6.9 h2573ce8_1003 conda-forge
tornado 6.0.3 py37h1de35cc_0
traitlets 4.3.3 py37_0
wcwidth 0.1.7 py37_0
webencodings 0.5.1 py37_1
wheel 0.33.6 py37_0 conda-forge
xz 5.2.4 h1de35cc_1001 conda-forge
yaml 0.2.4 h0b31af3_0 conda-forge
zeromq 4.3.1 h0a44026_3
zlib 1.2.11 h0b31af3_1006 conda-forge

As far as I can tell, this error happens when the mshr library is out-of-sync with the dolfin library. This might happen, for instance, if the dolfin package is updated or rebuilt, but the mshr package was not rebuilt against the new dolfin.

Looks like @azerad’s package versions are now self-consistent with each other.

Dear,

I redid the installations of both fenics and mshr this week and the problem still persists!

I can’t update slepc to version 3.13

i use mac os.

Hello,

I wanted to stay with the 2019 version of fenics, so I tried several builds of mshr 2019.1.0 available on conda-forge. The second newest build worked for me. I created a new Conda environment with

conda create -n fenicstest -c conda-forge mshr=2019.1.0=py38h2af9582_2

(the correct version of fenics is installed automatically because of dependencies) and in this environment the ImportError disappeared.

The build id py38h2af9582_2 above is for the macOS version, you can get the build ids of all available builds for your system via:

conda search mshr -c conda-forge

Maybe this works for you too…

Best regards
Martin

10 Likes

Dear Martin,

Thank you so much, it worked!

I had already resolved installing the Docker Toolbox on the mac. But I prefer to use anaconda.

Hi,

Thank you! This also worked for me. I’m using

conda install -c conda-forge fenics mshr=2019.1.0=py38h255090a_2

on Ubuntu 18.04.

2 Likes

Howdy Martin @MartinLenz !
I stumbled upon the fact that an install of FEniCS doesn’t necessarily mean that you get everything needed to run tutorial code (specifically matplotlib and mshr), I saw your point about available builds:

I was wondering, for an existing environment called “fenicsproject”, if you just ran
conda install -n fenicsproject -c conda-forge mshr=2019.1.0
would if default to the last build listed?

my command output (using your search) ends like this:

mshr                        2018.1.0 py37he34de0a_1000  conda-forge         
mshr                        2019.1.0  py36h06b137e_4  conda-forge         
mshr                        2019.1.0  py36h255090a_1  conda-forge         
mshr                        2019.1.0  py36h255090a_2  conda-forge         
mshr                        2019.1.0  py36h7596e34_0  conda-forge         
mshr                        2019.1.0 py36h7596e34_1000  conda-forge         
mshr                        2019.1.0  py36hf9f41d3_3  conda-forge         
mshr                        2019.1.0  py36hfbbf7d5_4  conda-forge         
mshr                        2019.1.0  py37h1d6ddcb_4  conda-forge         
mshr                        2019.1.0  py37h255090a_1  conda-forge         
mshr                        2019.1.0  py37h255090a_2  conda-forge         
mshr                        2019.1.0  py37h4852d89_4  conda-forge         
mshr                        2019.1.0  py37h7596e34_0  conda-forge         
mshr                        2019.1.0 py37h7596e34_1000  conda-forge         
mshr                        2019.1.0  py37hf9f41d3_3  conda-forge         
mshr                        2019.1.0  py38h0c8dbc2_4  conda-forge         
mshr                        2019.1.0  py38h255090a_2  conda-forge         
mshr                        2019.1.0  py38hbaebfaf_4  conda-forge         
mshr                        2019.1.0  py38hf9f41d3_3  conda-forge         
mshr                        2019.1.0  py39h889d849_4  conda-forge         
mshr                        2019.1.0  py39h9761ab4_4  conda-forge         

I am using Ubuntu 20.04, so I see the same build that @BenjaminRueth used, and I am using FEniCS 2019.1.0, so I know from this thread that I need mshr 2019.1.0 to match, but I don’t know where to go to find out the difference between these builds.
Any thoughts on which build I should use are most welcome!

Do you need to use conda on an Ubuntu system? Have you considered using the PPA, https://launchpad.net/~fenics-packages/+archive/ubuntu/fenics?

I’m an engineer, so I like using Spyder as my IDE to debug and quickly run the code to see if the syntax is tracking (just going through tutorial codes you can find all sorts of buggy behavior and outdated syntax), without having to use a text editor and then execute the file in the terminal.
Even so, it appears that the PPA would have to separately install pieces (like mshr and matplotlib).

So, it’s back to “do we have to specify the build?” and if so, “how do we find out the difference between builds?”
I’ve been looking at the documentation here, but I’m not finding answers about what’s different

well, no,

sudo apt-get install fenics

True, you’d need to install matplotlib separately. In that case,

sudo apt-get install fenics python3-matplotlib
1 Like

Then that just begs the question of why mshr would be included in the apt-get but not in the

conda install -c conda-forge fenics

:woman_shrugging:t2:

But I still need to know if

conda install -n fenicsproject -c conda-forge mshr=2019.1.0

would default to the last build or if I need to somehow find out what the build differences are and specify a particular one, e.g.

conda install -n fenicsproject -c conda-forge mshr=2019.1.0=py38h255090a_2

As the fenics project is an open source project, it is dependent on people maintaining instructions. As no of the main developers has limited experience with conda, it has not been prioritized.

Any contributions to the conda packages are welcome.

@dparsons has been kind and maintained the fenics apt-packages.

I would like to note that mshr is no longer maintained, it is now recommended to use external meshing software, see: How i can make geometry and mesh in my program? - #2 by dokken for a list of suggested mesh generators.

Thanks Jorgen @dokken,

It appears on cursory views that these external meshing software do not have the pre-defined shapes that mshr had. Plus, one of my co-workers recommended meshio, which is not directly mentioned in the comparison.

How non-functional is mshr? Essentially, is it still sufficient for most FE problems (or at least the tutorial codes) to install the last build of mshr for my machine (? I’m fairly certain it is py39h9761ab4_4 but I still don’t know where to look for the info on what is different between builds)?

I am just starting to use FEniCS, so I am totally willing to help update the conda documentation for getting a functional install.

Meshio is not a meshing tool, but a mesh converter (between a large variety of formats).

Mshr works with its current functionality, but there is no one maintaining it. This means that if you find bugs the likelyhood of anyone fixing them is quite slim. I do not know much about the different mshr versions on conda, as I stopped using it many years ago.

So, even if I do get a working version of mshr, I will need to install meshio (conda install -c conda-forge meshio) and probably an overall external meshing program (like pygmsh) for future work. Okay.

At any rate, Where do I go to find out the differences between the builds for the various modules?

As mshr creates dolfin meshes, you do not need meshio. But it is needed for any other external meshing software.

If you are talking about the conda module builds, I honestly do not know, maybe @sebastkm knows, as he used conda.

Dear Kristin,

just a quick remark from my side: I only had to specify the build in conda, because the default build did not work. Just importing anything from mshr caused the ImportErrors listed above.

I think the build problem was fixed recently. When I tried to create a fresh conda environment with fenics and mshr (for python 3.7) today, it just worked without specifying any version or build id.

Best regards
Martin (L)

1 Like

My mshr does work, I installed with just using mshr and not specifying anything with an =… so I agree, the build problem must have been fixed, a big “thanks” to whomever did that!!!