Closed chintanparekh2301 closed 1 year ago
Thanks for your interest in BPCells! First, I'd encourage you to double-check all the discussion in this issue, and try making sure you don't have an ARM vs. x86 issue. I think homebrew should default to the correct thing here, though.
Next, I'd check if you can successfully run the command pkg-config hdf5 --cflags --libs
. It's possible you'll need to install pkg-config
separately through homebrew -- I don't personally have an ARM mac to check if it comes pre-installed.
Once pkg-config
runs successfully, it should print out a single line that is something along these lines (your exact values will be different):
-I/usr/include/hdf5/serial -L/usr/lib/x86_64-linux-gnu/hdf5/serial -lhdf5
I think you should be able to install BPCells okay once pkg-config
is running.
As a side note, the relevant environment variable for linking issues like this is LD_LIBRARY_PATH
not PATH
, and if you want to manually edit your environment variables you'll need to include a folder that contains a file named libhdf5.so
. I'd recommend going the pkg-config
route though as it will be a bit less finicky to install.
If some of that works for you, could you report back with a summary so we can help future homebrew users install BPCells?
I'll close this for now, but please do reply with what worked (or didn't) for you if you get a chance.
Hi, Thank you so much for your help. I tried your suggestions and those in your posts to other mac users but still doesn't work. The R version is the ARM version. I installed hfdf5 through homebrew (the hdf5 via hoembrew supports ARM). I installed pkg-config via homebrew (the pkg-config via hoembrew supports ARM). However, I get these errors:
pkg-config hdf5 --cflags --libs Package hdf5 was not found in the pkg-config search path. Perhaps you should add the directory containing
hdf5.pc' to the PKG_CONFIG_PATH environment variable which h5cc /opt/homebrew/bin/h5cc export PKG_CONFIG_PATH=/opt/homebrew/bin pkg-config hdf5 --cflags --libs Package hdf5 was not found in the pkg-config search path. Perhaps you should add the directory containing
hdf5.pc' to the PKG_CONFIG_PATH environment variable No package 'hdf5' found /usr/bin/gcc --version Apple clang version 14.0.0 (clang-1400.0.29.202) Target: arm64-apple-darwin21.6.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin
I did a google search and the homebrew hdf5 does not come with a .pc file. Home brew on ARM macs install packages in /opt/homebrew/bin rather than the traditional usr/bin directory used by homebrew in intel macs.
Seems like I need to tell BPcells to look for hdf5 in /opt/homebrew/bin during installation. How do I do this? Thanks
Alright, sounds like this will be a bit manual but achievable. As a first step, you will need to find the path for both the headers and the lib for hdf5.
include/hdf5
or include/serial/hdf5
and will contain many .h
files, one of which should be hdf5.h
lib
and should include a file named libhdf5.so
bin
directory, but are usually right next to the bin
directory. If you're having trouble, you may be able to find some of the paths hunting through the output of h5cc -showconfig
Once you've figured that out, you're 90% of the way there. For the bit that follows, I'll use the locations on my computer, which are:
/usr/include/hdf5/serial
/usr/lib/x86_64-linux-gnu/hdf5/serial
Finally, you'll create and/or edit an ~/.R/Makevars
file, and include the following:
CFLAGS=-I/usr/include/hdf5/serial
CXXFLAGS=-I/usr/include/hdf5/serial
LDFLAGS=-L/usr/lib/x86_64-linux-gnu/hdf5/serial
Replace the folder paths with the ones you find from homebrew. Then, hopefully installation should just work.
If you are having trouble but think you have found the correct headers/libs folder, you can try compiling the test program yourself, which might show more detailed error messages. The test file is here tools/h5write.c, and you'll try to compile it with: gcc h5write.c -I[your-headers-folder] -L[your-libs-folder] -lhdf5 -o h5write
. If that compiles, you should be able to install BPCells fine with the Makevars
file created as I described above
Hi Thank you so much It worked. I created makevars in R using: file.create(file.create('~/.R/Makevars')
Then used shift+command+. in finder to show hidden files- located the makevars file in the .R folder and opened the makevars file in a text editor. The file was empty. I added: CFLAGS = -I/opt/homebrew/Cellar/hdf5/1.12.2_2/include CXXFLAGS = -I/opt/homebrew/Cellar/hdf5/1.12.2_2/include LDFLAGS = -L/opt/homebrew/Cellar/hdf5/1.12.2_2/lib
I found the hdf5.h file in opt/homebrew/Cellar/hdf5/1.12.2_2/include However, I couldn't find libhdf5.so anywhere on my computer. There were a bunch of other libhdf5 files (eg libhdf5.a) in opt/homebrew/Cellar/hdf5/1.12.2_2/lib. I assumed that opt/homebrew/Cellar/hdf5/1.12.2_2/lib had all the needed library files and maybe the homebrew installation of hdf5 has a libhdf5 file with an extension different from .so that is equivalent to the libhdf5.so file on other operating systems.
Glad it worked for you!
You're right about the libhdf5.so file -- I had forgotten about this, but I think the Mac equivalent might be called libhdf5.dylib
Hi I am having trouble installing BPcells on an ARM mac remotes::install_github("bnprks/BPCells", quiet = F) Downloading GitHub repo bnprks/BPCells@HEAD Running
R CMD build
...Retrying with pkg-config flags... Error running 'pkg-config hdf5 --cflags --libs'
Searching for hdf5 in a conda env... no conda environment found in '$CONDA_PREFIX'
Unable to locate libhdf5. Please install manually or edit compiler flags. ERROR: configuration failed for package ‘BPCells’
I installed hdf5 via homebrew but I still get the same error during BPcells installation. hdf5 is installed in "/opt/homebrew/Cellar" since that is the default package installation location for homebrew. I added /opt/homebrew/Cellar to the path in R and it shows up in the path:
However, BPcells still cannot find hdf5 during installation and then fails to install.
Thank you very much