IlanCosman / tide

🌊 The ultimate Fish prompt.
MIT License
2.75k stars 103 forks source link

conda makes the prompt throw broken pipe error, usual fix doesn't work #355

Closed recombinatrix closed 1 year ago

recombinatrix commented 1 year ago

Describe the bug

The prompt occasionally throws this error.

    Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>                                                                   
    BrokenPipeError: [Errno 32] Broken pipe

The problem appears similar to several previous issues eg: https://github.com/IlanCosman/tide/issues/78

However, the solutions to those problems causes a new issue.

If my config.fish is:

if status is-interactive
    # Commands to run in interactive sessions can go here
end

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
eval /home/uqadaqu1/anaconda3/bin/conda "shell.fish" "hook" $argv | source
# <<< conda initialize <<<

conda activate mdanalysis

I get the pipe error

If I implement the previous solution and change my config.fish to this:

if status is-interactive
    # Commands to run in interactive sessions can go here
end

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
status is-interactive && eval /home/uqadaqu1/anaconda3/bin/conda "shell.fish" "hook" $argv | source
# <<< conda initialize <<<

conda activate mdanalysis

or like this

if status is-interactive
    # Commands to run in interactive sessions can go here
eval /home/uqadaqu1/anaconda3/bin/conda "shell.fish" "hook" $argv | source
end

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
#status is-interactive && eval /home/uqadaqu1/anaconda3/bin/conda "shell.fish" "hook" $argv | source
# <<< conda initialize <<<

conda activate mdanalysis

I get this error with every prompt:

CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
To initialize your shell, run

    $ conda init <SHELL_NAME>

Currently supported shells are:
  - bash
  - fish
  - tcsh
  - xonsh
  - zsh
  - powershell

See 'conda init --help' for more information and options.

IMPORTANT: You may need to close and restart your shell after running 'conda init'.

Steps to reproduce

Install fish Install fisher Install anaconda - go here, download installer script : https://www.anaconda.com/products/distribution#linux Install tide

Environment

Output of tide bug-report:

tide version: 5.4.0
term: xterm-256color
os: Ubuntu 20.04.4 LTS
terminal emulator: GNOME Terminal or Tilix
fish startup: 358.22 millis
fisher plugins: jorgebucaran/fisher ilancosman/tide
IlanCosman commented 1 year ago

It sounds like conda is complaining that modified stuff in the

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!

# <<< conda initialize <<<

by adding status is-interactive.

Maybe try wrapping the # >>> conda initialize >>> block with an if status is-interactive and end?

recombinatrix commented 1 year ago

Wrapping both the # >>> conda initialize >>> block and the conda activate call behind an if status is-interactive seems to be working correctly. Thank you