Pyimagj not initializing: not found

Hi everyone,
so I’m trying to run pyimagej (great idea, by the way). However, when I try to initialize ImageJ by:

ij = imagej.init()

after having imported imagej by:

import imagej

I get the following error:

Traceback (most recent call last):

  File "<ipython-input-10-ebc998cadaf9>", line 1, in <module>

AttributeError: module 'imagej' has no attribute '__version__'

ij = imagej.init()
Traceback (most recent call last):

  File "<ipython-input-11-a1762181331d>", line 1, in <module>
    ij = imagej.init()

  File "/home/my_user/Programs/anaconda3/envs/pyimagej/lib/python3.7/site-packages/imagej/", line 126, in init
    import imglyb

  File "/home/my_user/Programs/anaconda3/envs/pyimagej/lib/python3.7/site-packages/imglyb/", line 38, in <module>
    config = _init_jvm_options()

  File "/home/my_user/Programs/anaconda3/envs/pyimagej/lib/python3.7/site-packages/imglyb/", line 33, in _init_jvm_options
    import scyjava

  File "/home/my_user/Programs/anaconda3/envs/pyimagej/lib/python3.7/site-packages/scyjava/", line 140, in <module>
    jnius = _init_jvm()

  File "/home/my_user/Programs/anaconda3/envs/pyimagej/lib/python3.7/site-packages/scyjava/", line 131, in _init_jvm
    import jnius

  File "/home/my_user/Programs/anaconda3/envs/pyimagej/lib/python3.7/site-packages/jnius/", line 42, in <module>
    from .reflect import *  # noqa

  File "/home/my_user/Programs/anaconda3/envs/pyimagej/lib/python3.7/site-packages/jnius/", line 17, in <module>
    class Class(with_metaclass(MetaJavaClass, JavaClass)):

  File "/home/my_user/Programs/anaconda3/envs/pyimagej/lib/python3.7/site-packages/", line 856, in __new__
    return meta(name, resolved_bases, d)

  File "jnius/jnius_export_class.pxi", line 114, in jnius.MetaJavaClass.__new__

  File "jnius/jnius_export_class.pxi", line 164, in jnius.MetaJavaClass.resolve_class

  File "jnius/jnius_env.pxi", line 11, in jnius.get_jnienv

  File "jnius/jnius_jvm_dlopen.pxi", line 118, in jnius.get_platform_jnienv

  File "jnius/jnius_jvm_dlopen.pxi", line 87, in jnius.create_jnienv

SystemError: Error calling dlopen(b'/home/my_user/Programs/anaconda3/envs/pyimagej/lib/server/': b'/home/my_user/Programs/anaconda3/envs/pyimagej/lib/server/ cannot open shared object file: No such file or directory'

My context:

-Installed pyimagej through conda by:

conda create -n pyimagej -c conda-forge pyimagej openjdk=8
conda activate pyimagej

Hence, I have an Anaconda environment called pyimagej.

I’m running Ubuntu 20.04.

Has anyone encountered a similar problem? I’m assuming that it’s a problem with the JVM, but I’m not sure, neither I know how to work around it. All help is appreciated :slight_smile:

@mpinkert @ctrueden any ideas? Again, great work and idea! Kudos!

Sorry for the delay in reply, @Jorge_Cordero_Gonzal. We are approaching a new release of PyImageJ, which substantially changes how the Java bridge works under the hood. I’ll reply back here again once that release is ready for you to test; hopefully it will eliminate the issues you are seeing now.


Thanks for your reply @ctrueden!
Looking forward to see the new release :slight_smile:

@Jorge_Cordero_Gonzal I released pyimagej 1.0.0 to PyPI. It should propagate to conda-forge in the next few hours. Please test and let us know how it goes! :crossed_fingers: