hemelb-codes / hemelb

A high performance parallel lattice-Boltzmann code for large scale fluid flow in complex geometries
GNU Lesser General Public License v3.0
34 stars 11 forks source link

Python-tools Import Error #811

Closed c-denham closed 7 months ago

c-denham commented 8 months ago

Hello,

I have been trying to convert the .xml and .gmy files from the setup tool to a .vtu by using GmyUnstructuredGrid except I get a recurring error that the xdr cannot be imported. In hlb.utils there is a xdr.c, xdr.pyx and xdr.pxd. I have tried to run it with and without the conda env using the command from the documentation.

(gmy-tool) claire@ENG8615:~/hemelb/python-tools$ python -m hlb.converters.GmyUnstructuredGridReader /home/claire/hemelb_results/straight_empty/test.xml
Traceback (most recent call last):
  File "/home/claire/miniconda3/envs/gmy-tool/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/claire/miniconda3/envs/gmy-tool/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/claire/hemelb/python-tools/hlb/converters/GmyUnstructuredGridReader.py", line 18, in <module>
    from ..parsers.geometry.simple import ConfigLoader
  File "/home/claire/hemelb/python-tools/hlb/parsers/geometry/simple.py", line 13, in <module>
    from ...utils import xdr
ImportError: cannot import name 'xdr' from 'hlb.utils' (/home/claire/hemelb/python-tools/hlb/utils/__init__.py)

Thanks in advance

rupertnash commented 7 months ago

Hi Claire - you're trying to use the tools from the source tree. The tools only work when installed by pip/setuptools