Closed carshadi closed 5 months ago
I've tested your example with pyimagej 1.4.1 on Win 11 and with the same entry point. I may not have the same conda env but I'm not sure it matters.
I can't reproduce your issue (un?)fortunately, so I can't be very helpful but maybe try to delete your cached jgo folder ?
/root/.jgo/sc.fiji/fiji/2.14.0/6ad50f45b0f3491affd3b43750c8c212c3c855c46dbb6becfc0463856a3d9f35/
My environment:
specs:
Hi @NicoKiaru ,
Thanks for attempting to reproduce it. I should have mentioned that I tried deleting both the .jgo and .m2 directories, to no avail.
However, I find that if I add the imagej endpoint as well, it works.
import imagej
import scyjava
ij = imagej.init(["net.imagej:imagej", "sc.fiji:fiji:2.14.0", "org.morphonets:SNT:4.2.1"])
I don't have a complete answer, but I wanted to mention that the first endpoint on the list is special, in that it brings the corresponding pom-scijava version management with it. So when you put net.imagej:imagej
first, it finds the latest release, which is 2.15.0 as of this writing, tied to pom-scijava 37.0.0. Whereas sc.fiji:fiji:2.14.0
is tied to pom-scijava 36.0.0.
As such, one thing you could try is—instead of prepending net.imagej:imagej
—instead change sc.fiji:fiji:2.14.0
to sc.fiji:2.15.1
, which is the newest release of Fiji, which also extends pom-scijava 37.0.0. Maybe it has an equivalent effect?
Hi @ctrueden ,
When I try with just ij = imagej.init(["sc.fiji:fiji:2.15.1"])
, I get this error
Failed to bootstrap the artifact.
Possible solutions:
* Double check the endpoint for correctness (https://search.maven.org/).
* Add needed repositories to ~/.jgorc [repositories] block (see README).
* Try with an explicit version number (release metadata might be wrong).
Full Maven error output:
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[ERROR] 'dependencies.dependency.version' for org.jogamp.gluegen:gluegen-rt:jar:natives-${scijava.platform.family.longest}-amd64 is missing. @ sc.fiji:fiji:2.15.1, /root/.m2/repository/sc/fiji/fiji/2.15.1/fiji-2.15.1.pom, line 860, column 15
[ERROR] 'dependencies.dependency.version' for org.jogamp.jogl:jogl-all:jar:natives-${scijava.platform.family.longest}-amd64 is missing. @ sc.fiji:fiji:2.15.1, /root/.m2/repository/sc/fiji/fiji/2.15.1/fiji-2.15.1.pom, line 865, column 15
[ERROR] 'dependencies.dependency.version' for net.imagej:imagej-legacy:jar is missing. @ line 10, column 248
[ERROR] 'dependencies.dependency.version' for org.scijava:scijava-config:jar is missing. @ line 10, column 458
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project sc.fiji-BOOTSTRAPPER:fiji-BOOTSTRAPPER:0 (/root/.jgo/sc.fiji/fiji/2.15.1/3befd69c0b00f78daaba3914941370bc10d53966e6392620b5d1204959c75b6a/pom.xml) has 4 errors
[ERROR] 'dependencies.dependency.version' for org.jogamp.gluegen:gluegen-rt:jar:natives-${scijava.platform.family.longest}-amd64 is missing. @ sc.fiji:fiji:2.15.1, /root/.m2/repository/sc/fiji/fiji/2.15.1/fiji-2.15.1.pom, line 860, column 15
[ERROR] 'dependencies.dependency.version' for org.jogamp.jogl:jogl-all:jar:natives-${scijava.platform.family.longest}-amd64 is missing. @ sc.fiji:fiji:2.15.1, /root/.m2/repository/sc/fiji/fiji/2.15.1/fiji-2.15.1.pom, line 865, column 15
[ERROR] 'dependencies.dependency.version' for net.imagej:imagej-legacy:jar is missing. @ line 10, column 248
[ERROR] 'dependencies.dependency.version' for org.scijava:scijava-config:jar is missing. @ line 10, column 458
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
***Invalid Initialization: you may be using a primary endpoint that lacks pom-scijava as a parent***
To keep all Java components at compatible versions we recommend using a primary endpoint with a pom-scijava parent.
For example, by putting 'net.imagej:imagej' first in your list of endpoints.
If you are sure you DO NOT want a primary endpoint with a pom-scijava parent, please re-initialize with 'add_legacy=False'.
Traceback (most recent call last):
File "/root/capsule/code/test.py", line 4, in <module>
ij = imagej.init("sc.fiji:fiji:2.15.1")
File "/opt/conda/lib/python3.10/site-packages/imagej/__init__.py", line 1202, in init
raise RuntimeError("Failed to create a JVM with the requested environment.")
RuntimeError: Failed to create a JVM with the requested environment.
Good news: I can reproduce this. :joy: I built a fresh pyimagej environment using mamba create -n pyimagej-fresh pyimagej=1.4.1
, activated it, and it happens to me as well in this environment. I also have an older working pyimagej environment, so now I can start debugging into the problem. Will keep you posted on any progress.
I was able to avoid the issue by upgrading pyimagej to the latest commit of the main branch (0fcfb16e402571802efa48e659c594e5cd873d41 as of this writing):
pip install git+https://github.com/imagej/pyimagej
Afterward, I am able to initialize ImageJ2 gateways again.
@elevans Looks like we have one more reason to get the next PyImageJ version released ASAP!
I totally agree!! I'm itching to get a new release off...I'll try to carve out some time the rest of the week to finish some additional testing.
Unfortunately I get the same errors when trying with both 5c32c1b31bb157dcfedb12f850d5ef07d9455c46 and https://github.com/imagej/pyimagej/commit/0fcfb16e402571802efa48e659c594e5cd873d41
Hi @carshadi,
I was trying to cut a new release of PyImageJ today when I ran into this issue. The problem is maven version 3.9.7
introduces a bug that breaks pyimagej's initialization. If you downgrade maven to 3.9.6
it should initialize.
mamba install maven=3.9.6
The reason Curtis and others (i.e. me!) weren't able to reproduce this was because we likely had an older maven
or existing jars in the .m2 and .jgo folders.
Can you give that a try and let us know if that resolves this? I'm updating our requirements to skip maven 3.9.7
.
Hi @elevans , that did the trick for me!
I've updated the scyjava
recipe on conda-forge to skip maven 3.9.7
. See https://github.com/conda-forge/scyjava-feedstock/pull/30.
Hi @ctrueden ,
I am running into a new issue trying to run Fiji + SNT through pyimagej. This configuration was working recently, but after I rebuilt my environment yesterday I am getting this error.
Output of
conda list
I am running Ubuntu 22.04