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

verbose and strange prefix in Powershell even though mamba env is not activated #3114

Closed
3 tasks done
pwnfan opened this issue Jan 8, 2024 · 0 comments · Fixed by #3116
Closed
3 tasks done

verbose and strange prefix in Powershell even though mamba env is not activated #3114

pwnfan opened this issue Jan 8, 2024 · 0 comments · Fixed by #3116

Comments

@pwnfan
Copy link
Contributor

pwnfan commented Jan 8, 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

none

Latest version of Mamba

  • My problem is not solved with the latest version

Tried in Conda?

I have this problem with Conda as well, without using Mamba

Describe your issue

Env

  • Windows 11
  • Windows Terminal
  • Posh
  • Oh-My-Posh

The Issue

open a new powershell, there is always a strange and verbose prefix False in the left side, even though we have not activated mamba env yet:

PowerShell 7.4.0
Loading personal and system profiles took 763ms.
False# pwnfan @ pwnfan-win11 in ~ [01:04:51]
$
False# pwnfan @ pwnfan-win11 in ~ [01:04:52]
$ whoami
pwnfan-win11\pwnfan
False# pwnfan @ pwnfan-win11 in ~ [01:04:56]
$ xxx
xxx: The term 'xxx' 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.
False# pwnfan @ pwnfan-win11 in ~ [01:04:58]
$ 

but if we activate a mamba env then deactivate it, everything reverts to fine and the strange False dispeared

False# pwnfan @ pwnfan-win11 in ~ [01:04:58]
$ micromamba activate base
(base) # pwnfan @ pwnfan-win11 in ~ [01:05:02]
$ micromamba deactivate
# pwnfan @ pwnfan-win11 in ~ [01:05:05]

Issue Analysis

the bug is at

if ($Env:CONDA_PROMPT_MODIFIER) {

the debug log:

PowerShell 7.4.0
Loading personal and system profiles took 785ms.
False# pwnfan @ pwnfan-win11 in ~ [01:07:42]
$
False# pwnfan @ pwnfan-win11 in ~ [01:07:44]
$ $Env:CONDA_PROMPT_MODIFIER.GetType()

IsPublic IsSerial Name                                     BaseType
-------- -------- ----                                     --------
True     True     String                                   System.Object

False# pwnfan @ pwnfan-win11 in ~ [01:07:47]
$ $Env:CONDA_PROMPT_MODIFIER
False
False# pwnfan @ pwnfan-win11 in ~ [01:07:50]
$ micromamba activate base
(base) # pwnfan @ pwnfan-win11 in ~ [01:13:04]
$ micromamba deactivate
# pwnfan @ pwnfan-win11 in ~ [01:13:09]
$ $Env:CONDA_PROMPT_MODIFIER
# pwnfan @ pwnfan-win11 in ~ [01:13:11]
$ $Env:CONDA_PROMPT_MODIFIER.GetType()
InvalidOperation: You cannot call a method on a null-valued expression.

the reasons:

  • when initiating a new powershell: the value of $Env:CONDA_PROMPT_MODIFIER is a String False rather than Boolen
  • when activating a mamba env: the value of $Env:CONDA_PROMPT_MODIFIER is the env name, base in my case
  • then deactivating a mamba env: $Env:CONDA_PROMPT_MODIFIER was changed into null, which helped to revert the bug

mamba info / micromamba info

libmamba version : 1.5.6
     micromamba version : 1.5.6
           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\everf\micromamba\envs
          package cache : C:\Users\everf\micromamba\pkgs
                          C:\Users\everf\.mamba\pkgs
                          C:\Users\everf\AppData\Roaming\.mamba\pkgs
            environment : None (not found)
           env location : -
      user config files : C:\Users\everf\.mambarc
 populated config files : C:\Users\everf\.mambarc
       virtual packages : __win=0=0
                          __archspec=1=x86_64
               channels : https://conda.anaconda.org/conda-forge/win-64
                          https://conda.anaconda.org/conda-forge/noarch
       base environment : C:\Users\everf\micromamba
               platform : win-64

Logs

No response

environment.yml

No response

~/.condarc

No response

@pwnfan pwnfan changed the title verbose and strang prefex in Powershell even though mamba env is not activated verbose and strange prefix in Powershell even though mamba env is not activated Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant