VS Code activates conda but uses default system binaries

Viewed 67

I'm running VS Code on a new Mac. I correctly installed conda and these are the binaries on the machine:

Default system python: 2.7/3.8

Conda base: 3.9

Conda env: 3.7

Conda seems to be activated properly both in the default terminal both in VS Code (I get the 'base' string at the beginning and I can activate the other environment). The problem is that the default terminal uses conda binaries while VS uses the system binaries.

In my .zsh file I have this:

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/Users/francesco/miniconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/Users/francesco/miniconda3/etc/profile.d/conda.sh" ]; then
        . "/Users/francesco/miniconda3/etc/profile.d/conda.sh"
    else
        export PATH="/Users/francesco/miniconda3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda initialize <<<

And I was able to fix the problem by hard setting the path:

# Fix conda in VS
export PATH="/Users/francesco/miniconda3/bin:$PATH"

Is there any cleaner solution? Why VS code doesn't use conda binaries?

0 Answers
Related