Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
GarryGao00 opened this issue Mar 6, 2024 · 1 comment

Comments

@GarryGao00
Copy link

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)
@WenzhuoXu
Copy link
Collaborator

WenzhuoXu commented Mar 7, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants