haesleinhuepf / devbio-napari

BSD 3-Clause "New" or "Revised" License
43 stars 13 forks source link

devbio-napari-env for multi-users #57

Open grinic opened 5 days ago

grinic commented 5 days ago

Hi @haesleinhuepf , thanks a lot for your work on this great package!

I work in an imaging facility, and would like to install devbio-napari-env for all users in a read-only environment.

I have installed miniforge for all users (it gets installed on C:\conda\miniforge3), and I managed to successfully create other environments in read-only mode (e.g. cellpose).

However, when I run conda create --name devbio-napari-env napari=0.4.19 python=3.9 devbio-napari pyqt -c conda-forge -c pytorch I am only able to activate devbio-napari-env and open naparia when I am in an administrator command window.

In a normal command window, activating the environment gives:

H:\>conda activate devbio-napari-env
Access is denied.
The system cannot find the file specified.
Could Not Find C:\conda\miniforge3\envs\devbio-napari-env\Library\etc\OpenCL\vendros\temp.txt

(devbio-napari-env) H:\>

It seems the environment is activated anyhow. However, running naparia gets stuck and never opens the napari interface.

Any idea what might go wrong here? In cellpose environemnt, I had to modify the users right to allow writing access in the pycache folder, but in this case this also doesn't work.

Thanks a lot for the help!

haesleinhuepf commented 5 days ago

Hi @grinic ,

great idea! Thanks for reaching out! I've been working in a similar core facility for some years and we struggled often with users modifying installations - and breaking stuff for other people. That's why I recommend not installing Python, Napari or Fiji in a way that multiple users can access it. However, there is a way out: When a Windows user logs into a system for the first time, you can copy apps to their folder, where they have write-access. Let's see if git-bob knows how to do this:

git-bob comment on how to achive this: I would like to configure Windows in a way that whenever a user logs into the system for the first time, some apps are copied to their profile, e.g. Fiji, Napari, Python, and they can modify the installation without the risk to screw things up for others using the same computer, because the apps are stored in their user space. How can I do this?

github-actions[bot] commented 5 days ago

This message was generated by git-bob (version: 0.12.1dev, model: github_models:gpt-4o, log), an experimental AI-based assistant. It can make mistakes and has limitations. Check its messages carefully.

To achieve this, you can use a login script that triggers whenever a user logs into Windows for the first time. The script can copy the necessary applications from a central repository to the user's profile directory.

Here's a basic example of how you can achieve this using a batch script:

@echo off

REM Define source and target directories
set SOURCE_DIR=C:\central_apps\
set TARGET_DIR=%USERPROFILE%\local_apps\

REM Check if the apps have already been copied
IF NOT EXIST "%TARGET_DIR%app_marker.txt" (

    REM Create target directory if it doesn't exist
    IF NOT EXIST "%TARGET_DIR%" (
        mkdir "%TARGET_DIR%"
    )

    REM Copy all applications to the user's directory
    xcopy "%SOURCE_DIR%" "%TARGET_DIR%" /E /I /H /Y

    REM Create a marker to prevent re-copying
    echo "Apps copied on %date% at %time%" > "%TARGET_DIR%app_marker.txt"

)

REM Run Napari, Fiji, etc. from the copied location if desired
REM start "" "%TARGET_DIR%Napari\napari.exe"
REM start "" "%TARGET_DIR%Fiji\fiji-win64.exe"

exit

Set this script to run on user login through group policy or user profile settings. Adjust paths as necessary.

haesleinhuepf commented 5 days ago

Hey @grinic ,

do you think this might work?

Best, Robert

grinic commented 5 days ago

Thanks for the tip! I will have a look and see if we can set it up properly. In general though, we are working on virtual machines that do not have a lot of disk space (data access is directly to the servers), so copying the folder for every user doesn't seem like a scalable solution?

haesleinhuepf commented 4 days ago

Yes, it might require some disk space. Yet again: If one user installs a plugin to Fiji or Napari, which breaks it, all users will suffer, if they work with the same installation where everyone has write-access.