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

python interpreter not showing in status bar (without development flag) #15961

Closed
mrTsjolder opened this issue Apr 15, 2021 · 9 comments
Closed
Assignees
Labels
area-environments Features relating to handling interpreter environments bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster

Comments

@mrTsjolder
Copy link

Maybe related to #15155?

Environment data

  • VS Code version: 1.54.3
  • Extension version: 2020.10.332292344
  • OS and version: Linux x64 5.11.13-arch1-1
  • Python version: Python 3
  • Type of virtual environment used: conda
  • Relevant/affected Python packages and their versions: N.A.
  • Relevant/affected Python-related VS Code extensions and their versions: N.A. (disabled all other extensions)
  • Value of the python.languageServer setting: Jedi

Expected behaviour

Python interpreter in status bar

Screenshot from 2021-04-15 10-16-48

Actual behaviour

No python interpreter in status bar

Screenshot from 2021-04-15 10-17-57

Steps to reproduce:

  1. Start VS code (as normal)
  2. Open any python file or jupyter notebook

Expected behaviour can be achieved as follows

  1. Start VS code with flag --enable-proposed-api ms-python.python
  2. Open any python file or jupyter notebook

Logs

Output for Python in the Output panel

User belongs to experiment group 'CollectLSRequestTiming - control'
User belongs to experiment group 'CollectNodeLSRequestTiming - experiment'
User belongs to experiment group 'pythonaacf'
User belongs to experiment group 'pythonSendEntireLineToREPL'
User belongs to experiment group 'pythonNotDisplayLinterPrompt'
User belongs to experiment group 'pythonDiscoveryModuleWithoutWatcher'
User belongs to experiment group 'pythonTensorboardExperiment'
> pyenv root
> python3.7 ~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python3.6 ~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python3 ~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python2 ~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python ~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> /opt/miniconda/bin/python ~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> /opt/miniconda/bin/conda info --json
Error 2021-04-15 10:17:52: Failed to check if file needs to be fixed [EntryNotFound (FileSystemError): Unable to read file '~/.config/Code/User/settings.json' (Error: Unable to resolve non-existing file '~/.config/Code/User/settings.json')
	at _handleError (/usr/lib/code/out/vs/workbench/services/extensions/node/extensionHostProcess.js:87:151863)
	at processTicksAndRejections (internal/process/task_queues.js:97:5)
	at async y.readText (~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/out/client/extension.js:9:168994)
	at async p.doesFileNeedToBeFixed (~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/out/client/extension.js:56:963651)
	at async ~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/out/client/extension.js:56:962778
	at async Promise.all (index 0)
	at async p.getFilesToBeFixed (~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/out/client/extension.js:56:962724)
	at async p.updateTestSettings (~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/out/client/extension.js:56:962351)] {
  code: 'FileNotFound'
}
> /opt/miniconda/bin/conda env list
Python interpreter path: /opt/miniconda/bin/python
Error 2021-04-15 10:17:52: Python Extension: interpreterManager.refresh [Error: [ms-python.python]: Proposed API is only available when running out of dev or with the following command line switch: --enable-proposed-api ms-python.python
	at f (/usr/lib/code/out/vs/workbench/services/extensions/node/extensionHostProcess.js:87:74959)
	at Object.g [as checkProposedApiEnabled] (/usr/lib/code/out/vs/workbench/services/extensions/node/extensionHostProcess.js:87:74906)
	at Object.get activeNotebookEditor [as activeNotebookEditor] (/usr/lib/code/out/vs/workbench/services/extensions/node/extensionHostProcess.js:95:39978)
	at u.get activeNotebookEditor [as activeNotebookEditor] (~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/out/client/extension.js:56:1203223)
	at u.get hidden [as hidden] (~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/out/client/extension.js:56:647038)
	at ~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/out/client/extension.js:56:846357
	at Array.every (<anonymous>)
	at g.updateVisibility (~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/out/client/extension.js:56:846345)
	at g.updateDisplay (~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/out/client/extension.js:56:846218)
	at async g.refresh (~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/out/client/extension.js:56:845171)]
Starting Jedi Python language engine.
> /opt/miniconda/bin/conda env list
> ~/.conda/envs/dlnn/bin/python ~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/pythonFiles/pyvsc-run-isolated.py -c "import jupyter"
> ~/.conda/envs/dlnn/bin/python ~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/pythonFiles/pyvsc-run-isolated.py -c "import notebook"
> ~/.conda/envs/dlnn/bin/python ~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/pythonFiles/pyvsc-run-isolated.py jupyter kernelspec --version
> ~/.conda/envs/dlnn/bin/python ~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/pythonFiles/pyvsc-run-isolated.py vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.jupyter_daemon -v
> ~/.conda/envs/dlnn/bin/python ~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/pythonFiles/pyvsc-run-isolated.py vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.jupyter_daemon -v
> ~/.conda/envs/dlnn/bin/python ~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/pythonFiles/pyvsc-run-isolated.py vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.jupyter_daemon -v
> ~/.conda/envs/dlnn/bin/python (daemon) -m jupyter notebook --no-browser --notebook-dir="~" --config=/tmp/acac0421-5df1-4f15-ac8d-9acf1f430ca1/jupyter_notebook_config.py --NotebookApp.iopub_data_rate_limit=10000000000.0
> ~/.conda/envs/dlnn/bin/python (daemon) -m jupyter kernelspec list --json
> ~/.conda/envs/dlnn/bin/python (daemon) -m jupyter kernelspec list --json
> /opt/miniconda/bin/python ~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/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 ~/Downloads/lexer.py
cwd: ~/Downloads
> /opt/miniconda/bin/python ~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/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 ~/Downloads/lexer.py
cwd: ~/Downloads
> /opt/miniconda/bin/python ~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/pythonFiles/pyvsc-run-isolated.py -c "import pylint"
> /opt/miniconda/bin/python ~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/pythonFiles/pyvsc-run-isolated.py -c "import pylint"
> /opt/miniconda/bin/python ~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/pythonFiles/pyvsc-run-isolated.py -c "import pylint"
> /opt/miniconda/bin/python ~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/pythonFiles/pyvsc-run-isolated.py -c "import pylint"

Linter 'pylint' is not installed. Please install it or select another linter".
Error: Module 'pylint' not installed.
> ~/.conda/envs/dlnn/bin/python (daemon) ~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/pythonFiles/vscode_datascience_helpers/getJupyterKernels.py
> ~/.conda/envs/dlnn/bin/python (daemon) ~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/pythonFiles/vscode_datascience_helpers/getJupyterKernels.py
> ~/.conda/envs/dlnn/bin/python (daemon) ~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/pythonFiles/vscode_datascience_helpers/getServerInfo.py
> ~/.conda/envs/dlnn/bin/python (daemon) ~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/pythonFiles/vscode_datascience_helpers/getServerInfo.py
> /opt/miniconda/bin/python ~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/pythonFiles/pyvsc-run-isolated.py -c "import ipykernel"
> /opt/miniconda/bin/python ~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/pythonFiles/pyvsc-run-isolated.py ipykernel install --user --name python37764bitbaseconda67b1fd21446a45aab81a5fea15778bb5 --display-name "Python 3.7.7 64-bit ('base': conda)"
> ~/.conda/envs/dlnn/bin/python (daemon) ~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/pythonFiles/vscode_datascience_helpers/getServerInfo.py
> ~/.conda/envs/dlnn/bin/python (daemon) ~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/pythonFiles/vscode_datascience_helpers/getServerInfo.py
Error 2021-04-15 10:17:53: Failed to register an interpreter as a kernel, Class name = I, completed in 406ms, has a falsy return value, Arg 1: {"architecture":3,"path":"/opt/miniconda/bin/python","version":{"options":{"loose":false,"includePrerelease":false},"loose":false,"raw":"3.7.7-final","major":3,"minor":7,"patch":7,"prerelease":["final"],"build":[],"version":"3.7.7-final"},"sysVersion":"3.7.7 (default, May  7 2020, 21:25:33) \n[GCC 7.3.0]","sysPrefix":"/opt/miniconda","fileHash":"034a381e15e1e780ca7f37cd9663c61b07e9b27fa240a71d34004d06c77a58e6adde8b3dc8b9d8980982f94c3408a9c4890afe144438e42439a8fe157d673ef9","companyDisplayName":"Anaconda, Inc.","envType":"Conda","envPath":"/opt/miniconda","envName":"base","displayName":"Python 3.7.7 64-bit ('base': conda)"}, Arg 2: true, Arg 3: <argument cannot be serialized for logging>, Return Value: undefined [r [Error]: Traceback (most recent call last):
  File "~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/pythonFiles/pyvsc-run-isolated.py", line 32, in <module>
    runpy.run_module(module, run_name="__main__", alter_sys=True)
  File "/opt/miniconda/lib/python3.7/runpy.py", line 201, in run_module
    mod_name, mod_spec, code = _get_module_details(mod_name)
  File "/opt/miniconda/lib/python3.7/runpy.py", line 136, in _get_module_details
    raise error("No module named %s" % mod_name)
ImportError: No module named ipykernel

	at ChildProcess.<anonymous> (~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/out/client/extension.js:17:55746)
	at Object.onceWrapper (events.js:422:26)
	at ChildProcess.emit (events.js:315:20)
	at maybeClose (internal/child_process.js:1021:16)
	at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)]
Error 2021-04-15 10:17:53: Error starting server in serverPreload:  [r [Error]: Traceback (most recent call last):
  File "~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/pythonFiles/pyvsc-run-isolated.py", line 32, in <module>
    runpy.run_module(module, run_name="__main__", alter_sys=True)
  File "/opt/miniconda/lib/python3.7/runpy.py", line 201, in run_module
    mod_name, mod_spec, code = _get_module_details(mod_name)
  File "/opt/miniconda/lib/python3.7/runpy.py", line 136, in _get_module_details
    raise error("No module named %s" % mod_name)
ImportError: No module named ipykernel

	at ChildProcess.<anonymous> (~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/out/client/extension.js:17:55746)
	at Object.onceWrapper (events.js:422:26)
	at ChildProcess.emit (events.js:315:20)
	at maybeClose (internal/child_process.js:1021:16)
	at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)]
> /opt/miniconda/bin/python ~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.prefix)"
cwd: ~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/out/client
> /opt/miniconda/bin/python ~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.prefix)"
cwd: ~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/out/client
> /opt/miniconda/bin/python ~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
cwd: ~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/out/client
> /opt/miniconda/bin/python ~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
cwd: ~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/out/client
> /opt/miniconda/bin/python ~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/pythonFiles/pyvsc-run-isolated.py -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"
cwd: ~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/out/client
> /opt/miniconda/bin/python ~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/pythonFiles/pyvsc-run-isolated.py -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"
cwd: ~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/out/client
> /opt/miniconda/bin/python ~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/pythonFiles/pyvsc-run-isolated.py site --user-site
cwd: ~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/out/client
> /opt/miniconda/bin/python ~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/pythonFiles/pyvsc-run-isolated.py site --user-site
cwd: ~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/out/client
> /opt/miniconda/bin/python ~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/pythonFiles/pyvsc-run-isolated.py ~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/pythonFiles/completion.py
> /opt/miniconda/bin/python ~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/pythonFiles/pyvsc-run-isolated.py ~/.vscode-oss/extensions/ms-python.python-2020.10.332292344/pythonFiles/completion.py

@mrTsjolder mrTsjolder added triage-needed Needs assignment to the proper sub-team bug Issue identified by VS Code Team member as probable bug labels Apr 15, 2021
@karthiknadig
Copy link
Member

@mrTsjolder Looks like you are using version 2020.10, the current version is 2021.03. So please try with the latest version of the extension.

@karthiknadig karthiknadig added area-environments Features relating to handling interpreter environments info-needed Issue requires more information from poster triage and removed triage-needed Needs assignment to the proper sub-team labels Apr 15, 2021
@mrTsjolder
Copy link
Author

@karthiknadig 2020.10 is the most recent version that I can install using the built-in plugin manager. I installed the 2021.03 from the vsix file under releases, which resulted in the error message

Cannot activate the 'Python' extension because it depends on an unknown 'ms-toolsai.jupyter' extension .

Since the ms-toolsai.jupyter seems to be only available for VS Code Insiders and the github does not provide a vsix file, I am not sure how to install this extension to satisfy the dependency.

I hope this is the kind of information you were after.

@karrtikr
Copy link

To install an older version of the extension you can follow the prompts from "Extensions: Install Specific Version of Extension..." in the command palette:

image

Or you can open the extensions side bar, click on the settings for the Python extension and pick "Install Another Version...":

https://user-images.githubusercontent.com/51720070/80000627-39dacc00-8472-11ea-9755-ac7ba0acbb70.gif

@karrtikr
Copy link

See this for the Jupyter extension dependency resolution #8372 (comment)

@mrTsjolder
Copy link
Author

mrTsjolder commented Apr 17, 2021

I am sorry if this was unclear, but I know how to install extensions using the built-in marketplace. The reason why I did it the hard way is because there is no ms-toolsai.jupyter extension in the marketplace for me (and the most recent version of the python extension is 2020.10).

Upon googling this issue, I found that the most straightforward reason for having old versions in the marketplace is due to some sort of incompatibility in the dependencies. Therefore, the idea would have been to install everything manually to see why the install fails. So, the installation of ms-python failed because of the missing dependency ms-toolsai.jupyter, which I cannot even try to install, because there is no vsix release.

See this for the Jupyter extension dependency resolution #8372 (comment)

This states that it should be possible to install the extension, but not how to install it (if it is not available in the marketplace).

@karrtikr Any ideas/suggestions how I could further help debug this issue?

@karrtikr karrtikr removed the info-needed Issue requires more information from poster label Apr 17, 2021
@karthiknadig
Copy link
Member

@mrTsjolder If you are not using VS Code, then you might not get ms-toolsai.jupyter in the market place for your editor. https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter

The next best option is to get the source code from vscode jupyter github and build it yourself.

Note that we have an goal of severing the dependency. But due to some technical limitations we have to have it this way. Previously both of these were the same extension, and starting november 2020 we split them in two.

@mrTsjolder
Copy link
Author

@mrTsjolder If you are not using VS Code, then you might not get ms-toolsai.jupyter in the market place for your editor. https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter

@karthiknadig Not sure what you mean with VS Code here. Is the open-source build of VS code something different than VS Code?

Do you happen to have any pointers for me to how to build an extension from the release provided by ms-toolsai.jupyter?

@karthiknadig
Copy link
Member

@mrTsjolder anyone can fork the https://github.com/Microsoft/vscode repository and make a build of VS Code. That does not make it official microsoft product. If you download and install VS Code from here https://code.visualstudio.com/Download that is the official build of VS Code. Juypter is available in the market place for VS Code
image

As for how to build ms-toolsai.jupyter, this is a question to ask on https://github.com/Microsoft/vscode-jupyter . You can also find build instruction for Jupyter extension here https://github.com/microsoft/vscode-jupyter/blob/main/CONTRIBUTING.md

@karrtikr karrtikr added the info-needed Issue requires more information from poster label Apr 20, 2021
@mrTsjolder
Copy link
Author

@karthiknadig Okay, I was not aware that the python extension is not officially supported for the free/open source version.
FYI: I am on arch linux, using the build provided by the code package.

I built the ms-toolsai.jupyter extension and got the error

Unable to install extension 'ms-toolsai.jupyter' as it is not compatible with VS Code '1.54.3'.

Assuming that this error is due to the content of package.json:

    "engines": {
        "vscode": "1.56.0-insider"
    },

I changed the requirement to "^1.54.0", as is used in this package and tried to install it again.
Although everything seems to work again (most notably environment is in the status bar), there was some extension loading error.
However, I presume that I should not be able to find the insider builds in the marketplace anyhow.
Therefore, I went back to git tag 2021.3.1 of ms-toolsai.jupyter (which appears as version 2021.3.0 in vs-code).
This effectively resolves the issue (in combination with version 2021.3.680753044 of ms-python).

The only question I am left with is why I can't directly update the extension in the marketplace.
However, I assume this should be a separate issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 25, 2021
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 bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

3 participants