gtluu / timsconvert

https://gtluu.github.io/timsconvert/
Apache License 2.0
28 stars 16 forks source link

psims dependency error #18

Closed gtluu closed 11 months ago

gtluu commented 2 years ago

psims >= 0.1.35 causes Bruker API to throw Boost interprocess error on Linux psims <= 0.1.45? causes the following error when trying to write out ion mobility arrays (this does not occur if --exclude_mobility flag is included): File "~/psims/mzml/writer.py", line 549, in spectrum array, encoding=encoding[array_type], compression=compresssion, array_type=array_type, TypeError: unhashable type: dict

gtluu commented 2 years ago

only occurs when using timsconvert backend

gtluu commented 2 years ago

Boost interprocess error is most likely caused by use of pynumpress package in psims, which is compiled via Cython.

mobiusklein commented 2 years ago

If you can tell me what array_type is when it's blowing up, I can patch it up.

gtluu commented 2 years ago

If you can tell me what array_type is when it's blowing up, I can patch it up.

Thanks for the offer, though I believe it's already been fixed in one of your updates last year/earlier this year. I realized I was using the newer array_type (tuple (array_type, array)) instead of the older one (tuple (str name, array)). This has been temporarily fixed.

This is more of a Bruker API issue that requires older versions of psims (<= 0.1.34) before pynumpress began being used. I don't know exactly how/why, but pynumpress doesn't seem to work well with the logger in Bruker's API on Linux. My current thoughts were to fork the current version of psims and use the older version of psims/mzml/binary_encoding.py that didn't use pynumpress. Though if there's a better solution I'm all ears.

mobiusklein commented 2 years ago

It'd be simple enough to block the import of pynumpress via an environment variable.

What's the actual error that the Bruker library generates when pynumpress is imported?

gtluu commented 2 years ago

It's boost::interprocess::interprocess_exception referenced in issues 8 and 13.

`>>>>>>>>|- ERROR in [bdal-logconf:logger_config.cpp:379] - XML analysis error: The resulting configuration is unusable - Falling back to default configuration: Dynamic exception type: std::bad_cast std::exception::what: std::bad_cast

terminate called after throwing an instance of 'boost::interprocess::interprocess_exception' what(): boost::interprocess::intermodule_singleton initialization failed .command.sh: line 3: 79273 Aborted`

Also, I'm not sure if this helps but this error has also occurred in MSFragger before.

mobiusklein commented 2 years ago

I've added an environment variable PSIMS_NO_PYNUMPRESS which if it has a non-empty value will skip importing pynumpress and its features will be disabled in release v0.1.47.

gtluu commented 2 years ago

I've added an environment variable PSIMS_NO_PYNUMPRESS which if it has a non-empty value will skip importing pynumpress and its features will be disabled in release v0.1.47.

Thank you for that. Unfortunately, the error still appears without loading pynumpress, so I will need to look into this issue again to see if I've missed something.

gtluu commented 11 months ago

This appears to have been fixed as of 62ef7b2e4af17b95fde8f753424cad8dda8fa921 which uses psims 1.2.7.

TIMSCONVERT 1.5.0 was tested on Python 3.11.5 installed with Anaconda 2023.7-2 on Windows 10 22H2 and Ubuntu 22.04.3 LTS.