Closed thanushipeiris closed 1 year ago
Hmmmm. Pinging @tlambert03 any ideas?
hmmm, worked for me.
conda create -n ims python=3.9 openjdk
pip install napari[all] napari-aicsimageio bioformats_jar
napari PyramidalCell.ims
Did you install openjdk (or generally install Java somehow) as described in the error?
pip install napari[all] napari-aicsimageio bioformats_jar
sorry, just remembered this package also includes bioformats_jar
... so you shouldn't need that last bit either. just `pip install napari[all] napari-aicsimageio
...
If it's still not working for you, can you give your full environment creation code?
Yeah it's still not working - I used the same code as you
conda create -n ims python=3.9 openjdk
conda activate ims
pip install napari[all] napari-aicsimageio
napari PyramidalCell.ims
but get this error
AICSImageIO: Unsupported file format.
AICSImageIO: Unsupported file format.
Traceback (most recent call last):
File "C:\Users\thanushi.peiris\Anaconda3\envs\ims\lib\site-packages\napari\plugins\io.py", line 118, in read_data_with_plugins
layer_data = reader(npe1_path) # try to read data
TypeError: 'NoneType' object is not callable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\thanushi.peiris\Anaconda3\envs\ims\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\thanushi.peiris\Anaconda3\envs\ims\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Users\thanushi.peiris\Anaconda3\envs\ims\Scripts\napari.exe\__main__.py", line 7, in <module>
File "C:\Users\thanushi.peiris\Anaconda3\envs\ims\lib\site-packages\napari\__main__.py", line 447, in main
_run()
File "C:\Users\thanushi.peiris\Anaconda3\envs\ims\lib\site-packages\napari\__main__.py", line 312, in _run
viewer = view_path( # noqa: F841
File "C:\Users\thanushi.peiris\Anaconda3\envs\ims\lib\site-packages\napari\view_layers.py", line 178, in view_path
return _make_viewer_then('open', args, kwargs)
File "C:\Users\thanushi.peiris\Anaconda3\envs\ims\lib\site-packages\napari\view_layers.py", line 126, in _make_viewer_then
method(*args, **kwargs)
File "C:\Users\thanushi.peiris\Anaconda3\envs\ims\lib\site-packages\napari\components\viewer_model.py", line 918, in open
self._add_layers_with_plugins(
File "C:\Users\thanushi.peiris\Anaconda3\envs\ims\lib\site-packages\napari\components\viewer_model.py", line 983, in _add_layers_with_plugins
layer_data, hookimpl = read_data_with_plugins(
File "C:\Users\thanushi.peiris\Anaconda3\envs\ims\lib\site-packages\napari\plugins\io.py", line 121, in read_data_with_plugins
raise PluginCallError(result.implementation, cause=exc)
File "C:\Users\thanushi.peiris\Anaconda3\envs\ims\lib\site-packages\napari_plugin_engine\exceptions.py", line 197, in __init__
plugin = hook_implementation.plugin
AttributeError: 'NoneType' object has no attribute 'plugin'
When I open napari and try dragging and dropping, it's the exact same error as before.
That's a different error than before, yes? Lemme try on windows tomorrow
That's a different error than before, yes? Lemme try on windows tomorrow
Yes but that's because I'm using the napari PyramidalCell.ims
command. I was just opening napari and dragging and dropping the file before - the error message is the same when I do that.
Do you think it might be me not configuring java on my machine properly?
Hi @tlambert03, just wanted to see if there's been any progress on this
sorry! not yet :/ still not sure what's different between our systems, and I apologize for not having time to dig deeper yet.
Not sure how relevant this is still...but: on my mac, I can replicate this using this install pattern:
conda create -n ims python=3.9 openjdk pyqt
conda activate ims
pip install napari napari-aicsimageio
napari PyramidalCell.ims
(i'm on arm64, so need pyqt from conda)
However, using
import aicsimageio
image = img = aicsimageio.readers.bioformats_reader.BioformatsReader("PyramidialCell.ims")
gave me a hint as to how to resolve:
jgo.jgo.ExecutableNotFound: mvn not found on path /Users/piotrsobolewski/Dev/miniforge3/envs/ims/bin:/Users/piotrsobolewski/Dev/miniforge3/condabin:/Users/piotrsobolewski/Dev/miniforge3/bin:/opt/homebrew/sbin:/opt/homebrew/opt/llvm/bin:/Applications/CMake.app/Contents/bin:/usr/local/texlive/2020/bin/custom:/Users/piotrsobolewski/Library/Python/3.8/bin:/Users/piotrsobolewski/.cargo/bin:/opt/homebrew/bin:/opt/homebrew/opt/fzf/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/TeX/texbin
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/piotrsobolewski/Dev/miniforge3/envs/ims/lib/python3.9/site-packages/aicsimageio/readers/bioformats_reader.py", line 147, in __init__
with BioFile(self._path, **self._bf_kwargs) as rdr: # type: ignore
File "/Users/piotrsobolewski/Dev/miniforge3/envs/ims/lib/python3.9/site-packages/aicsimageio/readers/bioformats_reader.py", line 301, in __init__
loci = _try_get_loci() # may raise RuntimeError
File "/Users/piotrsobolewski/Dev/miniforge3/envs/ims/lib/python3.9/site-packages/aicsimageio/readers/bioformats_reader.py", line 654, in _try_get_loci
raise RuntimeError(MAVEN_ERROR_MSG) from e
RuntimeError:
BioformatsReader requires the maven ('mvn') executable to be
available in your environment. If you are using conda, you can
install with `conda install -c conda-forge scyjava`.
Alternatively, install from https://maven.apache.org/download.cgi
And I can say that conda install -c conda-forge scyjava
fixed the issue.
(I used mamba, but it shouldn't matter)
this shows maven
as one of the installed packages.
I guess it's not a python thing, but a java one so it's not on pypi and can't be pip installed.
Anyhow, I also tried in a new env with scyjava and openjdk from conda-forge when making the env and then the pip install made everything work, though I guess the multi-resolution part is read as 2 different scenes, which may not be perfect.
Digging a little deeper, it looks like this is expected behavior, see: https://github.com/tlambert03/bioformats_jar/pull/4#issuecomment-1132345219
Seems like maven
does need to be available.
Quite problematic for this plugin, which by default (in napari GUI) would be installed by pip π
yeah, bioformats support in aicsimageio has "always" needed a conda environment and at least a couple conda installs that we can't enforce from the napari plugin installer
yeah, bioformats support in aicsimageio has "always" needed a conda environment and at least a couple conda installs that we can't enforce from the napari plugin installer
Thanks for the clarification.
I knew java was required, but folks probably have that.
The maven
part was not something I was aware of or expecting.
Definitely a bummer.
But I guess once napari supports conda plugins in the GUI it will be better?
Anyhow, I'll make a PR to mention it in the README of this repo too.
yeah, I guess. i think it's fine to just say that this feature requires your ability to conda install into your napari environment. (I'm totally fine having some features that aren't trivially available in the napari bundle)
in any case https://github.com/tlambert03/bioformats_jar/pull/4 was just "the right thing to do". Bundling a specific version of the bioformats java jar was a janky solution to begin with. scyjava is specifically designed to do this sort of dependency handling, and it now lets end users update bioformats without needing to update aicsimageio
My only concern is that as far as I can tellβand please correct me!βpip sees
conda installed stuff, but conda does not see pip stuff, right?
So if someone set up a conda env and then pip install napari[all]
like it's recommended on napari.org, and then does conda install napari-aicsimageio
they will get everything re-installed. So the README should say to ensure java
and mvn
executables, and suggest conda install openjdk maven
before installing the plugin, right?
Yeah it's not that simple, you should be able to do that conda install in either order. Let me know if you find otherwise
If I make a conda env, install napari with pip, and then do:
mamba install napari-aicsimageio
, I get basically everything reinstalled:
Summary:
Install: 254 packages
Note: this is x86, because nd2 doesn't have arm64 on conda-forge (I made a PR for the migrator).
Ah I see what you're saying. Yeah conda doesn't check site packages. If you don't want napari to be reinstalled, then don't install napari-aicsimagio from conda, instead just do the bioformats bit
conda install bioformats_jar
The bioformats-jar conda recipe installs scyjava, which in turn installs maven and openjdk.
Basically, there are a many ways for someone to get the necessary dependencies, and I don't want to mandate the order or sources in which they do so. In most cases, using conda to install bioformats_jar is sufficient, and I think that is either in the readme or the error message no?
It was in the error for using
aicsimageio.readers.bioformats_reader.BioformatsReader("PyramidialCell.ims")
I would say certainly not obvious for someone using just napari and the plugin (as demonstrated by the existence o this thread π€£), especially if they used the GUI to install.
Anyhow, re: the conda install, using mamba install bioformats_jar
looks fine in a pip napari install:
+ bioformats_jar 2020.5.27 pyhd8ed1ab_0 conda-forge/noarch 15kB
+ jgo 1.0.4 pyhd8ed1ab_0 conda-forge/noarch Cached
+ jpype1 1.4.1 py39haaf3ac1_1 conda-forge/osx-arm64 Cached
+ libcxx 15.0.7 h75e25f2_0 conda-forge/osx-arm64 Cached
+ maven 3.9.0 hce30654_0 conda-forge/osx-arm64 Cached
+ openjdk 17.0.3 hf913c23_5 conda-forge/osx-arm64 Cached
+ packaging 23.0 pyhd8ed1ab_0 conda-forge/noarch Cached
+ psutil 5.9.4 py39h02fc5c5_0 conda-forge/osx-arm64 Cached
+ python_abi 3.9 3_cp39 conda-forge/osx-arm64 Cached
+ scyjava 1.9.0 pyhd8ed1ab_0 conda-forge/noarch Cached
I'll update the README.
Thanks
Other than updating the docs I'm not sure what more we can do here, so going to close.
Description
Bitplane imaris (.ims) is Bioformats supported file type that should be loaded into napari successfully with this plugin but hasn't worked for me. I'm not sure if it's something wrong with my environment or an actual bug.
Reproduction
None of the imaris demo files load when dragged and dropped into the napari window, including PyramidialCell.ims.
The error message is
To try and see if it was an issue with
napari-aicsimageio
oraicsimageio
, I did also installaicsimageio
and try to load it directly usingand I get an error to do with jpype which doesn't resolve even when I try all the instructions in the error message
So it might still be a bug in
aicsimageio
.Environment