microsoft / pylance-release

Documentation and issues for Pylance
Creative Commons Attribution 4.0 International
1.7k stars 769 forks source link

PYTHONPATH not working with Remote-SSH #3067

Closed Azureblade3808 closed 2 years ago

Azureblade3808 commented 2 years ago

I am trying to setup a remote environment. I have set a PYTHONPATH environment variable, and have added it into both /etc/profile and /etc/bashrc. When I run VScode on the server computer, the path provided in PYTHONPATH is getting resolved. When I run VScode on the client computer and connect to the server with Remote-SSH, PYTHONPATH on the server is not taking effect and modules placed in PYTHONPATH are not recognized. Running python files using those modules is successful though.

I'm not sure if I have some config errors. Below is the info related.

Local System: Windows 10 Remote System: CentOS Linux 7

"settings.json" --

```json { "autoDocstring.docstringFormat": "numpy", "autoDocstring.generateDocstringOnEnter": false, "autoDocstring.startOnNewLine": true, "autoSnippet.snippets": [ { "pattern": "**/__init__.py", "snippet": "__init__.py template", }, { "pattern": "**/*.py", "snippet": "*.py template", }, { "pattern": "**/__init__.pyi", "snippet": "__init__.pyi template", }, { "pattern": "**/*.pyi", "snippet": "*.pyi template", }, ], "editor.minimap.enabled": false, "editor.renderControlCharacters": true, "editor.showFoldingControls": "always", "editor.suggestSelection": "first", "files.trimTrailingWhitespace": true, "notebook.cellToolbarLocation": { "default": "right", "jupyter-notebook": "left", }, "python.analysis.autoImportCompletions": false, "python.analysis.diagnosticMode": "workspace", "python.analysis.diagnosticSeverityOverrides": { "reportAssertAlwaysTrue": "error", "reportConstantRedefinition": "error", "reportDuplicateImport": "warning", "reportFunctionMemberAccess": "error", "reportGeneralTypeIssues": "information", "reportImplicitStringConcatenation": "warning", "reportImportCycles": "none", "reportIncompatibleMethodOverride": "error", "reportIncompatibleVariableOverride": "error", "reportInvalidStubStatement": "none", "reportMissingTypeArgument": "none", "reportMissingTypeStubs": "none", "reportOverlappingOverload": "none", "reportPrivateImportUsage": "none", "reportPrivateUsage": "none", "reportPropertyTypeMismatch": "none", "reportUnknownArgumentType": "none", "reportUnknownLambdaType": "none", "reportUnknownMemberType": "none", "reportUnknownParameterType": "none", "reportUnknownVariableType": "none", "reportUnnecessaryCast": "none", "reportUnnecessaryComparison": "none", "reportUnnecessaryIsInstance": "none", "reportUnsupportedDunderAll": "warning", "reportUnusedCallResult": "error", "reportUnusedClass": "error", "reportUnusedFunction": "error", "reportUnusedImport": "warning", "reportUnusedVariable": "error" }, "python.analysis.typeCheckingMode": "strict", "python.formatting.blackArgs": [ "-S", ], "python.formatting.provider": "none", "runOnSave.commands": [ { "match": ".*\\.(:?json|py|txt)$", "command": "decode ${file}", "runIn": "backend", "runningStatusMessage": "Decoding ${file}", "finishStatusMessage": "${file} decoded" } ], "redhat.telemetry.enabled": true, "runOnSave.statusMessageTimeout": 3000, "settingsSync.ignoredSettings": [ "autoDocstring.customTemplatePath", "python.analysis.extraPaths", "python.analysis.logLevel", "python.analysis.typeshedPaths", "python.autoComplete.extraPaths", "remote.SSH.remotePlatform", "runOnSave.commands", ], "terminal.integrated.commandsToSkipShell": [ "language-julia.interrupt", ], "workbench.colorTheme": "Quiet Light", "workbench.editor.untitled.hint": "hidden", "workbench.editorAssociations": { "*.ipynb": "jupyter-notebook", "*.ui": "default" }, "[jsonc]": { "editor.defaultFormatter": "vscode.json-language-features", }, "[typescript]": { "editor.defaultFormatter": "esbenp.prettier-vscode", }, "gitlens.defaultDateFormat": null, "gitlens.hovers.currentLine.over": "line", "gitlens.views.commits.files.layout": "tree", "[json]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, "editor.unicodeHighlight.allowedLocales": { "zh-hant": true, "zh-hans": true }, "gitlens.codeLens.enabled": false, "python.analysis.stubPath": "__typings__", "security.workspace.trust.untrustedFiles": "open", "[python]": { "editor.defaultFormatter": "ms-python.black-formatter" }, "editor.formatOnSave": true, "window.menuBarVisibility": "classic", "remote.SSH.remotePlatform": { "localhost": "windows", "qwlhd-pc": "windows", "192.168.1.60": "linux", "coding.local": "linux" }, "editor.unicodeHighlight.nonBasicASCII": false, "editor.rulers": [ 72, 88, ], "git.ignoreLegacyWarning": true, "remote.SSH.defaultExtensions": [ "aaron-bond.better-comments", "eamodio.gitlens", "gruntfuggly.auto-snippet", "gruntfuggly.todo-tree", "hrhr49.vscode-markdown-tefcha", "ms-python.black-formatter", "ms-python.python", "ms-python.vscode-pylance", "njpwerner.autodocstring", ], "python.defaultInterpreterPath": "C:\\Users\\QWLHD\\anaconda3\\envs\\python_3_10\\python.exe", "python.analysis.logLevel": "Trace", } ```

Output from "Python Language Server", truncated --

```plain [Info - 10:58:05 AM] (25295) Pylance language server 2022.7.30 (pyright f3e85ee2) starting [Info - 10:58:05 AM] (25295) Server root directory: /home/chris_fu/.vscode-server/extensions/ms-python.vscode-pylance-2022.7.30/dist Notebook support: LSP [Info - 10:58:05 AM] (25295) No configuration file found. [Info - 10:58:05 AM] (25295) No pyproject.toml file found. [Info - 10:58:05 AM] (25295) Setting pythonPath for service "python_scripts": "/bin/python" [Warn - 10:58:05 AM] (25295) stubPath /home/chris_fu/Documents/python_scripts/__typings__ is not a valid directory. [Info - 10:58:05 AM] (25295) Assuming Python version 3.8 [Info - 10:58:05 AM] (25295) Assuming Python platform Linux [Info - 10:58:05 AM] (25295) Search paths for /home/chris_fu/Documents/python_scripts [Info - 10:58:05 AM] (25295) /home/chris_fu/.vscode-server/extensions/ms-python.vscode-pylance-2022.7.30/dist/typeshed-fallback/stdlib [Info - 10:58:05 AM] (25295) /home/chris_fu/Documents/python_scripts [Info - 10:58:05 AM] (25295) /home/chris_fu/Documents/python_scripts/__typings__ [Info - 10:58:05 AM] (25295) /home/chris_fu/.vscode-server/extensions/ms-python.vscode-pylance-2022.7.30/dist/typeshed-fallback/stubs/... [Info - 10:58:05 AM] (25295) /home/chris_fu/.vscode-server/extensions/ms-python.vscode-pylance-2022.7.30/dist/bundled/stubs [Info - 10:58:05 AM] (25295) /opt/anaconda3/envs/main/lib/python3.8 [Info - 10:58:05 AM] (25295) /opt/anaconda3/envs/main/lib/python3.8/lib-dynload [Info - 10:58:05 AM] (25295) /opt/anaconda3/envs/main/lib/python3.8/site-packages [Info - 10:58:05 AM] (25295) Adding fs watcher for library directories: /opt/anaconda3/envs/main/lib/python3.8 /opt/anaconda3/envs/main/lib/python3.8/lib-dynload /opt/anaconda3/envs/main/lib/python3.8/site-packages [Info - 10:58:05 AM] (25295) Adding fs watcher for directories: /home/chris_fu/Documents/python_scripts [Info - 10:58:05 AM] (25295) Searching for source files [Info - 10:58:05 AM] (25295) Found 1 source file (25295) [FG] parsing: /home/chris_fu/Documents/python_scripts/test.py (219ms) (25295) [FG] parsing: /home/chris_fu/.vscode-server/extensions/ms-python.vscode-pylance-2022.7.30/dist/typeshed-fallback/stdlib/builtins.pyi [fs read 4ms] (240ms) (25295) [FG] binding: /home/chris_fu/.vscode-server/extensions/ms-python.vscode-pylance-2022.7.30/dist/typeshed-fallback/stdlib/builtins.pyi (96ms) (25295) [FG] binding: /home/chris_fu/Documents/python_scripts/test.py (1ms) [Info - 10:58:06 AM] (25295) Background analysis(1) root directory: /home/chris_fu/.vscode-server/extensions/ms-python.vscode-pylance-2022.7.30/dist [Info - 10:58:06 AM] (25295) Background analysis(1) started (25295) Background analysis message: setConfigOptions (25295) Background analysis message: setImportResolver (25295) Background analysis message: ensurePartialStubPackages (25295) Background analysis message: setTrackedFiles (25295) Background analysis message: markAllFilesDirty (25295) Background analysis message: setFileOpened (25295) Background analysis message: analyze [Info - 10:58:06 AM] (25295) Indexer background runner(2) root directory: /home/chris_fu/.vscode-server/extensions/ms-python.vscode-pylance-2022.7.30/dist (index) [Info - 10:58:06 AM] (25295) Indexing(2) started (25295) [IDX(2)] index libraries /home/chris_fu/Documents/python_scripts ... (25295) [IDX(2)] read stdlib indices (120ms) (25295) [BG(1)] analyzing: /home/chris_fu/Documents/python_scripts/test.py ... (25295) [BG(1)] parsing: /home/chris_fu/Documents/python_scripts/test.py (119ms) (25295) [BG(1)] parsing: /home/chris_fu/.vscode-server/extensions/ms-python.vscode-pylance-2022.7.30/dist/typeshed-fallback/stdlib/builtins.pyi [fs read 4ms] (227ms) (25295) [BG(1)] binding: /home/chris_fu/.vscode-server/extensions/ms-python.vscode-pylance-2022.7.30/dist/typeshed-fallback/stdlib/builtins.pyi (84ms) (25295) [BG(1)] binding: /home/chris_fu/Documents/python_scripts/test.py (1ms) (25295) [BG(1)] checking: /home/chris_fu/Documents/python_scripts/test.py (5ms) (25295) [BG(1)] analyzing: /home/chris_fu/Documents/python_scripts/test.py (441ms) (25295) Background analysis message: getSemanticTokens full (25295) [BG(1)] getSemanticTokens full at /home/chris_fu/Documents/python_scripts/test.py (2ms) (25295) Background analysis message: getSemanticTokens range (25295) [BG(1)] getSemanticTokens range 0:0 - 0:5 at /home/chris_fu/Documents/python_scripts/test.py (1ms) (25295) Background analysis message: resumeAnalysis (25295) [BG(1)] indexing: /home/chris_fu/Documents/python_scripts/test.py [found 0] (0ms) (25295) Indexing Done: /home/chris_fu/Documents/python_scripts/test.py (25295) Background analysis message: setFileOpened (25295) Background analysis message: markFilesDirty (25295) [IDX(2)] scan packages [found 278 modules over 1 exec env] (723ms) (25295) Background analysis message: analyze ```

Output from "Remote - SSH" --

```plain [10:49:49.548] Log Level: 2 [10:49:49.549] remote-ssh@0.84.0 [10:49:49.549] win32 x64 [10:49:49.817] SSH Resolver called for "ssh-remote+7b22686f73744e616d65223a22636f64696e672e6c6f63616c222c2275736572223a2263687269735f6675227d", attempt 1 [10:49:49.819] "remote.SSH.useLocalServer": false [10:49:49.820] "remote.SSH.showLoginTerminal": false [10:49:49.820] "remote.SSH.remotePlatform": {"localhost":"windows","qwlhd-pc":"windows","192.168.1.60":"linux","coding.local":"linux"} [10:49:49.821] "remote.SSH.path": undefined [10:49:49.821] "remote.SSH.configFile": undefined [10:49:49.821] "remote.SSH.useFlock": true [10:49:49.822] "remote.SSH.lockfilesInTmp": false [10:49:49.822] "remote.SSH.localServerDownload": auto [10:49:49.822] "remote.SSH.remoteServerListenOnSocket": false [10:49:49.822] "remote.SSH.showLoginTerminal": false [10:49:49.823] "remote.SSH.defaultExtensions": ["aaron-bond.better-comments","eamodio.gitlens","gruntfuggly.auto-snippet","gruntfuggly.todo-tree","hrhr49.vscode-markdown-tefcha","ms-python.black-formatter","ms-python.python","ms-python.vscode-pylance","njpwerner.autodocstring"] [10:49:49.823] "remote.SSH.loglevel": 2 [10:49:49.823] "remote.SSH.enableDynamicForwarding": true [10:49:49.824] "remote.SSH.enableRemoteCommand": false [10:49:49.824] "remote.SSH.serverPickPortsFromRange": {} [10:49:49.824] "remote.SSH.serverInstallPath": {} [10:49:49.858] SSH Resolver called for host: chris_fu@coding.local [10:49:49.858] Setting up SSH remote "coding.local" [10:49:50.634] Using commit id "b06ae3b2d2dbfe28bca3134cc6be65935cdfea6a" and quality "stable" for server [10:49:50.642] Install and start server if needed [10:49:50.646] Checking ssh with "ssh -V" [10:49:50.725] > OpenSSH_for_Windows_8. [10:49:50.726] > 1p1, LibreSSL 3.0.2 [10:49:50.737] Running script with connection command: ssh -T -D 55916 "chris_fu@coding.local" bash [10:49:50.741] Terminal shell path: C:\WINDOWS\System32\cmd.exe [10:49:52.367] > ]0;C:\WINDOWS\System32\cmd.exe [10:49:52.367] Got some output, clearing connection timeout [10:49:52.978] > 97bc72611d08: running [10:49:53.034] > Acquiring lock on /home/chris_fu/.vscode-server/bin/b06ae3b2d2dbfe28bca3134cc6be > 65935cdfea6a/vscode-remote-lock.chris_fu.b06ae3b2d2dbfe28bca3134cc6be65935cdfea6 > a [10:49:53.049] > Found existing installation at /home/chris_fu/.vscode-server/bin/b06ae3b2d2dbfe2 > 8bca3134cc6be65935cdfea6a... > Checking /home/chris_fu/.vscode-server/.b06ae3b2d2dbfe28bca3134cc6be65935cdfea6a > .log and /home/chris_fu/.vscode-server/.b06ae3b2d2dbfe28bca3134cc6be65935cdfea6a > .pid for a running server > Looking for server with pid: 20269 [10:49:53.139] > Found running server... [10:49:53.158] > Installing extensions... [10:49:53.511] > Installing extensions... [10:49:53.755] > Extension 'aaron-bond.better-comments' v3.0.0 is already installed. Use '--force > ' option to update to latest version or provide '@' to install a specif > ic version, for example: 'aaron-bond.better-comments@1.2.3'. > Extension 'eamodio.gitlens' v12.1.2 is already installed. Use '--force' option t > o update to latest version or provide '@' to install a specific version > , for example: 'eamodio.gitlens@1.2.3'. > Extension 'gruntfuggly.auto-snippet' v0.0.11 is already installed. Use '--force' > option to update to latest version or provide '@' to install a specifi > c version, for example: 'gruntfuggly.auto-snippet@1.2.3'. > Extension 'gruntfuggly.todo-tree' v0.0.215 is already installed. Use '--force' o > ption to update to latest version or provide '@' to install a specific > version, for example: 'gruntfuggly.todo-tree@1.2.3'. > Extension 'hrhr49.vscode-markdown-tefcha' v0.0.1 is already installed. Use '--fo > rce' option to update to latest version or provide '@' to install a spe > cific version, for example: 'hrhr49.vscode-markdown-tefcha@1.2.3'. > Extension 'ms-python.black-formatter' v2022.2.0 is already installed. Use '--for > ce' option to update to latest version or provide '@' to install a spec [10:49:53.760] > > ific version, for example: 'ms-python.black-formatter@1.2.3'. > Extension 'ms-python.python' v2022.10.1 is already installed. Use '--force' opti > on to update to latest version or provide '@' to install a specific ver [10:49:53.763] > > sion, for example: 'ms-python.python@1.2.3'. > Extension 'ms-python.vscode-pylance' v2022.7.30 is already installed. Use '--for > ce' option to update to latest version or provide '@' to install a spec > ific version, for example: 'ms-python.vscode-pylance@1.2.3'. > Extension 'njpwerner.autodocstring' v0.6.1 is already installed. Use '--force' o > ption to update to latest version or provide '@' to install a specific > version, for example: 'njpwerner.autodocstring@1.2.3'. [10:49:53.771] > [10:49:53.815] > > * > * Reminder: You may only use this software with Visual Studio family products, > * as described in the license (https://go.microsoft.com/fwlink/?linkid=2077057) > * > [10:49:53.828] > > Checking server status on port 39648 with wget [10:49:53.835] > > 97bc72611d08: start > SSH_AUTH_SOCK==== > DISPLAY==== > webUiAccessToken==== > listeningOn==39648== > osReleaseId==centos== [10:49:53.842] > > arch==x86_64== > tmpDir==/run/user/1001== > platform==linux== > unpackResult==== > didLocalDownload==0== > downloadTime==== > installTime==== > extInstallTime==669== > serverStartTime==== > connectionToken==11a11111-11a1-1a1a-1111-a11a111a1a1a== > 97bc72611d08: end [10:49:53.843] Received install output: SSH_AUTH_SOCK==== DISPLAY==== webUiAccessToken==== listeningOn==39648== osReleaseId==centos== arch==x86_64== tmpDir==/run/user/1001== platform==linux== unpackResult==== didLocalDownload==0== downloadTime==== installTime==== extInstallTime==669== serverStartTime==== connectionToken==11a11111-11a1-1a1a-1111-a11a111a1a1a== [10:49:53.844] Remote server is listening on 39648 [10:49:53.844] Parsed server configuration: {"serverConfiguration":{"remoteListeningOn":{"port":39648},"osReleaseId":"centos","arch":"x86_64","webUiAccessToken":"","sshAuthSock":"","display":"","tmpDir":"/run/user/1001","platform":"linux","connectionToken":"11a11111-11a1-1a1a-1111-a11a111a1a1a"},"extInstallTime":669,"installUnpackCode":""} [10:49:54.641] > [10:49:54.643] Starting forwarding server. localPort 55920 -> socksPort 55916 -> remotePort 39648 [10:49:55.666] Forwarding server listening on 55920 [10:49:55.667] Waiting for ssh tunnel to be ready [10:49:55.692] Tunneled 39648 to local port 55920 [10:49:55.693] Resolved "ssh-remote+7b22686f73744e616d65223a22636f64696e672e6c6f63616c222c2275736572223a2263687269735f6675227d" to "127.0.0.1:55920" [10:49:55.697] [Forwarding server 55920] Got connection 0 [10:49:55.730] ------ [10:49:55.793] [Forwarding server 55920] Got connection 1 [10:49:55.924] [Forwarding server 55920] Got connection 2 [10:50:00.231] [Forwarding server 55920] Got connection 3 [10:50:00.285] [Forwarding server 55920] Got connection 4 ```

Result of running export in the Terminal tab --

```plain [chris_fu@coding python_scripts]$ export declare -x BROWSER="/home/chris_fu/.vscode-server/bin/b06ae3b2d2dbfe28bca3134cc6be65935cdfea6a/bin/helpers/browser.sh" declare -x COLORTERM="truecolor" declare -x GIT_ASKPASS="/home/chris_fu/.vscode-server/bin/b06ae3b2d2dbfe28bca3134cc6be65935cdfea6a/extensions/git/dist/askpass.sh" declare -x HISTCONTROL="ignoredups" declare -x HISTSIZE="1000" declare -x HOME="/home/chris_fu" declare -x HOSTNAME="localhost.localdomain" declare -x LANG="en_US.UTF-8" declare -x LESSOPEN="||/usr/bin/lesspipe.sh %s" declare -x LOGNAME="chris_fu" declare -x LS_COLORS="rs=0:di=38;5;27:ln=38;5;51:mh=44;38;5;15:pi=40;38;5;11:so=38;5;13:do=38;5;5:bd=48;5;232;38;5;11:cd=48;5;232;38;5;3:or=48;5;232;38;5;9:mi=05;48;5;232;38;5;15:su=48;5;196;38;5;15:sg=48;5;11;38;5;16:ca=48;5;196;38;5;226:tw=48;5;10;38;5;16:ow=48;5;10;38;5;21:st=48;5;21;38;5;15:ex=38;5;34:*.tar=38;5;9:*.tgz=38;5;9:*.arc=38;5;9:*.arj=38;5;9:*.taz=38;5;9:*.lha=38;5;9:*.lz4=38;5;9:*.lzh=38;5;9:*.lzma=38;5;9:*.tlz=38;5;9:*.txz=38;5;9:*.tzo=38;5;9:*.t7z=38;5;9:*.zip=38;5;9:*.z=38;5;9:*.Z=38;5;9:*.dz=38;5;9:*.gz=38;5;9:*.lrz=38;5;9:*.lz=38;5;9:*.lzo=38;5;9:*.xz=38;5;9:*.bz2=38;5;9:*.bz=38;5;9:*.tbz=38;5;9:*.tbz2=38;5;9:*.tz=38;5;9:*.deb=38;5;9:*.rpm=38;5;9:*.jar=38;5;9:*.war=38;5;9:*.ear=38;5;9:*.sar=38;5;9:*.rar=38;5;9:*.alz=38;5;9:*.ace=38;5;9:*.zoo=38;5;9:*.cpio=38;5;9:*.7z=38;5;9:*.rz=38;5;9:*.cab=38;5;9:*.jpg=38;5;13:*.jpeg=38;5;13:*.gif=38;5;13:*.bmp=38;5;13:*.pbm=38;5;13:*.pgm=38;5;13:*.ppm=38;5;13:*.tga=38;5;13:*.xbm=38;5;13:*.xpm=38;5;13:*.tif=38;5;13:*.tiff=38;5;13:*.png=38;5;13:*.svg=38;5;13:*.svgz=38;5;13:*.mng=38;5;13:*.pcx=38;5;13:*.mov=38;5;13:*.mpg=38;5;13:*.mpeg=38;5;13:*.m2v=38;5;13:*.mkv=38;5;13:*.webm=38;5;13:*.ogm=38;5;13:*.mp4=38;5;13:*.m4v=38;5;13:*.mp4v=38;5;13:*.vob=38;5;13:*.qt=38;5;13:*.nuv=38;5;13:*.wmv=38;5;13:*.asf=38;5;13:*.rm=38;5;13:*.rmvb=38;5;13:*.flc=38;5;13:*.avi=38;5;13:*.fli=38;5;13:*.flv=38;5;13:*.gl=38;5;13:*.dl=38;5;13:*.xcf=38;5;13:*.xwd=38;5;13:*.yuv=38;5;13:*.cgm=38;5;13:*.emf=38;5;13:*.axv=38;5;13:*.anx=38;5;13:*.ogv=38;5;13:*.ogx=38;5;13:*.aac=38;5;45:*.au=38;5;45:*.flac=38;5;45:*.mid=38;5;45:*.midi=38;5;45:*.mka=38;5;45:*.mp3=38;5;45:*.mpc=38;5;45:*.ogg=38;5;45:*.ra=38;5;45:*.wav=38;5;45:*.axa=38;5;45:*.oga=38;5;45:*.spx=38;5;45:*.xspf=38;5;45:" declare -x MAIL="/var/spool/mail/chris_fu" declare -x OLDPWD declare -x PATH="/home/chris_fu/.vscode-server/bin/b06ae3b2d2dbfe28bca3134cc6be65935cdfea6a/bin/remote-cli:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/chris_fu/.local/bin:/home/chris_fu/bin" declare -x PWD="/home/chris_fu/Documents/python_scripts" declare -x PYTHONPATH="/opt/qiwei-python-library" declare -x SHELL="/bin/bash" declare -x SHLVL="5" declare -x SSH_ASKPASS="/usr/libexec/openssh/gnome-ssh-askpass" declare -x SSH_CLIENT="192.168.1.6 61337 22" declare -x SSH_CONNECTION="192.168.1.6 61337 192.168.1.60 22" declare -x TERM="xterm-256color" declare -x TERM_PROGRAM="vscode" declare -x TERM_PROGRAM_VERSION="1.69.1" declare -x USER="chris_fu" declare -x VSCODE_GIT_ASKPASS_EXTRA_ARGS="" declare -x VSCODE_GIT_ASKPASS_MAIN="/home/chris_fu/.vscode-server/bin/b06ae3b2d2dbfe28bca3134cc6be65935cdfea6a/extensions/git/dist/askpass-main.js" declare -x VSCODE_GIT_ASKPASS_NODE="/home/chris_fu/.vscode-server/bin/b06ae3b2d2dbfe28bca3134cc6be65935cdfea6a/node" declare -x VSCODE_GIT_IPC_HANDLE="/run/user/1001/vscode-git-e61f82be04.sock" declare -x VSCODE_IPC_HOOK_CLI="/run/user/1001/vscode-ipc-d294ade8-d2d6-40d8-8e16-b1f32c88ed76.sock" declare -x XDG_DATA_DIRS="/home/chris_fu/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share" declare -x XDG_RUNTIME_DIR="/run/user/1001" declare -x XDG_SESSION_ID="26" ```

Edit: PYTHONPATH has been set in both /etc/profile and /etc/bashrc on the server. It seems that only /etc/bashrc takes effect.

heejaechang commented 2 years ago

we are getting the search path through this which uses child_process.execFileSync that has this characteristic

The child_process.execFile() function is similar to child_process.exec() except that it does not spawn a shell by default. Rather, the specified executable file is spawned directly as a new process making it slightly more efficient than child_process.exec().

execFileSync is just sync version of execFile.

heejaechang commented 2 years ago

@Azureblade3808 are you asking to make it work when PYTHONPATH is set at /etc/profile?

Azureblade3808 commented 2 years ago

@heejaechang Yes. Or if there is some way to set PYTHONPATH for a spawned process, please let me know.

Azureblade3808 commented 2 years ago

Solved by moving PYTHONPATH setting from "/etc/bashrc" to "/etc/environment".

duhd1993 commented 1 year ago

What if you don't not have admin access and cannot edit /etc/environment?

rchiodo commented 1 year ago

There are other ways to set an environment variable: https://stackoverflow.com/questions/45502996/how-to-set-environment-variable-in-linux-permanently