cmudrc/FlowDataGeneration

ImportError: Couldn't find a file matching the module name: fenicstools.fem.interpolation

GarryGao00 opened this issue · 1 comments

I have trouble running the simulation due to package import error. The fenicstools package is missing from the environment.yaml file so I downloaded and installed it from https://github.com/mikaem/fenicstools.git. After the installation, I can see

$ pip list 
------------------ ---------
fenics-dijitso     2019.1.0
fenics-dolfin      2019.1.0
fenics-ffc         2019.1.0
fenics-fiat        2019.1.0
fenics-ufl         2019.1.0
fenicstools        2019.1
fenicstools        2019.1
fenicstools        2019.1

However I still obtained this error message trying to run the example code:

$ python NSfracStep.py problem=Cylinder meshname=ellipse_1 meshdir=io_operations T=10 dt=0.001 output_timeseries_as_vector=False folder=data
/miniconda3/envs/fenicsproject/lib/python3.11/site-packages/fenicstools-2019.1-py3.11.egg/fenicstools/__init__.py:7: UserWarning: Probe/Probes/StatisticsProbe/StatisticsProbes not installed
/miniconda3/envs/fenicsproject/lib/python3.11/site-packages/fenicstools-2019.1-py3.11.egg/fenicstools/__init__.py:12: UserWarning: StructuredGrid/ChannelGrid not installed
/miniconda3/envs/fenicsproject/lib/python3.11/site-packages/fenicstools-2019.1-py3.11.egg/fenicstools/__init__.py:17: UserWarning: weighted_gradient_matrix/compiled_gradient_module not installed
/miniconda3/envs/fenicsproject/lib/python3.11/site-packages/fenicstools-2019.1-py3.11.egg/fenicstools/__init__.py:22: UserWarning: getMemoryUsage/SetMatrixValue not installed
/miniconda3/envs/fenicsproject/lib/python3.11/site-packages/fenicstools-2019.1-py3.11.egg/fenicstools/__init__.py:27: UserWarning: gauss_divergence/divergence_matrix not installed
/miniconda3/envs/fenicsproject/lib/python3.11/site-packages/fenicstools-2019.1-py3.11.egg/fenicstools/__init__.py:32: UserWarning: interpolate_nonmatching_mesh/interpolate_nonmatching_mesh_any not installed
Traceback (most recent call last):
  File "/FlowDataGeneration/NSfracStep.py", line 40, in <module>
    from utils import import_mesh
  File "/FlowDataGeneration/utils.py", line 10, in <module>
    from fenicstools.Interpolation import interpolate_nonmatching_mesh
  File "/miniconda3/envs/fenicsproject/lib/python3.11/site-packages/fenicstools-2019.1-py3.11.egg/fenicstools/Interpolation.py", line 8, in <module>
  File "/miniconda3/envs/fenicsproject/lib/python3.11/site-packages/cppimport/__init__.py", line 49, in imp
    filepath = find_module_cpppath(fullname, opt_in)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/miniconda3/envs/fenicsproject/lib/python3.11/site-packages/cppimport/find.py", line 14, in find_module_cpppath
    raise ImportError(
ImportError: Couldn't find a file matching the module name: fenicstools.fem.interpolation  (opt_in = False)

Hi,

I see this problem is with the certain fenicstools library. I think this is a known issue with fenicstools, to solve it you either need to install the cppimport library or refer to the solutions listed here. If the same error still exists you could try commenting out the corresponding lines in the package as those are not always required for this repo to work.

Best,
Wenzhuo