Problem about installing mgis.fenics Python module

maybe the wrong project interpreter used in pycharm?

Are you sure that launching ubuntu.exe reads your .bashrc file. Would you try to run a python script which displays your PYTHONPATH and LD_LIBRARY_PATH ? Something like:

 C:\Users\Danie\AppData\Local\Microsoft\WindowsApps\ubuntu.exe run "export PYTHONUNBUFFERED=1 && export PYTHONIOENCODING=UTF-8 && export \"PYTHONPATH=/mnt/c/Users/Danie/OneDrive/桌面/PhaseField_fracture:/mnt/c/Program Files/JetBrains/PyCharm 2020.1/plugins/python/helpers/pycharm_matplotlib_backend:/mnt/c/Program Files/JetBrains/PyCharm 2020.1/plugins/python/helpers/pycharm_display\" && export PYCHARM_HOSTED=1 && export PYCHARM_DISPLAY_PORT=63342 && cd /mnt/c/Users/Danie/OneDrive/桌面/PhaseField_fracture && /usr/bin/python3 -c 'import os; print(os.environ["LD_LIBRARY_PATH"])'

i run a python script in the same path, it is work

C:\Users\Danie\AppData\Local\Microsoft\WindowsApps\ubuntu.exe run "export PYTHONUNBUFFERED=1 && export PYTHONIOENCODING=UTF-8 && export \"PYTHONPATH=/mnt/c/Users/Danie/OneDrive/桌面/PhaseField_fracture:/mnt/c/Program Files/JetBrains/PyCharm 2020.1/plugins/python/helpers/pycharm_matplotlib_backend:/mnt/c/Program Files/JetBrains/PyCharm 2020.1/plugins/python/helpers/pycharm_display\" && export PYCHARM_HOSTED=1 && export PYCHARM_DISPLAY_PORT=63342 && cd /mnt/c/Users/Danie/OneDrive/桌面/PhaseField_fracture && /usr/bin/python3 /mnt/c/Users/Danie/OneDrive/桌面/PhaseField_fracture/PhaseFieldFGM.py"
0.0015024395985989722
Solving linear variational problem.

Process finished with exit code -1

Conclusion ? Have we solved the trouble ?

:pensive: unfortunately, pycharm still can not identify mgis package. when i run script without mgis, everthing is ok. actually, i am not good at compute science and just a civil engineering student. so, could you recommend a platform which i can run fenics/mfront on? really thank you for helping me figure out this error.

This part of your command explicitly set the PYTHONPATH variable

export “PYTHONPATH=/mnt/c/Users/Danie/OneDrive/桌面/PhaseField_fracture:/mnt/c/Program Files/JetBrains/PyCharm 2020.1/plugins/python/helpers/pycharm_matplotlib_backend:/mnt/c/Program Files/JetBrains/PyCharm 2020.1/plugins/python/helpers/pycharm_display”

Let us try one more trick. Would you try to explicitly add ‘/usr/ocal/lib/python3.6/site-packages/mgis’ to this list ?

You mean I add this path to .bashrc file as PYTHONPATH?
I did this and check it.

zhiyi@DESKTOP-9ME6CPV:~$ python3
Python 3.6.9 (default, Nov  7 2019, 10:44:02)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
['', '/home/zhiyi', '/usr/local/lib/python3.6/site-packages', '/usr/local/lib/python3.6/site-packages/mgis', '/usr/lib/python36.zip', '/usr/lib/python3.6', '/usr/lib/python3.6/lib-dynload', '/home/zhiyi/.local/lib/python3.6/site-packages', '/usr/local/lib/python3.6/dist-packages', '/usr/lib/python3/dist-packages']
>>>

but error still exist

No. When you launch your command ubuntue.exe, you see that there is and export PYTHONPATH=.... The idea is to modify this part

To answer your question, I use ubuntu and the fenics ppa. I use the system compilers and boost libraries to build TFEL/MFront and MGIS and everything works fine.

add it but still cannot run.

zhiyi@DESKTOP-9ME6CPV:~$ ubuntu.exe
zhiyi@DESKTOP-9ME6CPV:~$ export PYTHONPATH=/usr/ocal/lib/python3.6/site-packages/mgis

build ubuntu on windows or totally build ubuntu system?

Hi Daniel,
@thelfer offers his help live here https://meet.jit.si/mgis.fencis for your problem.
You can contact him in the next 15min.

2 Likes

hi thelfer, could you share the link of tfel-3.4.0?
very appreciate for your live guide! much help for a beginner in fenics/mfront :grinning:

The github repo is here: https://github.com/thelfer/tfel

seems the latest version on Github is only 3.3.0.
The demo “phase field approach for brittle fracture” could need 3.4.0-dev version

TFEL-3.4.0 does not exist yet. It is the name of the future version.

For the mgis.fenics, you have to take the current development version, callled 3.4.0-dev.

You can get it on github as follows:

git clone https://github.com/thelfer/tfel

Then, you can compile it with the same commands that you used for compiling TFEL-3.3 (cmake, make, make install)

1 Like

thanks! after updating tfel version, I can successfully run the phase field for fracture model! really appreciate for your and t.helfer’s help!

That’s great. Do not hesitate to make feebacks and comments !

Hello all, I did all the same thing as Daniel and also taken the 3.4.0-dev by
git clone https://github.com/thelfer/tfel

However, I still get the import error after running python3 -c “import mgis” as
Traceback (most recent call last):
File “”, line 1, in
File “/usr/local/lib/python3.6/site-packages/mgis/init.py”, line 1, in
from ._mgis import *
ImportError: dynamic module does not define module export function (PyInit__mgis)

Besides, the following line has been found in my case.

Any suggestions? Thank you very much in advance!

Hello everyone,

I would like to install, on ubuntu 18.04, the mgis.fenics module (I installed fenics 2017) to run the example phase field code with mfront.

I am at the cloning stage:
git clone https://github.com/thelfer/tfel,

Could someone help me with the command lines I need to continue the installation?
Thank you in advance.

Hoping for a favorable result, I wish you an excellent day.

Hi, you can follow the installation guidelines on how to compile tfel and mgis from source (see also the first post of this thread).

Alternatively you can try using spack

spack install tfel@master

spack install mgis@master

spack load tfel@master mgis
1 Like