Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails when trying to install Micromamba #15

Open
comatose-tortoise opened this issue Mar 21, 2024 · 23 comments
Open

Fails when trying to install Micromamba #15

comatose-tortoise opened this issue Mar 21, 2024 · 23 comments

Comments

@comatose-tortoise
Copy link

comatose-tortoise commented Mar 21, 2024

Trying to test this plugin but when at the step of installing a model, it fails immediately when trying to install Micromamba.

Sonoma 14.4
M3 Max

Console shows this:

java.io.IOException: Failed to create Micromamba default directory /. Please try installing it in another directory.
	at io.bioimage.modelrunner.apposed.appose.Mamba.decompressMicromamba(Mamba.java:401)
	at io.bioimage.modelrunner.apposed.appose.Mamba.installMicromamba(Mamba.java:426)
	at ai.nets.samj.SamEnvManager.installMambaPython(SamEnvManager.java:951)
	at ai.nets.samj.SamEnvManager.installEfficientSAMSmall(SamEnvManager.java:998)
	at ai.nets.samj.gui.SAMModelPanel.lambda$createInstallationThread$7(SAMModelPanel.java:311)
	at java.base/java.lang.Thread.run(Thread.java:829)

I already have Mamba installed using Homebrew. Why is it trying to install Micromamba?

@carlosuc3m
Copy link
Contributor

HEllo @comatose-tortoise thanks for giving SAMJ a try!

Where is you Fiji distribution installed? I have observed that installation fails if it is on the Downloads folder of a Mac.

SAMJ installs micromamba to avoid altering the user installation. Downloading its own micromamba it ensures complete control over the environments

@comatose-tortoise
Copy link
Author

It is located in the Applications dir. I installed it to run natively on Apple Silicon using this: https://github.com/ij-plugins/ijp-imagej-launcher#installing-fiji-on-mac-os-x-arm64

Could that be why It's not working?

@carlosuc3m
Copy link
Contributor

mmm i doubt it, it seems that the error is related to permissions when trying to create the folder appose_arm64 inside of the Fiji folder.

Could you try moving Fiji to another directory, for example Documents?

@comatose-tortoise
Copy link
Author

Nope, same thing happens if I start it from Documents.

@carlosuc3m
Copy link
Contributor

can you paste error again please? To see if there is something diffreent

@comatose-tortoise
Copy link
Author

java.io.IOException: Failed to create Micromamba default directory /. Please try installing it in another directory.
	at io.bioimage.modelrunner.apposed.appose.Mamba.decompressMicromamba(Mamba.java:401)
	at io.bioimage.modelrunner.apposed.appose.Mamba.installMicromamba(Mamba.java:426)
	at ai.nets.samj.SamEnvManager.installMambaPython(SamEnvManager.java:951)
	at ai.nets.samj.SamEnvManager.installEfficientSAMSmall(SamEnvManager.java:998)
	at ai.nets.samj.gui.SAMModelPanel.lambda$createInstallationThread$7(SAMModelPanel.java:311)
	at java.base/java.lang.Thread.run(Thread.java:829)

Identical as far as I can see

@xulman
Copy link
Contributor

xulman commented Mar 21, 2024

Failed to create Micromamba default directory /. .. to root directory !?

in my case (Linux) the micromamba ended up in my home directory
maybe the home folder resolution is failing on some Mac OSes?

@xulman
Copy link
Contributor

xulman commented Mar 21, 2024

so it actually wants to find where your Fiji.app is so that it can create the appose_... folder in it

this is what happened

java.io.IOException: Failed to create Micromamba default directory /home/ulman/Apps/Fiji_SAMJ.app. Please try installing it in another directory.
	at io.bioimage.modelrunner.apposed.appose.Mamba.decompressMicromamba(Mamba.java:401)

(that's my path to my Fiji with SAMJ)
when I set

dr-xr-xr-x 1 ulman users 432 Mar 21 14:45 Fiji_SAMJ.app/

@xulman
Copy link
Contributor

xulman commented Mar 21, 2024

@comatose-tortoise I know this is not the ideal (and final) solution can you, pls, maybe try to place your Fiji to some innocent folder like /temp/abcd/FIji.app.. something that's not a "hot OS folder"?

@xulman
Copy link
Contributor

xulman commented Mar 21, 2024

(all these Documents, Desktop, Downloads, Program Files,App or Apps on Mac.... should be fine... but one never knows.. I live happier since I started avoiding them)

@xulman
Copy link
Contributor

xulman commented Mar 21, 2024

@comatose-tortoise
I have just checked our src code and it seems we're doing something that can be reproduced from Fiji using the .py Jython script:
Screenshot_20240321_150401

what does this do on your side?

@carlosuc3m
Copy link
Contributor

yes it is weird that on certain Macs it has problems finding the current working dir. Do you have any idea @xulman ?

I will try to dig deeper on this issue and get back to you @comatose-tortoise

@comatose-tortoise
Copy link
Author

@xulman
Screenshot 2024-03-21 at 17 09 40

@carlosuc3m
Copy link
Contributor

maybe remove the space in File("vlado") .getAbsolutePath to File("vlado").getAbsolutePath ?

@comatose-tortoise
Copy link
Author

Nope, same error

@xulman
Copy link
Contributor

xulman commented Mar 21, 2024

and try to change the type of the file/script to Python, in the menu language... or just rename to .py

@xulman
Copy link
Contributor

xulman commented Mar 21, 2024

Screenshot_20240321_174915

@comatose-tortoise
Copy link
Author

comatose-tortoise commented Mar 21, 2024

@xulman

You're absolutely right, I had selected Java for some reason 🤯

image

I have no idea where it created "vlad", though.

@xulman
Copy link
Contributor

xulman commented Mar 21, 2024

it didn't create anything, it only created an object representing certain path....

on many systems, Google says, the (Java) construct new File("folder_name") should represent a path to the /current_working_directory/folder_name... apparently not your system... there it represents root_folder/folder_name which is what the test is saying... and on most unix systems one cannot create files in root folder (unless one is root)

thank you for the test, we have now confirmed (we believe :-) ) the source of the problem, @carlosuc3m and myself we would create a fix ASAP and let you know here

@comatose-tortoise
Copy link
Author

Awesome!

@xulman
Copy link
Contributor

xulman commented Mar 22, 2024

@comatose-tortoise

Can we still ask you for one experiment? (please 🙏 )

from java.lang import System
from java.io import File
from java.nio.file import FileSystems

# this one we're using, Baeldung says "nonstadard" way
print("Path = "+ File("").getAbsolutePath())

# these two should be standard
# this one Baeldung described w/o any further restrictions
print("CWD  = "+ System.getProperty("user.dir"))
#
# this one is theoretically available since java1.7,
# despite very old I could still imagine that some systems
# might have not adopted using it...
print("NIO  = "+ FileSystems.getDefault().getPath("").toAbsolutePath().toString() )

# user home as a backup backup?? not sure, better to stop and complain instead
print("user home = "+System.getProperty("user.home"))

what would be the outcome of that Jython script in Fiji, please?

@comatose-tortoise
Copy link
Author

comatose-tortoise commented Mar 22, 2024

This is the output:

Started New_.py at Fri Mar 22 13:23:41 CET 2024
Path = /
CWD  = /
NIO  = /
user home = /Users/<username>

@xulman
Copy link
Contributor

xulman commented Mar 22, 2024

@comatose-tortoise thank you very much for the quick test

(it turned out the problem is actually little different that we thought originally,
still we see light at the end of the tunnel :-) )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants