-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fix No such file or directory
on conda activate
#18989
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for attempting a fix, although it still seems to be using source
instead of conda
. The most reliable known solution is to simply replace remove the firstActivate
command, and only send conda activate <env>
.
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. |
@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 |
@karrtikr using
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
src/client/pythonEnvironments/common/environmentManagers/conda.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost there, thanks for working on this.
src/client/common/terminal/environmentActivationProviders/condaActivationProvider.ts
Outdated
Show resolved
Hide resolved
public async getCondaInfo(): Promise<CondaInfo | undefined> { | ||
return this._getCondaInfo(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still unaddressed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean you can remove one of _getCondaInfo in favor of getCondaInfo.
Also, getCondaFileFromInterpreter comment is unaddressed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, getCondaFileFromInterpreter comment is unaddressed.
getCondaFileFromInterpreter
is used in another place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually the type of condaService
is CondaService
, not ICondaService
, so it can be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally we should replacing those tests with tests for getActivationScriptFromInterpreter
but I'm letting that go.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's will cause error when I remove getCondaFileFromInterpreter
directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have checked your branch and removing it does not cause an error, but okay.
src/client/pythonEnvironments/common/environmentManagers/condaService.ts
Outdated
Show resolved
Hide resolved
src/client/pythonEnvironments/common/environmentManagers/condaService.ts
Outdated
Show resolved
Hide resolved
src/client/pythonEnvironments/common/environmentManagers/condaService.ts
Show resolved
Hide resolved
src/client/pythonEnvironments/common/environmentManagers/condaService.ts
Outdated
Show resolved
Hide resolved
src/client/common/terminal/environmentActivationProviders/condaActivationProvider.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also please add a news entry file thanking yourself (see news/README.md
for instructions).
Ping me @karrtikr or re-request a review once all these comments are addressed.
src/client/common/terminal/environmentActivationProviders/condaActivationProvider.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implemented suggestion: https://github.com/microsoft/vscode-python/pull/18989/files#r863217723
src/client/pythonEnvironments/common/environmentManagers/condaService.ts
Outdated
Show resolved
Hide resolved
src/client/pythonEnvironments/common/environmentManagers/condaService.ts
Outdated
Show resolved
Hide resolved
src/client/pythonEnvironments/common/environmentManagers/condaService.ts
Outdated
Show resolved
Hide resolved
src/client/common/terminal/environmentActivationProviders/condaActivationProvider.ts
Outdated
Show resolved
Hide resolved
src/client/common/terminal/environmentActivationProviders/condaActivationProvider.ts
Outdated
Show resolved
Hide resolved
src/client/common/terminal/environmentActivationProviders/condaActivationProvider.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lastly, please add some tests for the changes.
src/client/common/terminal/environmentActivationProviders/condaActivationProvider.ts
Show resolved
Hide resolved
public async getCondaInfo(): Promise<CondaInfo | undefined> { | ||
return this._getCondaInfo(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still unaddressed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM once #18989 (comment) is addressed and merge conflicts are resolved.
@mokeyish You might want to run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 init I think the problem is that vscode expects an executable to exist at Fixed by creating a symlink: ln -s "$HOME/anaconda3/bin/activate" activate You 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