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

Could not find Windows version by calling 'ver' #3359

Open
3 tasks done
NinjaCats opened this issue Jul 22, 2024 · 2 comments
Open
3 tasks done

Could not find Windows version by calling 'ver' #3359

NinjaCats opened this issue Jul 22, 2024 · 2 comments
Labels
1.x Related to mamba 1.x branch/versions where::windows Windows-specific issues

Comments

@NinjaCats
Copy link

NinjaCats commented Jul 22, 2024

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

type::bug

Latest version of Mamba

  • My problem is not solved with the latest version

Tried in Conda?

Not applicable

Describe your issue

I receive that bug;

conda was not installed on my computer

Shell Ver: PowerShell 7.4.3
System Ver: Microsoft Windows [Ver 10.0.19045.4651]

Discrabe

  • warning libmamba Could not find Windows version by calling 'ver'
    Please file a bug report.
  • warning libmamba Not setting long path registry key; Windows version must be at least 10 with the fall 2016 "Anniversary update" or newer.

that command the found in powershell

  • ver: The term 'ver' is not recognized as a name of a cmdlet, function, script file, or executable program.
    Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

and run cmd /c ver

  • Microsoft Windows [Ver 10.0.19045.4651]

mamba info / micromamba info

libmamba version : 1.5.8
     micromamba version : 1.5.8
           curl version : libcurl/8.2.1-DEV Schannel zlib/1.2.13
     libarchive version : libarchive 3.6.2 zlib/1.2.13 liblzma/5.4.3 bz2lib/1.0.8 liblz4/1.9.4 libzstd/1.5.5
       envs directories : C:\Users\*******\micromamba\envs
          package cache : C:\Users\*******\micromamba\pkgs
                          C:\Users\*******\.mamba\pkgs
                          C:\Users\*******\AppData\Roaming\.mamba\pkgs
            environment : None (not found)
           env location : -
      user config files : C:\Users\*******\.mambarc
 populated config files : C:\Users\*******\.condarc
       virtual packages : __win=0=0
                          __archspec=1=x86_64
               channels : https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/win-64
                          https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/noarch
                          https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r/win-64
                          https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r/noarch
                          https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2/win-64
                          https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2/noarch
       base environment : C:\Users\*******\micromamba
               platform : win-64

Logs

No response

environment.yml

No response

~/.condarc

No response

@Hind-M Hind-M added the 1.x Related to mamba 1.x branch/versions label Jul 29, 2024
@nekomeowww
Copy link

nekomeowww commented Sep 7, 2024

I encountered the same issue:

warning  libmamba Could not find Windows version by calling 'ver'
    Please file a bug report.
    Error: ��֧�ָ�����
warning  libmamba Not setting long path registry key; Windows version must be at least 10 with the fall 2016 "Anniversary update" or newer.

After a slight research, the official Microsoft documentation states that the ver command is only available in Windows CMD, while the installation script can only be executed in PowerShell, which conflict itself.

Fortunately, Microsoft suggests another official way to obtain the Windows version in PowerShell by going through:

> $PSVersionTable.BuildVersion

Major  Minor  Build  Revision
-----  -----  -----  --------
10     0      19041  4842

There are tons of ways to obtain the System version: https://stackoverflow.com/questions/7330187/how-to-find-the-windows-version-from-the-powershell-command-line

After a brief inspection, I found that the issue was introduced to mamba by #3248 after Mar 28 with this line:

const auto args = std::array<std::string, 3>{ std::move(comspec).value(), "/c", "ver" };

The workaround should be running the following command in CMD:

 C:\Users\
 ${user}\AppData\Local\micromamba\micromamba.exe shell init -s powershell -p C:\Users\${user}\micromamba

dedicated.

So the better approach to this Pull Request would be to have

const auto args = std::array<std::string, 3>{ std::move(comspec).value(), "/c", "ver" };
to distinguish different executable environment and use ver for CMD as well as using $PSVersionTable.BuildVersion in PowerShell.

I am not a CPP expert, I could help on contributing the fix by adding extra functions to handle the cases, but may need maintainers helps.

EDIT1:

Nevermind, I found the init functionality is broken too no matter running with:

micromamba shell init --shell powershell --root-prefix=~/micromamba
warning  libmamba Could not find Windows version by calling 'ver'
    Please file a bug report.
    Error: ��֧�ָ�����
warning  libmamba Not setting long path registry key; Windows version must be at least 10 with the fall 2016 "Anniversary update" or newer.

or what I mentioned:

 C:\Users\
 ${user}\AppData\Local\micromamba\micromamba.exe shell init -s powershell -p C:\Users\${user}\micromamba

EDIT2:

I am lost, running directly in CMD is broken too. I am switching to Linux to try again...

C:\Users\Yuna>micromamba shell init --shell cmd.exe --root-prefix=~/micromamba
Setting cmd.exe AUTORUN to: "C:\Users\Yuna\micromamba\condabin\mamba_hook.bat"
warning  libmamba Could not find Windows version by calling 'ver'
    Please file a bug report.
    Error: ��֧�ָ�����
warning  libmamba Not setting long path registry key; Windows version must be at least 10 with the fall 2.

@jaimergp
Copy link
Contributor

Fortunately, Microsoft suggests another official way to obtain the Windows version in PowerShell by going through:

> $PSVersionTable.BuildVersion

Major  Minor  Build  Revision
-----  -----  -----  --------
10     0      19041  4842

Unfortunately that's not always accurate. In my test system I get:

  • CMD's ver: 10.0.22631.4602
  • Powershell's $PSVersionTable.BuildVersion: 10.0.22621.4391
  • wmic os get version: 10.0.22631

I'm standardizing this at conda/ceps#103 and it was a bit more complicated than I thought. It does look like wmic os get version is an acceptable workaround if cmd /D /C ver cannot be run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.x Related to mamba 1.x branch/versions where::windows Windows-specific issues
Projects
None yet
Development

No branches or pull requests

5 participants