Closed oberstet closed 8 months ago
Turns out, the fix is easy:
(cpy311_7) oberstet@intel-nuci7:~/scm/3rdparty/openEMS-Project/openEMS/python$ git diff
diff --git a/python/openEMS/_nf2ff.pxd b/python/openEMS/_nf2ff.pxd
index 859f062..6cb11b5 100644
--- a/python/openEMS/_nf2ff.pxd
+++ b/python/openEMS/_nf2ff.pxd
@@ -20,7 +20,8 @@ from libcpp.string cimport string
from libcpp.vector cimport vector
from libcpp.complex cimport complex
from libcpp cimport bool
-cimport cython.numeric
+
+import cython
cdef extern from "openEMS/nf2ff.h":
cdef cppclass cpp_nf2ff "nf2ff":
With that, I could successfully test and run Tutorials/Helical_Antenna.py
There is another glitch (found it as I'm testing with a completely fresh, from sources build, including cpython):
(cpy312_1) oberstet@intel-nuci7:~/scm/typedefint/rfminer$ python -c "import openEMS"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/oberstet/cpy312_1/lib/python3.12/site-packages/openEMS/__init__.py", line 9, in <module>
from openEMS.openEMS import openEMS
File "openEMS/openEMS.pyx", line 22, in init openEMS.openEMS
File "/home/oberstet/cpy312_1/lib/python3.12/site-packages/openEMS/nf2ff.py", line 22, in <module>
import h5py
ModuleNotFoundError: No module named 'h5py'
after fixing https://github.com/thliebig/openEMS/pull/132/commits/190330336f16573c4ebcd78fe5ce4e4e1fe4de5c this now works
(cpy312_1) oberstet@intel-nuci7:~/scm/3rdparty/openEMS$ python -V
pip show openems
python -c "from CSXCAD.CSXCAD import ContinuousStructure"
python -c "import openEMS"
Python 3.12.1
Name: openEMS
Version: 0.0.36
Summary: Python interface for the openEMS FDTD library
Home-page: https://openEMS.de
Author: Thorsten Liebig
Author-email: Thorsten.Liebig@gmx.de
License:
Location: /home/oberstet/cpy312_1/lib/python3.12/site-packages
Requires: h5py, numpy
Required-by:
I also stumbled upon the Cython import issue recently while building with VTK 9 instead of VTK 7, though I'd have to check whether that's the true cause. Do you recall whether you apt installed libvtk7-dev
/libvtk7-qt-dev
or libvtk9-dev
/libvtk9-qt-dev
? I'd have to test, although I'm not sure why that would cause such issues. I'm not aware of any recent commits that might be responsible for this.
Also, the file doesn't seem to require the import at all, so I simply got rid of the line entirely while fixing this and it built fine:
-cimport cython.numeric
Do you recall whether you apt installed
libvtk7-dev
/libvtk7-qt-dev
orlibvtk9-dev
/libvtk9-qt-dev
?
I was using the standard distro VTK on Ubuntu 22.04, which is VTK 9.1
(.venv) oberstet@intel-nuci7:~/scm/typedefint/rfminer$ apt search vtk | grep 9.1
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
libvtk9-dev/jammy,now 9.1.0+really9.1.0+dfsg2-3build1 amd64 [installiert]
libvtk9-java/jammy,now 9.1.0+really9.1.0+dfsg2-3build1 amd64 [Installiert,automatisch]
libvtk9-qt-dev/jammy,now 9.1.0+really9.1.0+dfsg2-3build1 amd64 [installiert]
libvtk9.1/jammy,now 9.1.0+really9.1.0+dfsg2-3build1 amd64 [Installiert,automatisch]
libvtk9.1-qt/jammy,now 9.1.0+really9.1.0+dfsg2-3build1 amd64 [Installiert,automatisch]
python3-vtk9/jammy,now 9.1.0+really9.1.0+dfsg2-3build1 amd64 [Installiert,automatisch]
vtk9/jammy,now 9.1.0+really9.1.0+dfsg2-3build1 amd64 [Installiert,automatisch]
vtk9-doc/jammy,jammy 9.1.0+really9.1.0+dfsg2-3build1 all
vtk9-examples/jammy,jammy 9.1.0+really9.1.0+dfsg2-3build1 all
(.venv) oberstet@intel-nuci7:~/scm/typedefint/rfminer$
all of the build works using that
however https://github.com/thliebig/openEMS-Project/discussions/137
thus, I am now running VTK 9.3
(.venv) oberstet@intel-nuci7:~/scm/3rdparty/openEMS-Project$ openEMS
----------------------------------------------------------------------
| openEMS 64bit -- version v0.0.36
| (C) 2010-2023 Thorsten Liebig <thorsten.liebig@gmx.de> GPL license
----------------------------------------------------------------------
Used external libraries:
CSXCAD -- Version: v0.6.3
hdf5 -- Version: 1.10.7
compiled against: HDF5 library version: 1.10.7
tinyxml -- compiled against: 2.6.2
fparser
boost -- compiled against: 1_74
vtk -- Version: 9.3.0
compiled against: 9.3.0
Usage: openEMS <FDTD_XML_FILE> [<options>...]
<options>
--disable-dumps Disable all field dumps for faster simulation
--debug-material Dump material distribution to a vtk file for debugging
--debug-PEC Dump metal distribution to a vtk file for debugging
--debug-operator Dump operator to vtk file for debugging
--debug-boxes Dump e.g. probe boxes to vtk file for debugging
--debug-CSX Write CSX geometry file to debugCSX.xml
--engine=<type> Choose engine type
--engine=fastest fastest available engine (default)
--engine=basic basic FDTD engine
--engine=sse engine using sse vector extensions
--engine=sse-compressed engine using compressed operator + sse vector extensions
--engine=multithreaded engine using compressed operator + sse vector extensions + multithreading
--numThreads=<n> Force use n threads for multithreaded engine (needs: --engine=multithreaded)
--no-simulation only run preprocessing; do not simulate
--dump-statistics dump simulation statistics to 'openEMS_run_stats.txt' and 'openEMS_stats.txt'
Additional global arguments
--showProbeDiscretization Show probe discretization information
--nativeFieldDumps Dump all fields using the native field components
-v,-vv,-vvv Set debug level: 1 to 3
and the log noise is gone=) it was "harmless" functionally, but a pain on my nerves. I had to use the mouse to scroll through tons of screens all the time just to find my log messages.
Also, the file doesn't seem to require the import at all, so I simply got rid of the line entirely while fixing this and it built fine:
ah, right;) that's even better.
done: https://github.com/thliebig/openEMS/pull/132/commits/2b5b89ad10302f10b8462b04f578166d1d5ec72a
Hi there, first of all, thanks for creating openEMS and making it available as OSS! Awesome=)
Now I do have a problem with getting everything set up from source (Ubuntu 22.04, Python 3.11 from sources), Cython refuses to spill out code with:
I've closely followed the docs https://docs.openems.de/install/manual.html#install-python-bindings-optional, and while the other parts did build, the Python bindings not.
The Python package does not restrict the Python version required (https://github.com/thliebig/openEMS/blob/master/python/setup.py), and so I assume Python 3.11 should work?
Any hints or tips would be highly appreciated! Cheers, /Tobias