这是indexloc提供的服务,不要输入任何密码
Skip to content

CMD shell activation changed in conda 25.3.0 #321

@kenodegard

Description

@kenodegard

Checklist

  • I added a descriptive title
  • I searched open reports and couldn't find a duplicate

What happened?

The CMD shell activation was modified in conda 25.3.0 to support users using Windows AppLocker with script restrictions enabled.

Xref conda/conda#13610
Xref conda/conda#14607

This change results in conda shell.cmd.exe activate * no longer producing a dynamic .bat script to be executed but rather produces an ini-style .env file to be consumed by the CONDA_ROOT\condabin\_conda_activate.bat.

To support conda 25.3.0+, menuinst's manual calls to conda shell.cmd.exe activate * need updating to properly handle activation, e.g.:

if self.metadata["activate"]:
conda_exe = self.menu.conda_exe
if self.menu._is_micromamba(conda_exe):
activate = "shell activate"
else:
activate = "shell.cmd.exe activate"
activator = f'{self.menu.conda_exe} {activate} "{self.menu.prefix}"'
lines += [
"@SETLOCAL ENABLEDELAYEDEXPANSION",
f'@FOR /F "usebackq tokens=*" %%i IN (`{activator}`) do set "ACTIVATOR=%%i"',
"@CALL %ACTIVATOR%",
":: This below is the user command",
]

This change is likely the cause of the recent failures:

Conda Info

Conda Config

Conda list

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    type::bugdescribes erroneous operation, use severity::* to classify the type

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions