You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pyimagej image.init() FileNotFoundError: [Errno 2] No such file or directory: ~.m2/repository/io/scif/scifio-labeling/0.3.1/scifio-labeling-0.3.1.jar
#278
Open
benwilks opened this issue
Jul 8, 2023
· 3 comments
Importing imagej works but when i run: ij = imagej.init(os.path.join(base_dir, 'Fiji.app'), mode='headless')
I get the following error related to
FileNotFoundError: No such file or directory: ~/.m2/repository/io/scif/scifio-labeling/0.3.1/scifio-labeling-0.3.1.jar' -> ~/.jgo/io.scif/scifio-labeling/0.3.1/64d37f756ce9b31af4b9413862ddb4fdae7bd1d10bdfadd417d693b8642fc2e3/scifio-labeling-0.3.1.jar
Local path to ImageJ2 installation given: /home/jovyan/code/image-analysis/imagej/Fiji.app
Added 507 JARs to the Java classpath.
Adding jars from endpoints ['io.scif:scifio-labeling:0.3.1', 'net.imglib2:imglib2-imglyb:1.1.0']
Using endpoints ['io.scif:scifio-labeling:0.3.1', 'net.imglib2:imglib2-imglyb:1.1.0']
Getting verbose level: 2
Getting verbose level: 2
Returning expanded coordinate io.scif:scifio-labeling:0.3.1.
Returning expanded coordinate net.imglib2:imglib2-imglyb:1.1.0.
First time start-up may be slow. Downloaded dependencies will be cached for shorter start-up times in subsequent executions.
Executing: ('/opt/conda/envs/pyimagej/bin/mvn', '-B', '-f', '/home/jovyan/.jgo/io.scif/scifio-labeling/0.3.1/64d37f756ce9b31af4b9413862ddb4fdae7bd1d10bdfadd417d693b8642fc2e3/pom.xml', 'dependency:resolve', '-X')
Relevant mvn output: [INFO] io.scif:scifio-labeling:jar:0.3.1:compile -- module io.scif.labeling [auto]
Linking source /home/jovyan/.m2/repository/io/scif/scifio-labeling/0.3.1/scifio-labeling-0.3.1.jar to target /home/jovyan/.jgo/io.scif/scifio-labeling/0.3.1/64d37f756ce9b31af4b9413862ddb4fdae7bd1d10bdfadd417d693b8642fc2e3/scifio-labeling-0.3.1.jar with link_type auto
Linking source /home/jovyan/.m2/repository/io/scif/scifio-labeling/0.3.1/scifio-labeling-0.3.1.jar to target /home/jovyan/.jgo/io.scif/scifio-labeling/0.3.1/64d37f756ce9b31af4b9413862ddb4fdae7bd1d10bdfadd417d693b8642fc2e3/scifio-labeling-0.3.1.jar with link_type hard
FileNotFoundError Traceback (most recent call last)
Cell In[7], line 1
----> 1 ij = imagej.init(os.path.join(base_dir, 'Fiji.app'), mode='headless')
File /opt/conda/envs/pyimagej/lib/python3.8/site-packages/imagej/init.py:1200, in init(ij_dir_or_version_or_endpoint, mode, add_legacy, headless)
1197 raise EnvironmentError("Sorry, the interactive mode is not available on macOS.")
1199 if not sj.jvm_started():
-> 1200 success = _create_jvm(ij_dir_or_version_or_endpoint, mode, add_legacy)
1201 if not success:
1202 raise RuntimeError("Failed to create a JVM with the requested environment.")
File /opt/conda/envs/pyimagej/lib/python3.8/site-packages/imagej/init.py:1424, in _create_jvm(ij_dir_or_version_or_endpoint, mode, add_legacy)
1421 sj.config.endpoints.extend(original_endpoints)
1423 try:
-> 1424 sj.start_jvm()
1425 except subprocess.CalledProcessError as e:
1426 # Check to see if initialization failed due to "un-managed"
1427 # imagej-legacy
1428 err_lines = []
FileNotFoundError: [Errno 2] No such file or directory: '/home/jovyan/.m2/repository/io/scif/scifio-labeling/0.3.1/scifio-labeling-0.3.1.jar' -> '/home/jovyan/.jgo/io.scif/scifio-labeling/0.3.1/64d37f756ce9b31af4b9413862ddb4fdae7bd1d10bdfadd417d693b8642fc2e3/scifio-labeling-0.3.1.jar'
Running ImageJ doctor doesn't show any problems import imagej.doctor imagej.doctor.checkup()
@benwilks Sorry for the slow reply. Something went sideways trying to download the scifio-labeling library from Maven, and then when PyImageJ (via jgo) tried to include it in the environment, it didn't work because the scifio-labeling-0.3.1.jar was not in the expected location of ~/.m2/repository. I wonder if this is because your Maven installation (which looks like it came from conda-forge) downloaded the library elsewhere without jgo understanding that.
With your pyimagej environment active, you can try to run:
We want to see where the local .m2/repository resides. As you can see, mine is in my home directory, but maybe yours is somewhere else?
But you know, now that I wrote all this out, it actually might be something else going wrong: is it possible that Docker does not like the attempt to hard-link? From your log above, the attempt is:
which only works when the source and destination are on the same physical disk partition. Maybe Docker does not like hard links in general? I'm not sure, but you can try adding the following configuration step to your script:
One other thing: I just stumbled over #280, which is likely to bite you right now since you are also trying to build a wrapped local Fiji installation. In the meantime, you might want to consider using sc.fiji:fiji:2.14.0 instead as your endpoint, rather than curling down fiji-linux64.zip, as long as you don't need to customize your installation with additional plugins afterward.
Finally, if you have sufficient Python programming experience, and you are able to figure this out, it would be awesome if you could think about how to improve the imagej.doctor to catch this situation in future in case other people have the same problem.
Hi,
I'm having trouble running pyimagej image.init() installed with conda/mamba in a docker container.
Importing imagej works but when i run:
ij = imagej.init(os.path.join(base_dir, 'Fiji.app'), mode='headless')
I get the following error related to
Running ImageJ doctor doesn't show any problems
import imagej.doctor imagej.doctor.checkup()
The text was updated successfully, but these errors were encountered: