Hello,

On 10/8/23 17:22, Rafael Laboissière wrote:
Ok, I tried to fix the building problem by including python3-h5py, alongside 
with python3-h5py-mpi, into Build-Depends, as suggested by Drew, but the xmds2 
package FTBFS.

Here is a way to reproduce the problem without building the package:

   $ dpkg -l python3-h5py\*
   Desired=Unknown/Install/Remove/Purge/Hold
   | 
Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
   |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
   ||/ Name                Version      Architecture Description
   
+++-===================-============-============-=======================================================
   ii  python3-h5py        3.9.0-3      all          general-purpose Python 
interface to hdf5
   ii  python3-h5py-mpi    3.9.0-3      amd64        general-purpose Python 
interface to hdf5 (Python 3 MPI)
   un  python3-h5py-serial <none>       <none>       (no description available)
   $ echo 'import h5py' | python3
   Traceback (most recent call last):
     File "<stdin>", line 1, in <module>
     File "/usr/lib/python3/dist-packages/h5py/__init__.py", line 21, in 
<module>
       from . import _debian_h5py_serial as _h5py
   ImportError: cannot import name '_debian_h5py_serial' from partially 
initialized module 'h5py' (most likely due to a circular import) 
(/usr/lib/python3/dist-packages/h5py/__init__.py)

Is there a way to force h5py to import _debian_h5py_serial instead of 
_debian_h5py_mpi, via the generic h5py namespace?

Drew would probably answer that question better but from taking a brief look, 
it seems to be on expected lines.
This should work if you run it explicitly with mpi.

$ mpirun -n 1 python3 -c "import h5py" && echo "true"
true

or with setting the MPI var manually.

$ OMPI_COMM_WORLD_SIZE=1 python3 -c "import h5py" && echo "true"
true

If you want the _debian_h5py_serial interface then you need python3-h5py-serial 
and the B-D (and Depends) on h5py-mpi
should be dropped which would mean this package does not need the -mpi package.

Otherwise, a (unreliable) hack that you could do it that add a B-D on h5py 
*before* mpi and then -serial should also be installed (at least on my env).

If the code really needs h5py-mpi, then it should be running the build/tests 
with mpi enabled (via openmpi).
At least that's the impression I get from reading.

        https://sources.debian.org/src/h5py/3.9.0-3/debian/README.Debian/

This patch gets the package building for me with h5py-mpi+h5py, but not sure if 
it is the right thing to do -- please verify for yourself as package maintainer 
:)

--- a/xpdeint/XSILFile.py
+++ b/xpdeint/XSILFile.py
@@ -31,6 +31,9 @@
numpy = None +# Set env var to use h5py-mpi
+os.environ['OMPI_COMM_WORLD_SIZE'] = '1'
+
 def require_h5py():
   global h5py
   if not h5py:

Reply via email to