Problem about installing mgis.fenics Python module

hi, everyone, i want to use mgis.fenics python module.
I have done the following steps to install “MFrontGenericInterfaceSupport”
1 unzip field in C:/MFrontGenericInterfaceSupport (field from this website)
2 type cd /mnt/c/MFrontGenericInterfaceSupport on terminal windows
3 type cmake .
4 type cmake
5 type make
6 type make check
7 type make install

but after completing above steps, pycharm can not still identify mgis.fenics. i don’t know which step i wrongly make or lost.

I have found in the “INSTALL-cmake.md” field, there are 2 options could be related but i do not know in which step i should use them.

  • enable-python-bindings : compiles the Python bindings. This requires the Boost/Python library to be available (default=OFF)
  • enable-fenics-bindings : compiles the FEniCS bindings. Those bindings are experimental and very limited. To use MGIS with FEniCS , usage of the Python bindings are encouraged.

My OS is win10 and install ubuntu on it.

Thanks in advance

Hi, you need to indeed activate the python bindings which contain the mgis.fenics module with

cmake -Denable-python-bindings=ON

The FEniCS bindings were an attempt using the C++ interface.

You should also have libboost_python installed before compiling MGIS.

You may also want to specify the python version associated with FEniCS if you have different versions installed using in the cmake command an additional -DPython_ADDITIONAL_VERSIONS=3.6 for instance for Python 3.6

Hi, bleyerj. after runing cmake -Denable-python-bindings=ON and cmake -Denable-fenics-bindings=ON in step4. Pycharm can not still identify mgis.
when installing this package, the terminal windows return the following details (just parts and sorry for uploading so many, i really do not know what mistakes happen.

step3: type cmake .

zhiyi@DESKTOP-9ME6CPV:/mnt/c/MFrontGenericInterfaceSupport-master$ cmake .
– found python 3.6.9
– python include path /usr/include/python3.6m
– python libraries path /usr/lib/x86_64-linux-gnu
– python library python3.6m
– python interpreter /usr/bin/python3.6
– Trying to find libboost_python-py36
– Could NOT find Boost: missing: python-py36 (found /usr/local/lib/cmake/Boost-1.72.0/BoostConfig.cmake (found suitable version “1.72.0”, minimum required is “1.36.0”))
– Trying to find libboost_python36
– Boost library python found (Boost::python).
– python bindings support enabled
– enabling flag ‘Wno-conversion’
– enabling flag ‘Wall’

– enabling flag ‘fno-fast-math’
– enabling flag ‘ffast-math’
unknown option --python-version
Valid options are:
–all : request flags for all librairies.
–compiler-flags : return tfel recommended compiler flags.
–cppflags : return preprocessor flags.
–cxx-standard : print the version of the C++ standard used to compile TFEL.
–exceptions : request flags for TFELException.
–glossary : request flags for TFELGlossary.
–help : print this help message.
–include-path : return the path to the TFEL headers.
–includes : return tfel include path.
–ldflags : return linking flags.
–library-dependency: return the dependencies of a TFEL library.
–library-path : return the path to the TFEL library.
–libs : return linking flags.
–licence : print tfel licences.
–major-number : print tfel major version.
–material : request flags for TFELMaterial.
–math : request flags for TFELMath.
–math-cubic-spline: request flags for TFELMathCubicSpline.
–math-kriging : request flags for TFELMathKriging.
–math-parser : request flags for TFELMathParser.
–mfront-profiling: request flags for libMFrontProfiling.
–minor-number : print tfel minor version.
–numodis : request flags for TFELNUMODIS.
–oflags : return tfel recommended optimisation flags with architecture specific flags.
–oflags0 : return tfel recommended optimisation flags without architecture specific flags.
–oflags2 : return some aggressive optimisation flags, possibly at the expense of numerical precision. This shall be added to --oflags results.
–physical-constants: request flags for TFELPhysicalConstants.
–revision-number : print tfel revision version.
–system : request flags for TFELSystem.
–tests : request flags for TFELTests.
–unicode-support : request flags for TFELUnicodeSupport.
–utilities : request flags for TFELUtilities.
–version : print tfel version and svn revision.
–warning : return tfel recommended warnings.
– no tfel python bindings
– tfel version : 3.3.0
– tfel C++ standard : 11
– mfront : /usr/local/bin/mfront
– tfel-config : /usr/local/bin/tfel-config
– tfel-check : /usr/local/bin/tfel-check
– tfel include : /usr/local/include
– tfel libs : /usr/local/lib
– TFELTests : /usr/local/lib/libTFELTests.so
– TFELTests : /usr/local/lib/libTFELTests.so
– TFELException : /usr/local/lib/libTFELException.so
– TFELUtilities : /usr/local/lib/libTFELUtilities.so
– TFELMath : /usr/local/lib/libTFELMath.so
– TFELMaterial : /usr/local/lib/libTFELMaterial.so
– TFELPhysicalConstants : /usr/local/lib/libTFELPhysicalConstants.so
– doxygen documentation is not enabled
– Enabling generation of documentation based on jupyter-nbconvert
– jupyter-nbconvert: /home/zhiyi/.local/bin/jupyter-nbconvert
– Adding library : BehaviourTest (src/StandardElastoViscoPlasticityPlasticityTest11.cxx;src/StandardElastoViscoPlasticityPlasticityTest11-generic.cxx;src/FiniteStrainSingleCrystal.cxx;src/FiniteStrainSingleCrystal-generic.cxx;src/ParameterTest.cxx;src/ParameterTest-generic.cxx;src/BoundsCheckTest.cxx;src/BoundsCheckTest-generic.cxx;src/Gurson.cxx;src/Gurson-generic.cxx;src/Plasticity.cxx;src/Plasticity-generic.cxx;src/Norton.cxx;src/Norton-generic.cxx;src/Elasticity.cxx;src/Elasticity-generic.cxx)
– Configuring done
– Generating done
– Build files have been written to: /mnt/c/MFrontGenericInterfaceSupport-master

step4: type cmake -DPython_ADDITIONAL_VERSIONS=3.6 and cmake -Denable-python-bindings=ON and cmake -Denable-fenics-bindings=ON

zhiyi@DESKTOP-9ME6CPV:/mnt/c/MFrontGenericInterfaceSupport-master$ cmake -DPython_ADDITIONAL_VERSIONS=3.6
CMake Warning:
No source or binary directory provided. Both will be assumed to be the
same as the current working directory, but note that this warning will
become a fatal error in future CMake releases.

– found python 3.6.9
– python include path /usr/include/python3.6m
– python libraries path /usr/lib/x86_64-linux-gnu
– python library python3.6m
– python interpreter /usr/bin/python3.6
– Trying to find libboost_python-py36
– Could NOT find Boost: missing: python-py36 (found /usr/local/lib/cmake/Boost-1.72.0/BoostConfig.cmake (found suitable version “1.72.0”, minimum required is “1.36.0”))
– Trying to find libboost_python36
– Boost library python found (Boost::python).
– python bindings support enabled
– enabling flag ‘Wno-conversion’
– enabling flag ‘Wall’
zhiyi@DESKTOP-9ME6CPV:/mnt/c/MFrontGenericInterfaceSupport-master$ cmake -Denable-python-bindings=ON
CMake Warning:
No source or binary directory provided. Both will be assumed to be the
same as the current working directory, but note that this warning will
become a fatal error in future CMake releases.

– found python 3.6.9
– python include path /usr/include/python3.6m
– python libraries path /usr/lib/x86_64-linux-gnu
– python library python3.6m
– python interpreter /usr/bin/python3.6
– Trying to find libboost_python-py36
– Could NOT find Boost: missing: python-py36 (found /usr/local/lib/cmake/Boost-1.72.0/BoostConfig.cmake (found suitable version “1.72.0”, minimum required is “1.36.0”))
– Trying to find libboost_python36
– Boost library python found (Boost::python).
– python bindings support enabled
– enabling flag ‘Wno-conversion’
– enabling flag ‘Wall’
zhiyi@DESKTOP-9ME6CPV:/mnt/c/MFrontGenericInterfaceSupport-master$ cmake -Denable-fenics-bindings=ON
CMake Warning:
No source or binary directory provided. Both will be assumed to be the
same as the current working directory, but note that this warning will
become a fatal error in future CMake releases.

– found python 3.6.9
– python include path /usr/include/python3.6m
– python libraries path /usr/lib/x86_64-linux-gnu
– python library python3.6m
– python interpreter /usr/bin/python3.6
– Trying to find libboost_python-py36
– Could NOT find Boost: missing: python-py36 (found /usr/local/lib/cmake/Boost-1.72.0/BoostConfig.cmake (found suitable version “1.72.0”, minimum required is “1.36.0”))
– Trying to find libboost_python36
– Boost library python found (Boost::python).
– Found PkgConfig: /usr/bin/pkg-config (found version “0.29.1”)
– Checking for one of the modules ‘craypetsc_real;PETSc’
– Looking for sys/types.h
– Looking for sys/types.h - found
– Looking for stdint.h
– Looking for stdint.h - found
– Looking for stddef.h
– Looking for stddef.h - found
– Check size of PetscInt
– Check size of PetscInt - done
– Checking for one of the modules ‘crayslepc_real;SLEPc’
– python bindings support enabled
– FEniCS bindings support enabled
– enabling flag ‘Wno-conversion’
– enabling flag ‘Wall’

step5:type make

zhiyi@DESKTOP-9ME6CPV:/mnt/c/MFrontGenericInterfaceSupport-master$ make
[ 2%] Building CXX object src/CMakeFiles/MFrontGenericInterface.dir/ThreadPool.cxx.o
[ 5%] Building CXX object src/CMakeFiles/MFrontGenericInterface.dir/ThreadedTaskResult.cxx.o
[ 8%] Building CXX object src/CMakeFiles/MFrontGenericInterface.dir/LibrariesManager.cxx.o
[ 10%] Building CXX object src/CMakeFiles/MFrontGenericInterface.dir/Markdown.cxx.o
/mnt/c/MFrontGenericInterfaceSupport-master/src/Markdown.cxx: In function ‘std::__cxx11::string mgis::utilities::get_heading_signs(mgis::size_type)’:
/mnt/c/MFrontGenericInterfaceSupport-master/src/Markdown.cxx:21:57: warning: unused parameter ‘l’ [-Wunused-parameter]
std::string get_heading_signs(const mgis::size_type l) {
^
[ 13%] Building CXX object src/CMakeFiles/MFrontGenericInterface.dir/MatrixView.cxx.o
[ 16%] Building CXX object src/CMakeFiles/MFrontGenericInterface.dir/Variable.cxx.o
[ 18%] Building CXX object src/CMakeFiles/MFrontGenericInterface.dir/Hypothesis.cxx.o
[ 21%] Building CXX object src/CMakeFiles/MFrontGenericInterface.dir/Behaviour.cxx.o
/mnt/c/MFrontGenericInterfaceSupport-master/src/Behaviour.cxx: In lambda function:
/mnt/c/MFrontGenericInterfaceSupport-master/src/Behaviour.cxx:190:7: warning: control reaches end of non-void function [-Wreturn-type]
}();
^
/mnt/c/MFrontGenericInterfaceSupport-master/src/Behaviour.cxx: In lambda function:
/mnt/c/MFrontGenericInterfaceSupport-master/src/Behaviour.cxx:222:7: warning: control reaches end of non-void function [-Wreturn-type]
}();
^
[ 24%] Building CXX object src/CMakeFiles/MFrontGenericInterface.dir/ChangeBasis.cxx.o

[ 75%] Linking CXX shared module behaviour.so
[ 75%] Built target py_mgis_behaviour
[ 78%] Building CXX object bindings/python/src/CMakeFiles/py_mgis.dir/mgis-module.cxx.o
[ 81%] Building CXX object bindings/python/src/CMakeFiles/py_mgis.dir/ThreadPool.cxx.o
[ 81%] Linking CXX shared module _mgis.so
[ 81%] Built target py_mgis
Scanning dependencies of target MFrontGenericInterface-FEniCS
[ 83%] Building CXX object bindings/fenics/src/CMakeFiles/MFrontGenericInterface-FEniCS.dir/Utils.cxx.o
[ 86%] Building CXX object bindings/fenics/src/CMakeFiles/MFrontGenericInterface-FEniCS.dir/NonLinearMaterial.cxx.o
cc1plus: warning: this condition has identical branches [-Wduplicated-branches]
cc1plus: warning: this condition has identical branches [-Wduplicated-branches]
cc1plus: warning: this condition has identical branches [-Wduplicated-branches]
cc1plus: warning: this condition has identical branches [-Wduplicated-branches]
cc1plus: warning: this condition has identical branches [-Wduplicated-branches]
cc1plus: warning: this condition has identical branches [-Wduplicated-branches]
cc1plus: warning: this condition has identical branches [-Wduplicated-branches]
cc1plus: warning: this condition has identical branches [-Wduplicated-branches]
cc1plus: warning: this condition has identical branches [-Wduplicated-branches]
/usr/include/eigen3/Eigen/src/Core/Matrix.h:178:7: required from ‘class Eigen::Matrix<double, -1, 1>’
/usr/include/dolfin/function/GenericFunction.h:82:49: required from here
cc1plus: warning: this condition has identical branches [-Wduplicated-branches]
cc1plus: warning: this condition has identical branches [-Wduplicated-branches]
[100%] Linking CXX shared library libMFrontGenericInterface-FEniCS.so
[100%] Built target MFrontGenericInterface-FEniCS

step6: make check

zhiyi@DESKTOP-9ME6CPV:/mnt/c/MFrontGenericInterfaceSupport-master$ make check
[ 0%] Generating MGISSmallStrainFormulation3D.cpp, MGISSmallStrainFormulation3D.h
[ 1%] Generating MGISSmallStrainFormulation2D.cpp, MGISSmallStrainFormulation2D.h
Scanning dependencies of target MFrontGenericInterfaceFEniCSTestingUtilities
[ 2%] Building CXX object bindings/fenics/tests/src/CMakeFiles/MFrontGenericInterfaceFEniCSTestingUtilities.dir/FEniCSTestingUtilities.cxx.o
cc1plus: warning: this condition has identical branches [-Wduplicated-branches]
cc1plus: warning: this condition has identical branches [-Wduplicated-branches]
cc1plus: warning: this condition has identical branches [-Wduplicated-branches]
cc1plus: warning: this condition has identical branches [-Wduplicated-branches]
cc1plus: warning: this condition has identical branches [-Wduplicated-branches]
cc1plus: warning: this condition has identical branches [-Wduplicated-branches]
cc1plus: warning: this condition has identical branches [-Wduplicated-branches]

step7: sudo make install

zhiyi@DESKTOP-9ME6CPV:/mnt/c/MFrontGenericInterfaceSupport-master$ sudo make install
[ 40%] Built target MFrontGenericInterface
[ 75%] Built target py_mgis_behaviour
[ 81%] Built target py_mgis
[100%] Built target MFrontGenericInterface-FEniCS
Install the project…
– Install configuration: “”
– Up-to-date: /usr/local/share/doc/mgis/web/css
– Up-to-date: /usr/local/share/doc/mgis/web/css/main.css
– Up-to-date: /usr/local/share/doc/mgis/web/css/normalize.css
– Up-to-date: /usr/local/share/doc/mgis/web/css/slideshow.css
– Up-to-date: /usr/local/share/doc/mgis/web/img
– Up-to-date: /usr/local/share/doc/mgis/web/img/finite_strain_plasticity_solution.png
– Up-to-date: /usr/local/share/doc/mgis/web/img/fuel_rod_solution.png
– Up-to-date: /usr/local/share/doc/mgis/web/img/multiphase_kinematics.svg
– Up-to-date: /usr/local/share/doc/mgis/web/img/phase_change_law.svg
– Up-to-date: /usr/local/share/doc/mgis/web/img/solidification_front.gif
– Up-to-date: /usr/local/share/doc/mgis/web/img/Temperature_Castem_FEniCS.png
– Up-to-date: /usr/local/include/MGIS/Config-c.h
– Up-to-date: /usr/local/include/MGIS/Config.hxx
– Up-to-date: /usr/local/include/MGIS/Cste.hxx
– Up-to-date: /usr/local/include/MGIS/MatrixView.hxx
– Up-to-date: /usr/local/include/MGIS/MatrixView.ixx
– Up-to-date: /usr/local/include/MGIS/Raise.ixx
– Up-to-date: /usr/local/include/MGIS/Raise.hxx
– Up-to-date: /usr/local/include/MGIS/Span.hxx
– Up-to-date: /usr/local/include/MGIS/StringView.hxx
– Up-to-date: /usr/local/include/MGIS/StringView.ixx
– Up-to-date: /usr/local/include/MGIS/Variant.hxx
– Up-to-date: /usr/local/include/MGIS/ThreadPool.hxx
– Up-to-date: /usr/local/include/MGIS/ThreadPool.ixx
– Up-to-date: /usr/local/include/MGIS/ThreadedTaskResult.hxx
– Up-to-date: /usr/local/include/MGIS/ThreadedTaskResult.ixx
– Up-to-date: /usr/local/include/MGIS/Utilities/Markdown.hxx
– Up-to-date: /usr/local/include/MGIS/LibrariesManager.hxx
– Up-to-date: /usr/local/include/MGIS/Behaviour/Hypothesis.hxx
– Up-to-date: /usr/local/include/MGIS/Behaviour/Variable.hxx
– Up-to-date: /usr/local/include/MGIS/Behaviour/BehaviourFctPtr.hxx
– Up-to-date: /usr/local/include/MGIS/Behaviour/Behaviour.hxx
– Up-to-date: /usr/local/include/MGIS/Behaviour/ChangeBasis.hxx
– Up-to-date: /usr/local/include/MGIS/Behaviour/StateView.hxx
– Up-to-date: /usr/local/include/MGIS/Behaviour/StateView.hxx
– Up-to-date: /usr/local/include/MGIS/Behaviour/BehaviourData.hxx
– Up-to-date: /usr/local/include/MGIS/Behaviour/BehaviourDataView.hxx
– Up-to-date: /usr/local/include/MGIS/Behaviour/State.hxx
– Up-to-date: /usr/local/include/MGIS/Behaviour/MaterialStateManager.hxx
– Up-to-date: /usr/local/include/MGIS/Behaviour/MaterialDataManager.hxx
– Up-to-date: /usr/local/include/MGIS/Behaviour/Integrate.hxx
– Up-to-date: /usr/local/include/MGIS/Behaviour/Integrate.ixx
– Installing: /usr/local/lib/libMFrontGenericInterface.so
– Up-to-date: /usr/local/share/mgis/cmake/MFrontGenericInterfaceConfig.cmake
– Installing: /usr/local/share/mgis/cmake/MFrontGenericInterfaceConfig-noconfig.cmake
– Installing: /usr/local/lib/python3.6/site-packages/mgis/_mgis.so
– Set runtime path of “/usr/local/lib/python3.6/site-packages/mgis/_mgis.so” to “”
– Installing: /usr/local/lib/python3.6/site-packages/mgis/behaviour.so
– Set runtime path of “/usr/local/lib/python3.6/site-packages/mgis/behaviour.so” to “”
– Up-to-date: /usr/local/lib/python3.6/site-packages/mgis/init.py
– Up-to-date: /usr/local/lib/python3.6/site-packages/mgis/fenics/init.py
– Up-to-date: /usr/local/lib/python3.6/site-packages/mgis/fenics/gradient_flux.py
– Up-to-date: /usr/local/lib/python3.6/site-packages/mgis/fenics/utils.py
– Up-to-date: /usr/local/lib/python3.6/site-packages/mgis/fenics/nonlinear_material.py
– Up-to-date: /usr/local/lib/python3.6/site-packages/mgis/fenics/nonlinear_problem.py

It seems that it has been correctly installed in /usr/local/lib/python3.6/site-packages
Can you run with python3 :

import sys
sys.path

if /usr/local/lib/python3.6/site-packages is not in the list, then add it to your .basrhc file

export PYTHONPATH=$PYTHONPATH:/usr/local/lib/python3.6/site-packages

have add it to .basrhc file but still doesn’t work.

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/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']
>>>

Strange, what happens if you type in python3:

import mgis
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 mgis
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.6/site-packages/mgis/__init__.py", line 1, in <module>
    from ._mgis import *
ImportError: libMFrontGenericInterface.so: cannot open shared object file: No such file or directory
>>>

I think that the problem comes from Boost python. Do you have libboost-python-dev installed ?

zhiyi@DESKTOP-9ME6CPV:~$ sudo apt-get install -y libboost-python-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
libboost-python-dev is already the newest version (1.65.1.0ubuntu1).
libboost-python-dev set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 51 not upgraded.

but still doesn’t work

Hi Daniel,
Thanks for your interest for MGIS.
the mgis python modules is based on the C++ libMFrontGenericInterface.so shared library. My bet would be that you updated you PYTHONPATH and not your LD_LIBRARY_PATH. Could you check ?

According to this line:

/usr/local/lib/libMFrontGenericInterface.so

you must check that /usr/local/lib/ is in the linker search path.

Hi, thelfer. I found “libMFrontGenericInterface.so” is in the “lib” folder

zhiyi@DESKTOP-9ME6CPV:/usr/local/lib$ ls
cmake                          libboost_iostreams.a                 libboost_random.so.1.72
libMFMTestGenerator.so         libboost_iostreams.so                libboost_random.so.1.72.0
libMFrontGenericInterface.so   libboost_iostreams.so.1              libboost_regex.a
libMFrontLogStream.so          libboost_iostreams.so.1.72           libboost_regex.so
libMFrontProfiling.so          libboost_iostreams.so.1.72.0         libboost_regex.so.1
libMTestFileGenerator.so       libboost_locale.a                    libboost_regex.so.1.72

is that mean “LD_LIBRARY_PATH” has been updated?


but the color of libMFrontGenericInterface.so is white, which mean no-updated?

I guess the following info could be a problem but i di not know how to fix it.

zhiyi@DESKTOP-9ME6CPV:~$ sudo /sbin/ldconfig -v
[sudo] password for zhiyi:
/sbin/ldconfig.real: Can't stat /usr/local/lib/x86_64-linux-gnu: No such file or directory
/sbin/ldconfig.real: Path `/usr/local/lib/libMFrontGenericInterface.so' given more than once
/sbin/ldconfig.real: Path `/usr/local/lib/libMFrontGenericInterface.so' given more than once
/sbin/ldconfig.real: Path `/lib/x86_64-linux-gnu' given more than once
/sbin/ldconfig.real: Path `/usr/lib/x86_64-linux-gnu' given more than once
/usr/lib/x86_64-linux-gnu/libfakeroot:
        libfakeroot-0.so -> libfakeroot-tcp.so
/usr/local/lib/libMFrontGenericInterface.so:
/sbin/ldconfig.real: Can't open directory /usr/local/lib/libMFrontGenericInterface.so: Not a directory
/usr/local/lib:
        libboost_wserialization.so.1.72.0 -> libboost_wserialization.so.1.72.0
        libboost_wave.so.1.72.0 -> libboost_wave.so.1.72.0
        libboost_unit_test_framework.so.1.72.0 -> libboost_unit_test_framework.so.1.72.0

Can you give me the resutls of :

  1. ldd /usr/local/lib/python3.6/site-packages/mgis/_mgis.so
  2. echo $LD_LIBRARY_PATH
zhiyi@DESKTOP-9ME6CPV:~$ ldd /usr/local/lib/python3.6/site-packages/mgis/_mgis.so
        linux-vdso.so.1 (0x00007fffd2662000)
        libMFrontGenericInterface.so => /usr/local/lib/libMFrontGenericInterface.so (0x00007f1157a40000)
        libboost_python36.so.1.72.0 => /usr/local/lib/libboost_python36.so.1.72.0 (0x00007f1157800000)
        libpython3.6m.so.1.0 => /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0 (0x00007f1157140000)
        libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f1156db0000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f1156b90000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f1156790000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f1156570000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f1156350000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f1158000000)
        libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007f1156110000)
        libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f1155ef0000)
        libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007f1155ce0000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f1155940000)
zhiyi@DESKTOP-9ME6CPV:~$ echo $LD_LIBRARY_PATH
:/usr/local/lib/

This is the revelant line. So libMFrontGenericInterface.so is found. And in this configuration, you still get an error when importing the mgis module ?

still get an error.

What is the return of python3 -c "import mgis" ?

zhiyi@DESKTOP-9ME6CPV:~$ python3 -c "import mgis"
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 mgis
>>>

So we made some progress.
What is the error when running the mgis.fenics example ?

still can not identify mgis module

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/PhaseFieldFracture.py"
Traceback (most recent call last):
  File "/mnt/c/Users/Danie/OneDrive/桌面/PhaseField_fracture/PhaseFieldFracture.py", line 276, in <module>
    import mgis.fenics as mf
ModuleNotFoundError: No module named 'mgis'

Process finished with exit code 1