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

[Remote-SSH Bug]: Using with Python plugin and conda, $PATH is in the wrong order. #22758

Closed
3 tasks done
sjbsjb233 opened this issue Jan 6, 2024 · 2 comments
Closed
3 tasks done
Assignees
Labels
experimenting Feature is part of an experiment info-needed Issue requires more information from poster triage-needed Needs assignment to the proper sub-team

Comments

@sjbsjb233
Copy link

sjbsjb233 commented Jan 6, 2024

Is there an existing issue for this bug?

  • I have searched the existing issues

Required Troubleshooting Steps

  • I have followed these troubleshooting steps
  • I have tried both values of the remote.SSH.useLocalServer setting

Connect Locally

It connects successfully

->

No response

Expected Behavior

No response

Steps To Reproduce

No response

Remote-SSH Log

Remote-SSH Log

(base)[dev@localhost web_vpn]$ conda activate flask_web (flask_web)[dev@localhost web_vpn]$ echo $PATH /home/dev/.vscode-server/bin/0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2/bin/remote-cli:/usr/local/cuda-12.1/bin:/usr/lib/jvm/jdk-17.0.8/bin:/bin:/home/dev/miniconda3/envs/flask_web/bin:/home/dev/miniconda3/condabin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/dev/.local/bin:/home/dev/bin:/home/dev/miniconda3/bin:/home/dev/.vscode-server/bin/0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2/bin/remote-cli:/usr/local/cuda-12.1/bin:/usr/lib/jvm/jdk-17.0.8/bin:/bin:/home/dev/miniconda3/bin:/home/dev/miniconda3/condabin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/dev/.local/bin:/home/dev/bin (flask_web)[dev@localhost web_vpn]$

Anything else?

Remote-SSH Log

``` (base)[dev@localhost web_vpn]$ conda activate flask_web (flask_web)[dev@localhost web_vpn]$ echo $PATH /home/dev/.vscode-server/bin/0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2/bin/remote-cli:/usr/local/cuda-12.1/bin:/usr/lib/jvm/jdk-17.0.8/bin:/bin:/home/dev/miniconda3/envs/flask_web/bin:/home/dev/miniconda3/condabin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/dev/.local/bin:/home/dev/bin:/home/dev/miniconda3/bin:/home/dev/.vscode-server/bin/0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2/bin/remote-cli:/usr/local/cuda-12.1/bin:/usr/lib/jvm/jdk-17.0.8/bin:/bin:/home/dev/miniconda3/bin:/home/dev/miniconda3/condabin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/dev/.local/bin:/home/dev/bin (flask_web)[dev@localhost web_vpn]$ ```

Thank you for taking time out of your busy schedule to read my issue.

Environment:
Remote environment: linux centos7
ms-python.python plugin version: v2023.22.1

Operating environment:
  Version: 1.85.1 (user setup)
  Submitted: 0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2
  Date: 2023-12-13T09:49:37.021Z
  Electron: 25.9.7
  ElectronBuildId: 25551756
  Chromium: 114.0.5735.289
  Node.js: 18.15.0
  V8: 11.4.183.29-electron.0
  OS: Windows_NT x64 10.0.22621

I'm using the python plugin (it's plugin id is: ms-python.python), above is the vscode remote startup, I switch conda to the virtual environment "flask_web", you can see that "(flask_web)" is already in front of it. However, when I use echo $PATH to check the environment variable, "/bin" is in front of "/home/dev/miniconda3/envs/flask_web/bin" in the conda virtual environment directory. " in front of it.
However, when I connect to the server using xshell's ssh and start the "flask_web" virtual environment, the first $PATH is the bin directory of the conda virtual environment.
I've tried a lot of things on the internet, such as changing the remote server setting:

"terminal.integrated.env.osx": {
        "PATH": ""
},
"terminal.integrated.inheritEnv": false

None of these apply, it is still /bin that takes precedence over the bin directory of the conda virtual environment in the vscode remote's $PATH. This also results in me using python commands in vscode remote's shell, launching an older version of python in /bin, and not being able to use the python virtual environment that I really need.

But the good thing is, when running the python program using ctrl+F5 at that time, it runs the command:
(base)[dev@localhost web_vpn]$ /usr/bin/env /home/dev/miniconda3/envs/flask_web/bin/python /home/dev/.vscode-server/extensions/ms- python.python-2023.22.1/pythonFiles/lib/python/debugpy/adapter/... /... /debugpy/launcher 58218 -- /home/dev/dev/web_vpn/test.py
Starts python in the conda virtual environment directory directly with parameters (this is not affected by the $PATH variable, since python in the virtual environment is started via an absolute path). So the conda virtual environment is used correctly when python is running.

The following is from the environment contribution of the vscode terminal, you can see that the ms-python.python plugin seems to set the $PATH variable backwards in the remote environment, advancing the root directory to "/bin", but this only happens in the remote case, in the local one. Running the code locally does not cause this problem.
image

Thank you very much!

@connor4312 connor4312 transferred this issue from microsoft/vscode-remote-release Jan 17, 2024
@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Jan 17, 2024
@karrtikr karrtikr added the experimenting Feature is part of an experiment label Feb 1, 2024
@karrtikr
Copy link

karrtikr commented Feb 1, 2024

Thanks for the bug report! We investigate issues in order based on priority and severity, which includes the impact it has on your ability to use the extension to do productive work, and the number of people affected. If other users come forward and leave a comment demonstrating they are seeing/reproducing the problem then we will raise this issue's priority.

@karrtikr
Copy link

karrtikr commented Feb 5, 2024

This seems to be a duplicate of #22724, closing in favor of that. Apologies for the delayed response. Please provide the details asked there and I'll be happy to quickly dig down into the issue you're facing.

@karrtikr karrtikr closed this as not planned Won't fix, can't repro, duplicate, stale Feb 5, 2024
@github-actions github-actions bot added the info-needed Issue requires more information from poster label Feb 5, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
experimenting Feature is part of an experiment 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