imagej / pyimagej

Use ImageJ from Python
https://pyimagej.readthedocs.io/
Other
475 stars 82 forks source link

Invalid endpoint with imagej.init('Applications/Fiji.app',mode='interactive') #240

Closed biosciflo closed 2 years ago

biosciflo commented 2 years ago

Hi

I am working on two different Windows Machines on one this following test code is working:

import os
import scyjava
import imagej

path = 'Applications/Fiji.app'

realpathpath=os.path.realpath(path)

scyjava.config.add_option('-Xmx10g') #10gb for JavaVM

ij = imagej.init(realpathpath,mode='interactive')

ij.ui().showUI()

on the other machine it is giving me some errors that I dont realy understand.

runfile('D:/x/Y/Z/BLA/BLUBB/openfiji.py', wdir='D:/x/Y/Z/BLA/BLUBB')
Traceback (most recent call last):

  File "...anaconda3\envs\imagejp3.8.13\lib\site-packages\spyder_kernels\py3compat.py", line 356, in compat_exec
    exec(code, globals, locals)

  File "d:\x\Y\Z\BLA\BLUBB\openfiji.py", line 20, in <module>
    ij = imagej.init('Applications/Fiji.app',mode='interactive')

  File "...anaconda3\envs\imagejp3.8.13\lib\site-packages\imagej\__init__.py", line 1191, in init
    success = _create_jvm(ij_dir_or_version_or_endpoint, mode, add_legacy)

  File "...anaconda3\envs\imagejp3.8.13\lib\site-packages\imagej\__init__.py", line 1401, in _create_jvm
    sj.start_jvm()

  File "...anaconda3\envs\imagejp3.8.13\lib\site-packages\scyjava\_java.py", line 177, in start_jvm
    _, workspace = jgo.resolve_dependencies(

  File "...anaconda3\envs\imagejp3.8.13\lib\site-packages\jgo\jgo.py", line 587, in resolve_dependencies
    raise InvalidEndpoint(

InvalidEndpoint: Invalid endpoint <jgo.Endpoint:g=org.scijava,a=scijava-config,v=MANAGED,c=None,main=None>: A primary endpoint cannot also be version=MANAGED.

The Fiji startup with .... ij = imagej.init('sc.fiji:fiji:2.5.0',mode='interactive')

instead of .... ij = imagej.init(realpathpath,mode='interactive')

...is working on both machines.

Anyone a clue what it could be ?

some infos: Pyhton=3.8.13 Spyder=5.3.3 Conda=22.9.0

imagejan commented 2 years ago

Hi @biosciflo,

what's the version of jgo on your machines?

ctrueden commented 2 years ago

@biosciflo This looks like a bug in PyImageJ 1.3.0 that was fixed in version 1.3.1; see a33b3eb8e4f20f2277f08e5baa0484e848b05243. Is it possible that the machine with the problem is running PyImageJ 1.3.0 rather than 1.3.1?

biosciflo commented 2 years ago

@biosciflo This looks like a bug in PyImageJ 1.3.0 that was fixed in version 1.3.1; see a33b3eb. Is it possible that the machine with the problem is running PyImageJ 1.3.0 rather than 1.3.1?

Yeah, you were completely right... that was the problem ... Thanks a lot for the quick reply