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

micromamba in Windows 11: when root is in a mapped drive, activate/deactivate command gives error "The specified path is invalid" due to openssl_activate-win.bat or openssl_deactivate-win.bat #3774

Open
3 tasks done
gitfish77 opened this issue Jan 28, 2025 · 0 comments
Labels
where::windows Windows-specific issues

Comments

@gitfish77
Copy link

gitfish77 commented Jan 28, 2025

Troubleshooting docs

  • My problem is not solved in the Troubleshooting docs

Anaconda default channels

  • I do NOT use the Anaconda default channels (pkgs/* etc.)

How did you install Mamba?

Micromamba

Search tried in issue tracker

searched "specified path" or "openssl_activate" and got no match

Latest version of Mamba

  • My problem is not solved with the latest version

Tried in Conda?

I didn't try

Describe your issue

The folllowing are repro steps with cmd.exe shell. The similar issue also happened with PowerShell shell.
Also "micromamba run" met similar error in a mapped drive.

// [actually inside a Win11 VM] open a cmd.exe Command Prompt window:

C:\Users\devf>net use x:
Local name        x:
Remote name       \\vmware-host\Shared Folders
Resource type     Disk
The command completed successfully.

C:\Users\devf>micromamba shell init --shell cmd.exe --root-prefix=x:\project\tmp\mamba_root
Setting cmd.exe AUTORUN to: "\\vmware-host\Shared Folders\project\tmp\mamba_root\condabin\mamba_hook.bat"
Windows long-path support already enabled. (Windows version = 10.0.22000)

// close the cmd.exe Command Prompt window and open a new one:

C:\Users\devf>micromamba env list
  Name  Active  Path
----------------------------------------------------------------------------------------------
  base  *       \\vmware-host\Shared Folders\project\tmp\mamba_root

C:\Users\devf>micromamba create -n env_py310test python==3.10.1
{... Transaction finished ...}

C:\Users\devf>micromamba env list
  Name           Active  Path
-------------------------------------------------------------------------------------------------------
  base           *       \\vmware-host\Shared Folders\project\tmp\mamba_root
  env_py310test          \\vmware-host\Shared Folders\project\tmp\mamba_root\envs\env_py310test

C:\Users\devf>micromamba activate env_py310test
The specified path is invalid.

(env_py310test) C:\Users\devf>python -c "import sys; print(sys.version)"
3.10.1 | packaged by conda-forge | (main, Dec 22 2021, 01:34:40) [MSC v.1929 64 bit (AMD64)]

(env_py310test) C:\Users\devf>micromamba deactivate
The specified path is invalid.

I investigated the issue, and the cause should be from the following script:
X:\project\tmp\mamba_root\condabin>notepad _micromamba_activate.bat
// in executing the above script
// step a] @"%MAMBA_EXE%" shell %* --shell cmd.exe 1>%UNIQUE%
// this step generates a temp script, e.g. _TEMP_SCRIPT_PATH="C:\Users\devf\AppData\Local\Temp\mamba_act44uefpcq7c.bat"
// step b] @CALL "%_TEMP_SCRIPT_PATH%"
// this step calls the above temp script, and failed at the first and/or last line in the temp script like:
@CALL "\\\\vmware-host\\Shared Folders\\project\\tmp\\mamba_ps\\envs\\env_py310test\\etc\\conda\\activate.d\\openssl_activate-win.bat"
The specified path is invalid.
// Actually the following command also failed:
type "\\\\vmware-host\\Shared Folders\\project\\tmp\\mamba_ps\\envs\\env_py310test\\etc\\conda\\activate.d\\openssl_activate-win.bat"
The specified path is invalid.
// the temp script file exists, but the temp script wrongly uses "\\" instead of the desired "\".

// Interestingly, when the micromamba root points to a local drive, the line looks like:
@CALL "C:\\tmp\\mamba\\micromamba\\envs\\env_py310test\\etc\\conda\\activate.d\\openssl_activate-win.bat"
type "C:\\tmp\\mamba\\micromamba\\envs\\env_py310test\\etc\\conda\\activate.d\\openssl_activate-win.bat"
// the above script path also has redudant "\\" instead of desired "\", yet Win11 somehow allows accessing the file.

The fix should be:
Generate the temp script in the above step a] with micromamba.exe, to have "\" instead of "\\" when invoking openssl_activate-win.bat or openssl_deactivate-win.bat. There can be one or two @call to the openssl_*.bat script in the temp script.

Actually there are more error cases related to the "\\" vs "\"
$ micromamba run -n env_py310test python -c "import sys; print(sys.version)"
...
trace    libmamba Compute configurable 'use_target_prefix_fallback'
trace    libmamba Compute configurable 'target_prefix'
critical libmamba weakly_canonical: The specified path is invalid.: "\\\\vmware-host\\Shared Folders\\project\\tmp\\mamba_ps\\envs\\env_py310test\\"
info     libmamba ****************** Backtrace End ********************

I tried with PowerShell root in a mapped drive, and the similar error happens. I don't know the exact cause though.

mamba info / micromamba info

(env_py310test) C:\Users\devf>micromamba info

       libmamba version : 2.0.5
     micromamba version : 2.0.5
           curl version : libcurl/8.8.0-DEV Schannel zlib/1.3.1
     libarchive version : libarchive 3.7.2 zlib/1.3.1 liblzma/5.6.2 bz2lib/1.0.8 liblz4/1.9.4 libzstd/1.5.6
       envs directories : \\vmware-host\Shared Folders\project\tmp\mamba_root\envs
          package cache : \\vmware-host\Shared Folders\project\tmp\mamba_root\pkgs
                          C:\Users\devf\.mamba\pkgs
                          C:\Users\devf\AppData\Roaming\.mamba\pkgs
            environment : env_py310test (active)
           env location : \\vmware-host\Shared Folders\project\tmp\mamba_root\envs\env_py310test
      user config files : C:\Users\devf\.mambarc
 populated config files :
       virtual packages : __win=10.0.22000=0
                          __archspec=1=x86_64
               channels : https://conda.anaconda.org/conda-forge/noarch
                          https://conda.anaconda.org/conda-forge/win-64
       base environment : \\vmware-host\Shared Folders\project\tmp\mamba_root
               platform : win-64

Logs

environment.yml

~/.condarc

@gitfish77 gitfish77 changed the title micromamba in Windows 11: when root is in a mapped drive, activate command gives error "The specified path is invalid" due to openssl_activate-win.bat or openssl_deactivate-win.bat micromamba in Windows 11: when root is in a mapped drive, activate/deactivate command gives error "The specified path is invalid" due to openssl_activate-win.bat or openssl_deactivate-win.bat Jan 28, 2025
@jjerphan jjerphan added the where::windows Windows-specific issues label Jan 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
where::windows Windows-specific issues
Projects
None yet
Development

No branches or pull requests

2 participants