bnprks / BPCells

Scaling Single Cell Analysis to Millions of Cells
https://bnprks.github.io/BPCells
Other
134 stars 11 forks source link

Error of hdf5 when installing on HPC Rstudioserver #86

Closed yifanfu01 closed 2 months ago

yifanfu01 commented 2 months ago

Hi, Many thanks for this useful package.

I use HPC without Root access, and there used module control to set system environment, before enter the R environtment, I load:


apps/hdf5/1.8.13
compiler/gcc/9.1.0
mathlib/hdf5/1.8.22-gnu485

and I confirmed i can excute h5cc -show and returned:

gcc -L/public/software/mathlib/hdf5/1.8.22-gcc485/lib /public/software/mathlib/hdf5/1.8.22-gcc485/lib/libhdf5_hl.a /public/software/mathlib/hdf5/1.8.22-gcc485/lib/libhdf5.a -lz -ldl -lm -Wl,-rpath -Wl,/public/software/mathlib/hdf5/1.8.22-gcc485/lib

but when i entered the R environment, I met the error when installing BPCells :

** using staged installation
Testing hdf5 by compiling example program...

Retrying with pkg-config flags...
Error running 'pkg-config hdf5 --cflags --libs'

Searching for config information with h5cc -showconfig and h5cc -show...

Searching for hdf5 in a conda env...

Unable to locate libhdf5. Please install manually or edit compiler flags.
ERROR: configuration failed for package ‘BPCells’

In our HPC, we set hdf5 in a non-standard path. I have no idea what should I do to go on, although i found there's a similar issue and reply https://github.com/bnprks/BPCells/issues/84 however it seems a bit different.

Thanks in advance. Jacob Y. FU

yifanfu01 commented 2 months ago

Hi, I solved this problem temporarily by editing the configure file in the source files:

First I load hdf5 environment, and use h5cc -show to find the pathway of hdf5 library, or PATH.

Then I download the package and upload the source zip file to HPC. And change the configure files as follow:

(1) Change Lines 24-26 to CFLAGS="-I/PATH/include" CXXFLAGS="-I/PATH/include" LDFLAGS="-L/PATH/lib" HDF5_CFLAGS="-I/PATH/include" HDF5_OK="yes"

AND

(2) Delete Lines 34

Then I finally finished the installation.

Meanwhile, If guys forget deleting Line 34, the HDF5_CFLAGS will seems to be reset and will occur the error:

"In file included from arrayIO/../lib/highfive/H5DataSpace.hpp:18,
                 from arrayIO/../lib/highfive/H5DataSet.hpp:14,
                 from arrayIO/hdf5.h:6,
                 from bitpacking_io.cpp:7:
arrayIO/../lib/highfive/H5Object.hpp:14:10: fatal error: H5Ipublic.h: No such file or directory
   14 | #include <H5Ipublic.h>
      |          ^~~~~~~~~~~~~
compilation terminated.
make: *** [bitpacking_io.o] Error 1
ERROR: compilation failed for package ‘BPCells’"

I am not familiar with compiler but I guess the developter could improve the Lines 24-26, which looks like set the R_HOME path as default hdf5 library?

And I hope the info above will be helpful for all users.

Jacob Y. FU Peking Union Medical College, Beijing, China.

bnprks commented 2 months ago

Hi Jacob, Glad you were able to eventually get it working for yourself. Issue #84 has a good suggestion for how to manage installation when you know the specific path of your hdf5 installation, which is setting the listed variables in the standard location for a user's R Makevars file (on linux typically ~/.R/Makevars, but a full table of options is in this manual. In general this should be a cleaner substitute to editing the configure source script thought that's also fine if it works for you.

The BPCells installation script tries several options to find hdf5, and generally should be able to pick up flags if h5cc is on your $PATH during installation. I'm not quite sure what would have gone wrong in this case -- every system is different so it's sometimes hard for the configure script to find hdf5 if it's in an unusual place. You can get more detailed error messages to debug a failing installation by running Sys.setenv(BPCELLS_DEBUG_INSTALL="true") just before running an install.

Feel free to reply if you have more questions, but I'll close this for now as it sounds like you've solved your current issue yourself. -Ben