imagej / pyimagej

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

Setting up PyImageJ without internet access #287

Open KSchmidtACR opened 9 months ago

KSchmidtACR commented 9 months ago

Hello, I'm trying to set up PyImageJ to run on a server without internet access. I installed with conda and followed the instructions here But when I test my installation I get the following error

`Failed to bootstrap the artifact.

Possible solutions:

Full Maven error output: [ERROR] [ERROR] Some problems were encountered while processing the POMs: [ERROR] Non-resolvable import POM: The following artifacts could not be resolved: net.imagej:imagej:pom:2.3.0 (absent): Could not transfer artifact net.imagej:imagej:pom:2.3.0 from/to scijava.public (https://maven.scijava.org/content/groups/public): Connect to maven.scijava.org:443 [maven.scijava.org/144.92.48.199] failed: connect timed out @ 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/kschmidt/.jgo/net.imagej/imagej/2.3.0/96c7e6a6707857e3645e206740265f7cd7cb8259fa4e6088027a50d0c8d21865/pom.xml) has 3 errors [ERROR] Non-resolvable import POM: The following artifacts could not be resolved: net.imagej:imagej:pom:2.3.0 (absent): Could not transfer artifact net.imagej:imagej:pom:2.3.0 from/to scijava.public (https://maven.scijava.org/content/groups/public): Connect to maven.scijava.org:443 [maven.scijava.org/144.92.48.199] failed: connect timed out @ line 8, column 29 -> [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 "", line 1, in File "/home/kschmidt/miniconda3/envs/gable/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. `

I ran the PyImageJ doctor and get the response Great job! All looks good. What else do I need to do to get PyImageJ running without exposing my server to internet?

imagejan commented 9 months ago

@KSchmidtACR did you try the suggestions on the Troubleshooting page?

In particular, I assume that initializing with a local copy of Fiji (including imglib2-unsafe and imglib2-imglyb) could help, as described in point (4) below Could not transfer artifact:

https://github.com/imagej/pyimagej/blob/1.4.1/doc/Troubleshooting.md#could-not-transfer-artifact

KSchmidtACR commented 9 months ago

Yes I followed those suggestions. The error posted above is occurring while trying to initialize with a local copy of Fiji after downloading imglib2-unsafe and imglib2-imglyb and placing them in my local Fiji.app/jars directory.

elevans commented 1 week ago

Hi @KSchmidtACR, is this still an issue for you? I re-read your issue and I'm wondering if you are initializing PyImageJ "wrong". What I mean by that is the test code that we suggest users run attempts to download the needed Jars from maven via the internet:

python -c 'import imagej; ij = imagej.init("2.3.0"); print(ij.getVersion()); ij.dispose()'

To initialize a local installation you'd have to modify this to use the path to your Fiji.app folder. So something like this:

python -c 'import imagej; ij = imagej.init("/path/to/Fiji.app"); print(ij.getVersion()); ij.dispose()'