Skip to content
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

VSCode changed "conda activate [environment]" to "source activate [environment]" in remote ssh #20592

Closed
ramajoballester opened this issue Jan 29, 2023 · 7 comments
Assignees
Labels
area-environments Features relating to handling interpreter environments info-needed Issue requires more information from poster triage-needed Needs assignment to the proper sub-team

Comments

@ramajoballester
Copy link

ramajoballester commented Jan 29, 2023

Type: Bug

Behaviour

Expected vs. Actual

The problem I'm facing is that vscode executes "source activate [environment]" instead of "conda activate [environment]" only when I connect to my server via ssh. My server runs ubuntu 20.04 and same thing happens when connecting from windows or linux. It always worked well until last afternoon. I tried updating vscode, but it didn't solve it.

Steps to reproduce:

As I've always done, selecting my python interpreter from my conda env in local works well, but it does not when I do it in remote.

Diagnostic data

  • Python version (& distribution if applicable, e.g. Anaconda): 3.8.16
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Conda
  • Value of the python.languageServer setting: Default
Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

XXX

User Settings


languageServer: "Pylance"

Extension version: 2022.20.2
VS Code version: Code 1.74.3 (97dec172d3256f8ca4bfb2143f3f76b503ca0534, 2023-01-09T16:57:40.428Z)
OS version: Linux x64 5.15.0-58-generic
Modes:
Sandboxed: No
Remote OS version: Linux x64 5.15.0-58-generic

System Info
Item Value
CPUs Intel(R) Core(TM) i7-6500U CPU @ 2.50GHz (4 x 2600)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: disabled_software
video_encode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
Load (avg) 1, 1, 1
Memory (System) 7.64GB (4.31GB free)
Process Argv --unity-launch --crash-reporter-id bd1ec8d7-9008-4608-8289-77381a821054
Screen Reader no
VM 0%
DESKTOP_SESSION ubuntu
XDG_CURRENT_DESKTOP Unity
XDG_SESSION_DESKTOP ubuntu
XDG_SESSION_TYPE x11
Item Value
Remote SSH: uc3m_server
OS Linux x64 5.15.0-58-generic
CPUs AMD Ryzen 7 3700X 8-Core Processor (16 x 2200)
Memory (System) 62.75GB (59.62GB free)
VM 0%
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
pythonvspyl392:30443607
vserr242:30382549
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vsdfh931cf:30280410
vshan820:30294714
vstes263:30335439
vscorecescf:30445987
pythondataviewer:30285071
vscod805:30301674
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
cmake_vspar411:30581797
vsaa593cf:30376535
pythonvs932:30410667
cppdebug:30492333
vsclangdc:30486549
c4g48928:30535728
dsvsc012cf:30540253
azure-dev_surveyone:30548225
vsccc:30610678
pyindex848cf:30577861
nodejswelcome1:30587005
3biah626:30602489
f6dab269:30613381

@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Jan 29, 2023
@ramajoballester ramajoballester changed the title VSCode changed "conda activate [environment]" to "source activate [environment]" VSCode changed "conda activate [environment]" to "source activate [environment]" in remote ssh Jan 29, 2023
@karrtikr
Copy link

Should be fixed with #11039 once we start using conda run for activation instead. Meanwhile, you can make the source activate <environment> command work by putting activate in PATH.

Make sure $HOME/<conda>/bin or $HOME/<conda>/condabin is in PATH.

In case that doesn't fix the issue, can you provide a screenshot of the error you're getting when source activate <env> is run? Please also provide the location of conda installation.

@karrtikr karrtikr added info-needed Issue requires more information from poster area-environments Features relating to handling interpreter environments labels Jan 31, 2023
@ramajoballester
Copy link
Author

ramajoballester commented Jan 31, 2023

$HOME/anaconda3/condabin was already in PATH. source activate <env> throws error bash: activate: no such file or directory. Nonetheless, if I run conda activate or conda activate <any-env> I can then run source activate <env>.

However, the question I would like to answer is: is there a way to revert the initial command that the terminal executes when I launch it from source activate <env> to conda activate <env> and why it changed recently? It has always been with conda instead of source and I would like to keep it that way. In addition, this is the way it works on my local pc (with conda activate <env>) but it differs when I connect to my server via ssh, which, apparently, has the same ubuntu, conda and configuration as my local vscode.

@karrtikr
Copy link

is there a way to revert the initial command that the terminal executes

Unfortunately no.

I'm not sure why it changed. All this activation code will go away with #11039, so instead of fixing the issue I was hoping we would make the source activate <env> command work for you instead.

$HOME/anaconda3/condabin was already in PATH. source activate throws error bash: activate: no such file or directory

What about $HOME/<conda>/bin? It should probably contain the activate script.

@karrtikr
Copy link

Also, what is the version of conda you're using?

@ramajoballester
Copy link
Author

ramajoballester commented Jan 31, 2023

Okay, I can confirm that adding $HOME/<conda>/bin to PATH allows me to run source activate <env>.

I just found out the root of the problem. With conda==23.1.0 VSCode runs source activate <env> by default. After downgrading it to conda==22.11.1 it defaults to conda activate <env>.

Thank you so much and let me know if you want any other info related to this issue before closing it.

@karrtikr
Copy link

Interesting, well glad you have a workaround for now. I'm closing this issue as we'll be rewriting activation with #11039.

@gjoseph92
Copy link

After upgrading conda, I've been having the same issue reported here. I'm using local environments on macOS.

After downgrading it to conda==22.11.1 it defaults to conda activate <env>.

What was the reasoning for this? I'm not aware of source activate <env> ever being the proper way to activate a conda environment, regardless of version, so why is this behavior dependent on the conda version?

I can confirm that downgrading conda to 22.11.1 also causes VSCode to use the correct command, and resolves the issue for me.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-environments Features relating to handling interpreter environments info-needed Issue requires more information from poster triage-needed Needs assignment to the proper sub-team
Projects
None yet
Development

No branches or pull requests

3 participants