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

The ms-python.python plug-in in the vscode remote environment has the wrong PATH path order in the remote Linux #22724

Closed
sjbsjb233 opened this issue Jan 6, 2024 · 4 comments
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

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:
  vscode 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!

@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Jan 6, 2024
@karrtikr
Copy link

karrtikr commented Jan 8, 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. Thanks for understanding and the patience!

@karrtikr karrtikr added the experimenting Feature is part of an experiment label Feb 1, 2024
@karrtikr
Copy link

karrtikr commented Feb 5, 2024

Hi @sjbsjb233 , I read your issue in detail and thanks for being elaborate about it. The PATH you notice in our environment contributions comes from conda actually, so I'd curious to know more details about your setup.

Please provide the debug logs for your remote machine:

  • Run Developer: Set log level command
  • Select Trace
  • Run Developer: Reload Window command
  • Provide the output:
Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

XXX

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Feb 5, 2024
@karrtikr
Copy link

karrtikr commented Feb 8, 2024

A lot of these issues were recently fixed, try the latest pre-release and stable version of the Python extension.

image

@brettcannon
Copy link
Member

Because we have not heard back with the information we requested, we are closing this issue for now. If you are able to provide the info later on, then we will be happy to re-open this issue to pick up where we left off.

@brettcannon brettcannon closed this as not planned Won't fix, can't repro, duplicate, stale Mar 13, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 15, 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