Repository navigation
Fix No such file or directory on conda activate - #18989
Conversation
Hi karrtikr, using # >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/home/.share/conda/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/home/.share/conda/etc/profile.d/conda.sh" ]; then
. "/home/.share/conda/etc/profile.d/conda.sh"
else
export PATH="/home/.share/conda/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<is not be sourced. |
|
YISH (@mokeyish), I think the shell hooks in: now takes care of the sourcing in the later conda versions. But maybe I'm not understanding it correctly. Regardless, we're in the process of moving away from constructing our own activation commands to simply using what For the purposes of this issue #15818, please use |
|
Kartik Raj (@karrtikr) using
|
There was a problem hiding this comment.
Thanks for clearing up the reason why source was used in the first place. However it's still a hack that we have to work around conda: #8770 (comment), and we are hesitant to rely completely on it. Let me know if this works out as well:
source ${activatePath}
conda activate ${condaEnv.toCommandArgumentForPythonExt()}
The intention is to send the conda activate command following it, so we do not totally rely on the source command.
Kartik Raj (karrtikr)
left a comment
There was a problem hiding this comment.
Almost there, thanks for working on this.
| public async getCondaInfo(): Promise<CondaInfo | undefined> { | ||
| return this._getCondaInfo(); | ||
| } |
There was a problem hiding this comment.
This is no longer needed. Also, please turn getCondaFileFromInterpreter into a private method and remove it from the ICondaService interface.
There was a problem hiding this comment.
This is still unaddressed.
There was a problem hiding this comment.
I mean you can remove one of _getCondaInfo in favor of getCondaInfo.
Also, getCondaFileFromInterpreter comment is unaddressed.
There was a problem hiding this comment.
Also, getCondaFileFromInterpreter comment is unaddressed.
getCondaFileFromInterpreter is used in another place.
There was a problem hiding this comment.
Actually the type of condaService is CondaService, not ICondaService, so it can be removed.
There was a problem hiding this comment.
Ideally we should replacing those tests with tests for getActivationScriptFromInterpreter but I'm letting that go.
There was a problem hiding this comment.
It's will cause error when I remove getCondaFileFromInterpreter directly.
There was a problem hiding this comment.
I have checked your branch and removing it does not cause an error, but okay.
Kartik Raj (karrtikr)
left a comment
There was a problem hiding this comment.
Also please add a news entry file thanking yourself (see news/README.md for instructions).
Ping me Kartik Raj (@karrtikr) or re-request a review once all these comments are addressed.
Kartik Raj (karrtikr)
left a comment
There was a problem hiding this comment.
Implemented suggestion: https://github.com/microsoft/vscode-python/pull/18989/files#r863217723
Kartik Raj (karrtikr)
left a comment
There was a problem hiding this comment.
Lastly, please add some tests for the changes.
| public async getCondaInfo(): Promise<CondaInfo | undefined> { | ||
| return this._getCondaInfo(); | ||
| } |
There was a problem hiding this comment.
This is still unaddressed.
There was a problem hiding this comment.
LGTM once #18989 (comment) is addressed and merge conflicts are resolved.
|
YISH (@mokeyish) You might want to run |
Kartik Raj (karrtikr)
left a comment
There was a problem hiding this comment.
Thanks for working on this.
|
Looking forward to release new version for this as far as quickly. |
|
This still happened for me in v2022.8.0 and pre-release version v2023.9.10301005. I installed conda 23.1.0 like this, on Ubuntu 22.10: bash Anaconda-latest-Linux-x86_64.sh
eval "$("$HOME/anaconda3/bin/conda" shell.bash hook)"
conda config --set auto_activate_base false
conda initI think the problem is that vscode expects an executable to exist at Fixed by creating a symlink: ln -s "$HOME/anaconda3/bin/activate" activateYou can get a better error message (i.e. it reveals which file it was trying to open) if you explicitly specify your conda executable path: |





Fix for issue #15818