Inspired by this post, the following code in the profile of PowerShell v7.5.0 worked like a charm:
# A workaround for the issue https://github.com/PowerShell/PowerShell/issues/24869
function Invoke-CleanConda {
$Env:_CE_M = $Env:_CE_CONDA = $null # need to be cleared each time before calling conda command
Invoke-Conda @args # pass all the arguments to the conda command
}
Write-Output "`n"
Write-Output "**********************************************************************"
Write-Output "* HACK: Remove the default conda alias *"
Write-Output "* and define a new command Invoke-CleanConda() as workaround. *"
Write-Output "**********************************************************************"
Write-Output "`n"
Remove-Alias conda # remove the default conda alias
Invoke-CleanConda env list
Instead of calling conda [options], just call alll conda command with Invoke-CleanConda [options] such as
Invoke-CleanConda activate base
Invoke-CleanConda env list
Of course, it would be better to fix the PS init issue on the Conda side. Also added here https://github.com/PowerShell/PowerShell/issues/24869#issuecomment-2625708821