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

Interpreter not Picked up From settings.json, and Multiple Paths not Working #14798

Closed
RishabhMalviya opened this issue Nov 22, 2020 · 6 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug

Comments

@RishabhMalviya
Copy link

RishabhMalviya commented Nov 22, 2020

Environment data

  • VS Code version: 1.51.1
  • Extension version (available under the Extensions sidebar): v2020.11.371526539
  • OS and version: Debian GNU/Linux 10 (actually a python:3.9 Docker image running on Microsoft Windows Home 10 (Version: 10.0.19042 Build 19042 with WSL2 Backend)
  • Python version: 3.90
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): Docker (with Remote-Containers plugin)
  • Relevant/affected Python packages and their versions: N/A
  • Relevant/affected Python-related VS Code extensions and their versions: N/A
  • Value of the python.languageServer setting: Jedi

Expected behaviour

The Python Interpreter should be picked up from the "python.pythonPath" key in settings.json.

Also, one should be able to specify multiple paths in the "python.pythonPath" in settings.json. In particular, I would like to point to:

  1. The Python3 installation in the Docker image
  2. The root folder of the project I am working on

This is to ensure linting and auto-complete to work properly:

{
    "python.pythonPath": "/usr/local/bin/python:${workspaceFolder}"
}

(In the case of multiple paths, the Python interpreter should be picked up from the first path.)

Actual behaviour

Every time I open VSCode or I try to run/debug my Python files, I am shown the following prompt: "You need to select a Python interpreter before you start debugging."

When I do so (selecting /usr/local/bin/python from the drop-down), it overwrites the settings.json file and removes the ${workspaceFolder}:

{
    "python.pythonPath": "/usr/local/bin/python"
}

This causes red linting to begin showing up in my code, because I am performing certain imports from the root of my working directory (and it has been removed from the settings.json).

Steps to reproduce:

  1. Clone this repository: https://github.com/RishabhMalviya/ml-productionization-template
  2. Put in any value for API_TOKEN in line 13 on the .env file:
API_TOKEN=abracadabra
  1. Put in the absolute path to the repo root on your local machine in line 14. On my machine, that is:
LOCAL_REPO_PATH=/c/Users/risha/giT/ml-productionization-template
  1. From the root of the repo, run docker-compose up -d model-dev. Wait for the container to come up.
  2. Open VSCode, make sure you have the Remote-Containers extension installed. From the command palette, choose "Remote-Containers: Attach to Running Container", and attach to the model-dev container you brought up in the previous step.
  3. Open the folder /app in the VSCode instance.
  4. A new VSCode window will open. Check if the Microsoft Python (ms-python.python) Extension is installed. If not, install it. You may also get a prompt to "install Linter pylint". Install it as well.
  5. Close the VSCode instance. Open it again.
  6. Open app.py and try to run it.
  7. After a minute or so, you'll get the following prompt from VSCode:
No Python interpreter is selected. You need to select a Python interpreter to enable features such as IntelliSense, linting, and debugging.
  1. From the prompt, click Select Python Interpreter, and choose the interpreter Python 3.9.0 64-bit /usr/local/bin/python.
  2. Now there should be red lint under lines 9 and 10 in app.py, and there should be corresponding entries in the Problems panel on the bottom.
  3. Change the settings.json back to the original:
{
    "python.pythonPath": "/usr/local/bin/python:${workspaceFolder}"
}
  1. Try to run app.py again. You'll be forced to select a Python interpreter again.

Logs

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

XXX

User belongs to experiment group 'ShowPlayIcon - start'
User belongs to experiment group 'ShowExtensionSurveyPrompt - enabled'
User belongs to experiment group 'DebugAdapterFactory - experiment'
User belongs to experiment group 'PtvsdWheels37 - experiment'
User belongs to experiment group 'UseTerminalToGetActivatedEnvVars - control'
User belongs to experiment group 'LocalZMQKernel - experiment'
User belongs to experiment group 'CollectLSRequestTiming - control'
User belongs to experiment group 'CollectNodeLSRequestTiming - experiment'
User belongs to experiment group 'EnableIPyWidgets - experiment'
User belongs to experiment group 'RunByLine - experiment'
User belongs to experiment group 'CustomEditorSupport - control'
User belongs to experiment group 'pythonaacf'
Error 2020-11-22 07:18:47: Failed to check if file needs to be fixed [EntryNotFound (FileSystemError): Unable to read file 'vscode-remote://attached-container+7b22636f6e7461696e65724e616d65223a222f6d6f64656c2d646576227d/root/.config/Code/User/settings.json' (EntryNotFound (FileSystemError): Error: ENOENT: no such file or directory, open '/root/.config/Code/User/settings.json')
	at _handleError (/root/.vscode-server/bin/e5a624b788d92b8d34d1392e4c4d9789406efe8f/out/vs/server/remoteExtensionHostProcess.js:754:838)
	at processTicksAndRejections (internal/process/task_queues.js:94:5)
	at async y.readText (/root/.vscode-server/extensions/ms-python.python-2020.11.371526539/out/client/extension.js:9:152841)
	at async p.doesFileNeedToBeFixed (/root/.vscode-server/extensions/ms-python.python-2020.11.371526539/out/client/extension.js:39:469606)
	at async /root/.vscode-server/extensions/ms-python.python-2020.11.371526539/out/client/extension.js:39:468733
	at async Promise.all (index 0)
	at async p.getFilesToBeFixed (/root/.vscode-server/extensions/ms-python.python-2020.11.371526539/out/client/extension.js:39:468679)
	at async p.updateTestSettings (/root/.vscode-server/extensions/ms-python.python-2020.11.371526539/out/client/extension.js:39:468306)] {
  code: 'FileNotFound',
  name: 'EntryNotFound (FileSystemError)'
}
> pyenv root
> conda --version
> python2 ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python3.7 ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python3 ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> /usr/local/bin/python ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python3.6 ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> conda info --json
Python interpreter path: /usr/local/bin/python
Starting Jedi Python language engine.
> conda --version
> /usr/local/bin/python ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.prefix)"
cwd: /app
> /usr/local/bin/python ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.prefix)"
cwd: /app
> /usr/local/bin/python ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
cwd: /app
> /usr/local/bin/python ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
cwd: /app
> /usr/local/bin/python ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"
cwd: /app
> /usr/local/bin/python ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"
cwd: /app
> /usr/local/bin/python ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py site --user-site
cwd: /app
> /usr/local/bin/python ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py site --user-site
cwd: /app
> /usr/local/bin/python ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/completion.py
> /usr/local/bin/python ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/completion.py
> /usr/local/bin/python ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py pylint --disable=all --enable=F,unreachable,duplicate-key,unnecessary-semicolon,global-variable-not-assigned,unused-variable,unused-wildcard-import,binary-op-exception,bad-format-string,anomalous-backslash-in-string,bad-open-mode,E0001,E0011,E0012,E0100,E0101,E0102,E0103,E0104,E0105,E0107,E0108,E0110,E0111,E0112,E0113,E0114,E0115,E0116,E0117,E0118,E0202,E0203,E0211,E0213,E0236,E0237,E0238,E0239,E0240,E0241,E0301,E0302,E0303,E0401,E0402,E0601,E0602,E0603,E0604,E0611,E0632,E0633,E0701,E0702,E0703,E0704,E0710,E0711,E0712,E1003,E1101,E1102,E1111,E1120,E1121,E1123,E1124,E1125,E1126,E1127,E1128,E1129,E1130,E1131,E1132,E1133,E1134,E1135,E1136,E1137,E1138,E1139,E1200,E1201,E1205,E1206,E1300,E1301,E1302,E1303,E1304,E1305,E1306,E1310,E1700,E1701 --msg-template='{line},{column},{category},{symbol}:{msg}' --reports=n --output-format=text /app/app.py
cwd: /app
> /usr/local/bin/python ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py pylint --disable=all --enable=F,unreachable,duplicate-key,unnecessary-semicolon,global-variable-not-assigned,unused-variable,unused-wildcard-import,binary-op-exception,bad-format-string,anomalous-backslash-in-string,bad-open-mode,E0001,E0011,E0012,E0100,E0101,E0102,E0103,E0104,E0105,E0107,E0108,E0110,E0111,E0112,E0113,E0114,E0115,E0116,E0117,E0118,E0202,E0203,E0211,E0213,E0236,E0237,E0238,E0239,E0240,E0241,E0301,E0302,E0303,E0401,E0402,E0601,E0602,E0603,E0604,E0611,E0632,E0633,E0701,E0702,E0703,E0704,E0710,E0711,E0712,E1003,E1101,E1102,E1111,E1120,E1121,E1123,E1124,E1125,E1126,E1127,E1128,E1129,E1130,E1131,E1132,E1133,E1134,E1135,E1136,E1137,E1138,E1139,E1200,E1201,E1205,E1206,E1300,E1301,E1302,E1303,E1304,E1305,E1306,E1310,E1700,E1701 --msg-template='{line},{column},{category},{symbol}:{msg}' --reports=n --output-format=text /app/app.py
cwd: /app
Error 2020-11-22 07:18:48: stderr jediProxy Error (stderr) /root/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/completion.py:584: DeprecationWarning: Deprecated since version 0.16.0. Use Script(...).get_names instead.
  jedi.api.names(

##########Linting Output - pylint##########
************* Module app
9,0,error,no-name-in-module:No name 'utils' in module 'api'
10,0,error,no-name-in-module:No name 'utils' in module 'api'
90,53,error,unsubscriptable-object:Value 'Union' is unsubscriptable

------------------------------------------------------------------
Your code has been rated at 7.27/10 (previous run: 7.27/10, +0.00)

Error 2020-11-22 07:20:19: stderr jediProxy Error (stderr) /root/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/completion.py:584: DeprecationWarning: Deprecated since version 0.16.0. Use Script(...).get_names instead.
  jedi.api.names(

Error 2020-11-22 07:21:20: stderr jediProxy Error (stderr) /root/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/completion.py:584: DeprecationWarning: Deprecated since version 0.16.0. Use Script(...).get_names instead.
  jedi.api.names(

Error 2020-11-22 07:21:34: stderr jediProxy Error (stderr) /root/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/completion.py:584: DeprecationWarning: Deprecated since version 0.16.0. Use Script(...).get_names instead.
  jedi.api.names(

Error 2020-11-22 07:21:37: stderr jediProxy Error (stderr) /root/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/completion.py:584: DeprecationWarning: Deprecated since version 0.16.0. Use Script(...).get_names instead.
  jedi.api.names(

Error 2020-11-22 07:21:38: stderr jediProxy Error (stderr) /root/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/completion.py:584: DeprecationWarning: Deprecated since version 0.16.0. Use Script(...).get_names instead.
  jedi.api.names(

Error 2020-11-22 07:21:40: stderr jediProxy Error (stderr) /root/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/completion.py:584: DeprecationWarning: Deprecated since version 0.16.0. Use Script(...).get_names instead.
  jedi.api.names(

Error 2020-11-22 07:21:42: stderr jediProxy Error (stderr) /root/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/completion.py:584: DeprecationWarning: Deprecated since version 0.16.0. Use Script(...).get_names instead.
  jedi.api.names(

Error 2020-11-22 07:21:44: stderr jediProxy Error (stderr) /root/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/completion.py:584: DeprecationWarning: Deprecated since version 0.16.0. Use Script(...).get_names instead.
  jedi.api.names(

Error 2020-11-22 07:21:45: stderr jediProxy Error (stderr) /root/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/completion.py:584: DeprecationWarning: Deprecated since version 0.16.0. Use Script(...).get_names instead.
  jedi.api.names(

Error 2020-11-22 07:21:47: stderr jediProxy Error (stderr) /root/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/completion.py:584: DeprecationWarning: Deprecated since version 0.16.0. Use Script(...).get_names instead.
  jedi.api.names(

Error 2020-11-22 07:21:48: stderr jediProxy Error (stderr) /root/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/completion.py:584: DeprecationWarning: Deprecated since version 0.16.0. Use Script(...).get_names instead.
  jedi.api.names(

Error 2020-11-22 07:21:50: stderr jediProxy Error (stderr) /root/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/completion.py:584: DeprecationWarning: Deprecated since version 0.16.0. Use Script(...).get_names instead.
  jedi.api.names(

Error 2020-11-22 07:21:51: stderr jediProxy Error (stderr) /root/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/completion.py:592: DeprecationWarning: Providing the line is now done in the functions themselves like `Script(...).complete(line, column)`
  script = jedi.Script(
/root/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/completion.py:592: DeprecationWarning: Providing the column is now done in the functions themselves like `Script(...).complete(line, column)`
  script = jedi.Script(

Error 2020-11-22 07:21:51: stderr jediProxy Error (stderr) /root/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/completion.py:592: DeprecationWarning: Deprecated since version 0.17.0. Use the project API instead, which means Script(project=Project(dir, sys_path=sys_path)) instead.
  script = jedi.Script(

Error 2020-11-22 07:21:51: stderr jediProxy Error (stderr) /root/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/completion.py:626: DeprecationWarning: Deprecated since version 0.16.0. Use Script(...).infer instead.
  script.goto_definitions(), request["id"]

Error 2020-11-22 07:21:51: stderr jediProxy Error (stderr) /root/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/completion.py:584: DeprecationWarning: Deprecated since version 0.16.0. Use Script(...).get_names instead.
  jedi.api.names(

> /usr/local/bin/python:/app ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> /usr/local/bin/python:/app ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> /usr/local/bin/python:/app ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> /usr/local/bin/python:/app ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> /usr/local/bin/python:/app ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> /usr/local/bin/python:/app ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> /usr/local/bin/python:/app ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> /usr/local/bin/python:/app ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
Starting Jedi Python language engine.
Error 2020-11-22 07:22:53: Failed to create File hash for interpreter /usr/local/bin/python:/app [Error: ENOENT: no such file or directory, lstat '/usr/local/bin/python:/app'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'lstat',
  path: '/usr/local/bin/python:/app'
}
Error 2020-11-22 07:22:53: Failed to create File hash for interpreter /usr/local/bin/python:/app [Error: ENOENT: no such file or directory, lstat '/usr/local/bin/python:/app'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'lstat',
  path: '/usr/local/bin/python:/app'
}
Error 2020-11-22 07:22:53: Failed to create File hash for interpreter /usr/local/bin/python:/app [Error: ENOENT: no such file or directory, lstat '/usr/local/bin/python:/app'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'lstat',
  path: '/usr/local/bin/python:/app'
}
Error 2020-11-22 07:22:53: Failed to get interpreter information for '/usr/local/bin/python:/app' [Error: Command failed: "/usr/local/bin/python:/app" "/root/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py" "/root/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/interpreterInfo.py"
/bin/sh: 1: /usr/local/bin/python:/app: not found

	at ChildProcess.exithandler (child_process.js:295:12)
	at ChildProcess.emit (events.js:223:5)
	at maybeClose (internal/child_process.js:1021:16)
	at Socket.<anonymous> (internal/child_process.js:430:11)
	at Socket.emit (events.js:223:5)
	at Pipe.<anonymous> (net.js:664:12)] {
  killed: false,
  code: 127,
  signal: null,
  cmd: '"/usr/local/bin/python:/app" "/root/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py" "/root/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/interpreterInfo.py"'
}
Error 2020-11-22 07:22:53: Invalid Python Path '/usr/local/bin/python:/app'
Error 2020-11-22 07:22:53: Failed to get interpreter information for '/usr/local/bin/python:/app' [Error: Command failed: "/usr/local/bin/python:/app" "/root/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py" "/root/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/interpreterInfo.py"
/bin/sh: 1: /usr/local/bin/python:/app: not found

	at ChildProcess.exithandler (child_process.js:295:12)
	at ChildProcess.emit (events.js:223:5)
	at maybeClose (internal/child_process.js:1021:16)
	at Socket.<anonymous> (internal/child_process.js:430:11)
	at Socket.emit (events.js:223:5)
	at Pipe.<anonymous> (net.js:664:12)] {
  killed: false,
  code: 127,
  signal: null,
  cmd: '"/usr/local/bin/python:/app" "/root/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py" "/root/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/interpreterInfo.py"'
}
Error 2020-11-22 07:22:53: Invalid Python Path '/usr/local/bin/python:/app'
Error 2020-11-22 07:22:53: Failed to get interpreter information for '/usr/local/bin/python:/app' [Error: Command failed: "/usr/local/bin/python:/app" "/root/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py" "/root/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/interpreterInfo.py"
/bin/sh: 1: /usr/local/bin/python:/app: not found

	at ChildProcess.exithandler (child_process.js:295:12)
	at ChildProcess.emit (events.js:223:5)
	at maybeClose (internal/child_process.js:1021:16)
	at Socket.<anonymous> (internal/child_process.js:430:11)
	at Socket.emit (events.js:223:5)
	at Pipe.<anonymous> (net.js:664:12)] {
  killed: false,
  code: 127,
  signal: null,
  cmd: '"/usr/local/bin/python:/app" "/root/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py" "/root/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/interpreterInfo.py"'
}
Error 2020-11-22 07:22:53: Invalid Python Path '/usr/local/bin/python:/app'
> /usr/local/bin/python:/app ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py pylint --disable=all --enable=F,unreachable,duplicate-key,unnecessary-semicolon,global-variable-not-assigned,unused-variable,unused-wildcard-import,binary-op-exception,bad-format-string,anomalous-backslash-in-string,bad-open-mode,E0001,E0011,E0012,E0100,E0101,E0102,E0103,E0104,E0105,E0107,E0108,E0110,E0111,E0112,E0113,E0114,E0115,E0116,E0117,E0118,E0202,E0203,E0211,E0213,E0236,E0237,E0238,E0239,E0240,E0241,E0301,E0302,E0303,E0401,E0402,E0601,E0602,E0603,E0604,E0611,E0632,E0633,E0701,E0702,E0703,E0704,E0710,E0711,E0712,E1003,E1101,E1102,E1111,E1120,E1121,E1123,E1124,E1125,E1126,E1127,E1128,E1129,E1130,E1131,E1132,E1133,E1134,E1135,E1136,E1137,E1138,E1139,E1200,E1201,E1205,E1206,E1300,E1301,E1302,E1303,E1304,E1305,E1306,E1310,E1700,E1701 --msg-template='{line},{column},{category},{symbol}:{msg}' --reports=n --output-format=text /app/app.py
cwd: /app
> /usr/local/bin/python:/app ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py pylint --disable=all --enable=F,unreachable,duplicate-key,unnecessary-semicolon,global-variable-not-assigned,unused-variable,unused-wildcard-import,binary-op-exception,bad-format-string,anomalous-backslash-in-string,bad-open-mode,E0001,E0011,E0012,E0100,E0101,E0102,E0103,E0104,E0105,E0107,E0108,E0110,E0111,E0112,E0113,E0114,E0115,E0116,E0117,E0118,E0202,E0203,E0211,E0213,E0236,E0237,E0238,E0239,E0240,E0241,E0301,E0302,E0303,E0401,E0402,E0601,E0602,E0603,E0604,E0611,E0632,E0633,E0701,E0702,E0703,E0704,E0710,E0711,E0712,E1003,E1101,E1102,E1111,E1120,E1121,E1123,E1124,E1125,E1126,E1127,E1128,E1129,E1130,E1131,E1132,E1133,E1134,E1135,E1136,E1137,E1138,E1139,E1200,E1201,E1205,E1206,E1300,E1301,E1302,E1303,E1304,E1305,E1306,E1310,E1700,E1701 --msg-template='{line},{column},{category},{symbol}:{msg}' --reports=n --output-format=text /app/app.py
cwd: /app
> /usr/local/bin/python:/app ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py -c "import pylint"
> /usr/local/bin/python:/app ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py -c "import pylint"

Linter 'pylint' is not installed. Please install it or select another linter".
Error: spawn /usr/local/bin/python:/app ENOENT
> /usr/local/bin/python:/app ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> /usr/local/bin/python:/app ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> /usr/local/bin/python:/app ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.prefix)"
cwd: /app
> /usr/local/bin/python:/app ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.prefix)"
cwd: /app
> /usr/local/bin/python:/app ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
cwd: /app
> /usr/local/bin/python:/app ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
cwd: /app
> /usr/local/bin/python:/app ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"
cwd: /app
> /usr/local/bin/python:/app ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"
cwd: /app
> /usr/local/bin/python:/app ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py site --user-site
cwd: /app
> /usr/local/bin/python:/app ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py site --user-site
cwd: /app
> /usr/local/bin/python:/app ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> /usr/local/bin/python:/app ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> /usr/local/bin/python:/app ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> /usr/local/bin/python:/app ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> /usr/local/bin/python:/app ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> /usr/local/bin/python:/app ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> /usr/local/bin/python:/app ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> /usr/local/bin/python:/app ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> /usr/local/bin/python:/app ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> /usr/local/bin/python:/app ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> /usr/local/bin/python:/app ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> /usr/local/bin/python:/app ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> /usr/local/bin/python:/app ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> /usr/local/bin/python:/app ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> /usr/local/bin/python:/app ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> /usr/local/bin/python:/app ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
@RishabhMalviya RishabhMalviya added triage-needed Needs assignment to the proper sub-team bug Issue identified by VS Code Team member as probable bug labels Nov 22, 2020
@hyperstown
Copy link

Same problem here. I also tried to create a new project, initialize venv inside cwd and reopen folder and now I get the message:

image

I installed Code and Python extension inside VM to eliminate problem with my configuration and I get the same type of error. Although when I hit run it finds somehow path to python.

image


Environment data:

Version: 1.51.1
Date: 2020-11-12T10:54:25.653Z
Electron: 9.3.4
Chrome: 83.0.4103.122
Node.js: 12.14.1
V8: 8.3.110.13-electron.0
OS: Linux x64 5.8.18-1-MANJARO
Python: 3.8.6

@ShadiestGoat
Copy link

Also same here!

OS: Linux x64 5.9.8-arch1-1
Python: 3.8.6
VSC Version: 1.50.1
Electron: 9.3.4
Chrome: 83.0.4103.122
Node.js: 12.14.1

@ShadiestGoat
Copy link

ah also, looking at other issues & releases, according to a recent release, and issue #12462, this has been changed. I'm not quite sure about how this affects things, but it is a possibility.

@ghost ghost removed the triage-needed Needs assignment to the proper sub-team label Nov 23, 2020
@kimadeline
Copy link

Hello @RishabhMalviya and @ShadiestGoat, thank you for reaching out.

The python.pythonPath setting in settings.json only accepts the path to the Python interpreter, or the path to a folder containing the Python interpreter (settings reference).

If you want to specify extra paths like your workspace root, you should use the PYTHONPATH environment variable, which you can specify in a .env file, or via the OS-specific terminal.integrated.env.* setting (see this paragraph about the use of the PYTHONPATH environment variable).

@ghost ghost removed the triage label Nov 23, 2020
@RishabhMalviya
Copy link
Author

@kimadeline Thanks for the helpful reply.

As explained in the links you sent, I added the following to my .env file:

PYTHONPATH="/app:${env:PYTHONPATH}"

(I'm working inside a Docker container, and the absolute path /app is where all my code lives).

And following the steps taken by the OP in #12085, I added the terminal.integrated.env.* settings in my settings.json as follows:

{
    "python.pythonPath": "/usr/local/bin/python",
    "python.autoComplete.extraPaths": ["/app"],
    "terminal.integrated.env.linux": {
        "PYTHONPATH": "/app:${env:PYTHONPATH}"
    },
    "terminal.integrated.env.osx": {
        "PYTHONPATH": "/app:${env:PYTHONPATH}"
    },
    "terminal.integrated.env.windows": {
        "PYTHONPATH": "/app:${env:PYTHONPATH}"
    }
}

Auto-complete and debugging are working as expected now!
But for some reason, the linter continues to insist that the imports from /app are incorrect. As a result, my Problems pane is almost always full.

Is linting not part of the core VSCode Python extension?

@kimadeline
Copy link

Hi @RishabhMalviya,

Linting is supported by the extension, although you'll have to install your own linter. Please open a separate issue since it is unrelated to what was initially reported, and specify there which linter you use as well.

Thanks!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug
Projects
None yet
Development

No branches or pull requests

5 participants