zed icon indicating copy to clipboard operation
zed copied to clipboard

The terminal does not consider python from the right conda environment

Open Spoutnik97 opened this issue 10 months ago • 1 comments

Check for existing issues

  • [X] Completed

Describe the bug / provide steps to reproduce it

I create a conda environment: conda env create -f environment.yml

Then activate it with conda activate my_env

If I run which python in the Zed terminal, my base python path is printed If I run which python in my iTerm2 terminal, my right conda env python path is printed

Environment

Zed: v0.132.0 (Zed Preview) OS: macOS 14.2.1 Memory: 16 GiB Architecture: x86_64

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

No response

Spoutnik97 avatar Apr 23 '24 14:04 Spoutnik97

What is working for me is to specify the full python path of my env : ~/miniconda3/envs/pytorch/bin/python3 test.py

Spoutnik97 avatar May 05 '24 13:05 Spoutnik97

@Spoutnik97 are you able to resolve this issue?

Qazalbash avatar Jul 12 '24 18:07 Qazalbash

Yes ! @Qazalbash I seems that the conda script initialzed when the terminal opened, does not work with Zed terminal...

Open your .zshrc file, and replace the Conda line at the end by these one :

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/Users/me/miniconda3/bin/conda' 'shell.zsh' 'hook')"
if [ $? -eq 0 ]; then
    export PATH="/Users/me/miniconda3/bin:/Users/me/miniconda3/condabin:$PATH" # Replace path to conda or miniconda here for Zed terminal
    eval "$__conda_setup"
else
    if [ -f "/Users/me/miniconda3/etc/profile.d/conda.sh" ]; then
        . "/Users/me/miniconda3/etc/profile.d/conda.sh"
    else
        export PATH="/Users/me/miniconda3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda initialize <<<

thus your PATH will include the right python and conda path, and conda activate will work

echo $PATH

Spoutnik97 avatar Jul 15 '24 15:07 Spoutnik97

@Moshyfawn @JosephTLyons any idea about the cause of this bug ?

Spoutnik97 avatar Jul 15 '24 15:07 Spoutnik97