Closed VVSBN closed 1 year ago
@VVSBN Thanks for the detailed report, and sorry for your woes!
Firstly: are you sure you're using the latest release of pyimagej? What does:
python -c 'import imagej; print(imagej.__version__)'
say? The latest release is 1.3.2. If your version is older, try updating it.
Then, could you please try:
import imagej.doctor
imagej.doctor.debug_to_stderr()
import imagej
ij = imagej.init('2.9.0')
?
The debug_to_stderr()
call will make the initialization print out more details of what it is doing. If it still fails, there might be an additional clue why in the extended output.
The init('2.9.0')
will set a reproducible version of ImageJ2, which is also worth a try.
Another thing to try is to rm -rf ~/.jgo
before launching Python, which clears your jgo cache, which might make the default imagej.init()
behave better.
Please let us know how it goes! Happy to help troubleshoot further if things still aren't working.
Thanks for the quick reply :).
For the first; the version is indeed 1.3.2;
>>> print(imagej.__version__)
1.3.2
As for the response I get with the debug_to_stderr();
>>> import imagej.doctor
>>> imagej.doctor.debug_to_stderr()
>>> import imagej
>>> ij = imagej.init('2.9.0')
ImageJ2 version given: 2.9.0
Adding jars from endpoints ['net.imagej:imagej:2.9.0', 'net.imagej:imagej-legacy:MANAGED', 'org.scijava:scijava-config:MANAGED', 'io.scif:scifio-labeling:0.3.1', 'net.imglib2:imglib2-imglyb:1.0.1']
Using endpoints ['net.imagej:imagej:2.9.0', 'io.scif:scifio-labeling:0.3.1', 'net.imagej:imagej-legacy:MANAGED', 'net.imglib2:imglib2-imglyb:1.0.1', 'org.scijava:scijava-config:MANAGED']
Getting verbose level: 0
Getting verbose level: 0
Returning expanded coordinate net.imagej:imagej:2.9.0.
Returning expanded coordinate io.scif:scifio-labeling:0.3.1.
Returning expanded coordinate net.imagej:imagej-legacy:MANAGED.
Returning expanded coordinate net.imglib2:imglib2-imglyb:1.0.1.
Returning expanded coordinate org.scijava:scijava-config:MANAGED.
First time start-up may be slow. Downloaded dependencies will be cached for shorter start-up times in subsequent executions.
Executing: ('/home/vanstva3/mambaforge/envs/pyimagej/bin/mvn', '-B', '-f', '/home/vanstva3/.jgo/net.imagej/imagej/2.9.0/83edb2bdc89e2cf2c7b5d9553ee13ebbefd6c27eaa8b70c80f3b5af7e78f744b/pom.xml', 'dependency:resolve')
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:
[INFO] Scanning for projects...
[INFO] Downloading from scijava.public: https://maven.scijava.org/content/groups/public/net/imagej/imagej/2.9.0/imagej-2.9.0.pom
[INFO] Downloading from central: https://repo.maven.apache.org/maven2/net/imagej/imagej/2.9.0/imagej-2.9.0.pom
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[ERROR] Non-resolvable import POM: Could not transfer artifact net.imagej:imagej:pom:2.9.0 from/to scijava.public (https://maven.scijava.org/content/groups/public): transfer failed for https://maven.scijava.org/content/groups/public/net/imagej/imagej/2.9.0/imagej-2.9.0.pom @ line 8, column 29
[ERROR] 'dependencies.dependency.version' for net.imagej:imagej-legacy:jar is missing. @ line 10, column 252
[ERROR] 'dependencies.dependency.version' for org.scijava:scijava-config:jar is missing. @ line 10, column 462
@
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project net.imagej-BOOTSTRAPPER:imagej-BOOTSTRAPPER:0 (/home/vanstva3/.jgo/net.imagej/imagej/2.9.0/83edb2bdc89e2cf2c7b5d9553ee13ebbefd6c27eaa8b70c80f3b5af7e78f744b/pom.xml) has 3 errors
[ERROR] Non-resolvable import POM: Could not transfer artifact net.imagej:imagej:pom:2.9.0 from/to scijava.public (https://maven.scijava.org/content/groups/public): transfer failed for https://maven.scijava.org/content/groups/public/net/imagej/imagej/2.9.0/imagej-2.9.0.pom @ line 8, column 29: Unknown host maven.scijava.org: Name or service not known -> [Help 2]
[ERROR] 'dependencies.dependency.version' for net.imagej:imagej-legacy:jar is missing. @ line 10, column 252
[ERROR] 'dependencies.dependency.version' for org.scijava:scijava-config:jar is missing. @ line 10, column 462
[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
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException
***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 "<stdin>", line 1, in <module>
File "/home/vanstva3/mambaforge/envs/pyimagej/lib/python3.11/site-packages/imagej/__init__.py", line 1201, in init
raise RuntimeError("Failed to create a JVM with the requested environment.")
RuntimeError: Failed to create a JVM with the requested environment.
I just tried to clear the jgo cache and then re-run init, but I still end up with the same JVM error unfortunately...
Again thanks for your help, really appreciate it!
@VVSBN This line looks like a problem to me:
Could not transfer artifact net.imagej:imagej:pom:2.9.0 from/to scijava.public (https://maven.scijava.org/content/groups/public): transfer failed for https://maven.scijava.org/content/groups/public/net/imagej/imagej/2.9.0/imagej-2.9.0.pom
Are you able to access https://maven.scijava.org/content/groups/public/net/imagej/imagej/2.9.0/imagej-2.9.0.pom successfully in your web browser? Is it possible you are behind some kind of firewall preventing Maven from downloading this file? If so, you can use a proxy by following these instructions from the documentation.
Hi,
I just tried the link and it works fine strangely enough.. I also tried the options to tell Java to use the system proxy settings and to use my local Fiji app after moving the jar files but still get the JVM error notice for some reason..
@VVSBN Is it possible that you have a firewall which blocks some applications but not others? The mvn
tool uses java
, so if Java cannot access the link, then Maven and therefore PyImageJ won't be able to do so either.
What happens if you run this command in the Terminal?
/home/vanstva3/mambaforge/envs/pyimagej/bin/mvn -B -f /home/vanstva3/.jgo/net.imagej/imagej/2.9.0/83edb2bdc89e2cf2c7b5d9553ee13ebbefd6c27eaa8b70c80f3b5af7e78f744b/pom.xml dependency:resolve
It if still doesn't work: what if you rm -rf ~/.m2/repository
(i.e. clear Maven cache) and run it again?
Do you have any other computers available to use PyImageJ? If so: do they also fail while on the same network as your current machine? And what if you put your current machine onto a different network, e.g. VPN it somewhere, or if it's a laptop, move it to a different location? Does it still fail there?
I think we are seeing the same issue in itkwidgets CI. xref: https://github.com/InsightSoftwareConsortium/itkwidgets/pull/601
The download was working fine in CI until recently. Last recorded success was 5 days ago: https://github.com/InsightSoftwareConsortium/itkwidgets/actions
@thewtex I think the itkwidgets issue is different. Looking closely at the build log, I see this line:
PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Which in my experience is caused by a too-old Java without support for the Let's Encrypt SSL certificate used by maven.scijava.org. But it's weird that the CI would suddenly be using a too-old Java, when it previously worked, eh? So I wonder if something else is going on this time.
Another possibility is a recently expired root certificate. That happened once before in May 2021 IIRC, and required a server-side fix on every machine using SSL... but then I would expect builds to be failing on everyone's machines, not just the CI.
Let's continue this branch of the conversation at https://github.com/InsightSoftwareConsortium/itkwidgets/pull/601
Sorry for the late reply, I was waiting for our IT department to get back to me with some information. It turned out be to be indeed a firewall issue, they found a workaround and it works now. Thank you so much for your help and pointing out the potential firewall issue, would have never came up with that myself..
@VVSBN Awesome! Glad you got it solved.
Hi,
I am having some issues related to pyimagej initialization, always receiving JVM creation errors. I have already gone through the previous posts concerning seemingly similar issues but it did not yet get resolved unfortunately. Happy to have some help :).
Below my output from imagej.doctor:
`
`
I am not using newer versions from Java so also assume that this should be ok but feel free to correct me if I am wrong.
When I import imagej, everything goes fine. However when I try to run ij = imagej.init() or locating it to my local fiji, I always get the following:
`
Am trying to get it to work now for several days and don't really see any other options left so would be extremely happy for any input...
Thanks!