Errors in calling `from fenics import *`

Hello, everyone,

I use the macOS Mojave (10.14.5) system, and install the Anaconda.

Then I install the Fenics by
conda create -n fenicsproject -c conda-forge fenics.

Finally, I install the Fenics successfully.

And I do source activate fenicsproject, then in the Python 3.7.3 environment, when I call from fenics import *, I get the following errors:

(fenicsproject) MacBookPro:~ xxx$ python
Python 3.7.3 | packaged by conda-forge | (default, Jul  1 2019, 14:38:56) 
[Clang 4.0.1 (tags/RELEASE_401/final)] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.

>>> from fenics import *
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Applications/anaconda3/envs/fenicsproject/lib/python3.7/site-packages/fenics/__init__.py", line 7, in <module>
    from dolfin import *
  File "/Applications/anaconda3/envs/fenicsproject/lib/python3.7/site-packages/dolfin/__init__.py", line 34, in <module>
    from .cpp import __version__
ImportError: dlopen(/Applications/anaconda3/envs/fenicsproject/lib/python3.7/site-packages/dolfin/cpp.cpython-37m-darwin.so, 2): Library not loaded: @rpath/libdmumps-5.1.2.dylib
  Referenced from: /Applications/anaconda3/envs/fenicsproject/lib/libpetsc.3.11.dylib
  Reason: image not found

Thanks.

Try this:

conda create -n fenics2018 -c conda-forge fenics=2018

This worked for me (macOS Mojave 10.14.6), what did not work was fenics=2019. You can also try fenics=2017 but then I would suggest using

conda create -n fenics2017 -c conda-forge fenics=2017 scipy matplotlib=2.2.3 python=3.5 mpi4py sympy=1.1.1

Actually, I use:

conda create -n fenics2018 -c conda-forge fenics=2018 matplotlib scipy python=3.7 sympy spyder jupyter

and if you also want spyder and jupyter, then I had to reset spyder (the first time I opened spyder it crashed and said that I have to reset it. Then it worked). For jupyter I also had to install nb_conda:

conda install nb_conda

Hope this works for you.

edit: I also tried to launch Anaconda, changed the environment there and selected Spyder, this did not work for me. Uninstalled everything and installed miniconda

Note from the Changelog of 2018.1.0

Removed from fenics import * , use from dolfin import *

Removed from fenics import * , use from dolfin import *

This change was reverted since it was too disruptive. You can see in yoczhang’s output that fenics import calls dolfin import. The problem seems to be the mumps library. @yoczhang, check your installation of mumps 5.1.2.

Yes, I have installed mumps 5.1.2. But it has the above-mentioned errors.

Ok, thanks, I will try this.