Closed carshadi closed 2 years ago
Hi,
There were some mistakes in the PyImarisWriter.py code that caused the segmentation faults on mac/linux. Interestingly, on windows it worked.
I have fixed the issues with these commits:
The same issue was also present in the ImarisWriterCtypesTest.py program, which I fixed in https://github.com/SachaGuyer/ImarisWriterTest/commit/a45564bfc888bafeb7b2141091164b36f3cebed2
With these changes I can now run all python test programs on macOS successfully. I have not tested centOS but assume that it should be fine. Let me know if it worked for you.
Excellent, I will test this out and report back. Thank you!
Hi @SachaGuyer , confirming this is working on my end.
The only thing was I got this error
Traceback (most recent call last):
File "/home/cameron.arshadi/repos/lightsheet-compression-tests/PyImarisWriter/PyImarisWriter.py", line 353, in _load_dll
self.mcdll = CDLL(dll_filename)
File "/home/cameron.arshadi/miniconda3/envs/lightsheet-compression-tests/lib/python3.8/ctypes/__init__.py", line 373, in __init__
self._handle = _dlopen(self._name, mode)
OSError: libbpImarisWriter96.so: cannot open shared object file: No such file or directory
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "compress_h5.py", line 188, in <module>
main()
File "compress_h5.py", line 171, in main
bytes_written, compress_time, cpu_utilization = run(test_config, np_data.astype(test_config.mNp_type), nCores)
File "compress_h5.py", line 90, in run
converter = PW.ImageConverter(configuration.mImaris_type, image_size, sample_size, dimension_sequence, block_size,
File "/home/cameron.arshadi/repos/lightsheet-compression-tests/PyImarisWriter/PyImarisWriter.py", line 326, in __init__
self._load_dll()
File "/home/cameron.arshadi/repos/lightsheet-compression-tests/PyImarisWriter/PyImarisWriter.py", line 357, in _load_dll
self.raise_creating_clex(text)
File "/home/cameron.arshadi/repos/lightsheet-compression-tests/PyImarisWriter/PyImarisWriter.py", line 90, in raise_creating_clex
raise PyImarisWriterException('Error creating {}: {}'.format(self.__class__.__name__, message))
PyImarisWriter.PyImarisWriter.PyImarisWriterException: Error creating ImageConverter: Could not load library "libbpImarisWriter96.so" (with dependencies hdf5 and zlib)
Please make sure the library is available and in the PATH environment variable
But that was fixed by changing the following https://github.com/carshadi/ImarisWriter/commit/5bc6b95e679772a6f41694440892a067f3203cb9
Hi, I'm glad to hear that it now works on your system!
Thanks for the fix for loading the shared object. Apparently the behaviour of ctypes is slightly different on windows and mac/linux. On windows it is enough to add the folder where the shared object is located to the path, like it is done in PyImarisWriter. On mac/linux, the full path to the shared object file must be specified.
I'll go ahead and close this
Hi all,
We are interested in using PyimarisWriter to compress terabyte-scale lightsheet datasets. I was able to compile
ImarisWriter
and all its dependencies on CentOS 7 usingcmake 3.22.1
andgcc/g++ 9.3.1
. I can runTestPyImarisWriter.py
successfully, which gives the output:However, if I run
ImarisWriterCtypesTest.py
I get a segfault. Running from gdb:Outputs the following:
The error occurs within this function https://github.com/imaris/ImarisWriterTest/blob/2de64e247964eec9e85c89b4a39c9852c046d1e0/testPy/ImarisWriterCtypesTest.py#L69
A segfault also occurs with
PyImarisWriterExample.py
In this case the segfault is triggered by
converter.NeedCopyBlock
https://github.com/imaris/ImarisWriterTest/blob/2de64e247964eec9e85c89b4a39c9852c046d1e0/testPy/PyImarisWriterExample.py#L74Here is what my
PyImarisWriter
package directory looks like, including the compiled libraryOutput of
lscpu
:cmake
output:make
output:I then copied
libbpImarisWriter96.so
to thePyImarisWriter
package folder before running the testsThank you for your help!