vscode-python: Error activating Python extension when Java extension is already activated

Environment data

  • VS Code version: 1.39.2
  • Extension version (available under the Extensions sidebar): 2019.10.44104
  • OS and version: MacOS Catalina 10.15
  • Python version (& distribution if applicable, e.g. Anaconda): 3.7.4 pip
  • Type of virtual environment used (N/A | venv | virtualenv | conda | …): virtualenv
  • Jedi or Language Server? (i.e. what is "python.jediEnabled" set to; more info #3977): Language Server

Expected behaviour

Python extension runs without errors

Actual behaviour

Python extension fails to start due to error

Steps to reproduce:

Not sure if these steps will work on a different environment, but this is how it happens for me:

  1. Install Python Extension and Java Extension pack (https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-pack)
  2. Create a project which includes both Java and Python files
  3. Close all tabs on the VS Code and close the VS Code
  4. Open VS Code
  5. Open any Java file => Java extension is activated
  6. Open any Python file => Error activating extension

Logs

Output for VS IntelliCode:

Acquiring model 'intellisense-members' for java
Querying IntelliCode service for available models.
Cached model is up to date.
vs-intellicode-java was passed a model: {"modelPath":"/Users/pavel/.vscode/extensions/visualstudioexptteam.vscodeintellicode-1.2.0/cache/45788CA1782FEF17F07049DB4764F5647A62_975CC5EC71E347A9B047E779B175B7D3","modelId":"45788CA1782FEF17F07049DB4764F5647A62","outputId":"975CC5EC71E347A9B047E779B175B7D3"}.
Java Extension is activated.
JavaAPI: {"apiVersion":"0.2","javaRequirement":{"java_home":"/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home","java_version":8},"status":"Started"}
Enabled IntelliCode for Java.
Acquiring model 'intellisense-members' for python
Querying IntelliCode service for available models.
Cached model is up to date.
vs-intellicode-python was passed a model: {"modelPath":"/Users/pavel/.vscode/extensions/visualstudioexptteam.vscodeintellicode-1.2.0/cache/88630A1B4C077752096ECAA576B92C7D3FA1_9BA695AD4C514C32A5D0AC9B02846CD7","modelId":"88630A1B4C077752096ECAA576B92C7D3FA1","outputId":"9BA695AD4C514C32A5D0AC9B02846CD7"}.
Error while activating Python: {}

Output from Console under the Developer Tools panel (toggle Developer Tools on under Help; turn on source maps to make any tracebacks be useful by running Enable source map support for extension debugging)

(Sorry to paste it like that, but I am not able to enable source map support since extension is not loaded at the moment of error)

[Extension Host] Here is the error stack:  TypeError: (intermediate value).disable(...).ignoreErrors is not a function
	at Object.t.initialize (/Users/pavel/.vscode/extensions/ms-python.python-2019.10.44104/out/client/extension.js:24:10981)
	at Object.<anonymous> (/Users/pavel/.vscode/extensions/ms-python.python-2019.10.44104/out/client/extension.js:9:344367)
	at n (/Users/pavel/.vscode/extensions/ms-python.python-2019.10.44104/out/client/extension.js:1:279)
	at /Users/pavel/.vscode/extensions/ms-python.python-2019.10.44104/out/client/extension.js:1:1078
	at Object.<anonymous> (/Users/pavel/.vscode/extensions/ms-python.python-2019.10.44104/out/client/extension.js:1:1089)
	at Object.<anonymous> (/Users/pavel/.vscode/extensions/ms-python.python-2019.10.44104/out/client/extension.js:77:3)
	at Module.o._compile (/Applications/Visual Studio Code 2.app/Contents/Resources/app/out/vs/loader.js:15:749)
	at Object.Module._extensions..js (internal/modules/cjs/loader.js:704:10)
	at Module.load (internal/modules/cjs/loader.js:602:32)
	at tryModuleLoad (internal/modules/cjs/loader.js:541:12)
	at Function.Module._load (internal/modules/cjs/loader.js:533:3)
	at Function.t._load (/Applications/Visual Studio Code 2.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:785:720)
	at Function.n._load (/Applications/Visual Studio Code 2.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:754:302)
	at Function.i._load (/Applications/Visual Studio Code 2.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:750:870)
	at Module.require (internal/modules/cjs/loader.js:640:17)
	at require (internal/modules/cjs/helpers.js:20:18)
	at Function.s [as __$__nodeRequire] (/Applications/Visual Studio Code 2.app/Contents/Resources/app/out/vs/loader.js:32:963)
	at t.ExtHostExtensionService._loadCommonJSModule (/Applications/Visual Studio Code 2.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:755:484)
	at t.ExtHostExtensionService._doActivateExtension (/Applications/Visual Studio Code 2.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:666:300)
	at t.ExtHostExtensionService._activateExtension (/Applications/Visual Studio Code 2.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:665:360)
	at Object.actualActivateExtension (/Applications/Visual Studio Code 2.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:663:296)
	at t.ExtensionsActivator._activateExtension (/Applications/Visual Studio Code 2.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:496:731)
	at n.length.Promise.all.r.map.e (/Applications/Visual Studio Code 2.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:496:409)
	at Array.map (<anonymous>)
	at t.ExtensionsActivator._activateExtensions (/Applications/Visual Studio Code 2.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:496:397)
	at t.ExtensionsActivator.activateByEvent (/Applications/Visual Studio Code 2.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:494:126)
	at t.ExtHostExtensionService._activateByEvent (/Applications/Visual Studio Code 2.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:664:24)
	at _readyToRunExtensions.wait.then.t (/Applications/Visual Studio Code 2.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:672:293)
	at i (/Users/pavel/.vscode/extensions/vscjava.vscode-java-test-0.20.0/dist/extension.js:16:188376)
	at /Users/pavel/.vscode/extensions/vscjava.vscode-java-test-0.20.0/dist/extension.js:16:188870

If you need more information, I can try to provide it.

Thanks!

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 14
  • Comments: 16

Most upvoted comments

Thank you for providing more info! I can confirm that I can reproduce with the sample project, and if I wait for the Java extension to finish loading before I open a Python file. Thank you for the bug report, we’ll have to investigate further 🔍

In the meantime, there are workarounds you can use:

  • Activate the Python extension first by opening a Python file before a Java file
  • Do not wait for the Java extension to activate before opening a Python file by opening a Python file straight after a Java file

Thanks!


Notes

  • Could only reproduce if the Java extension pack is done loading before opening a Python file
  • The error is ignoreErrors is not a function in src/client/sourceMapSupport.ts L.71:

https://github.com/microsoft/vscode-python/blob/8f26b2e95fe4f4ab93dc4c1044e6eea36132b898/src/client/sourceMapSupport.ts#L70-L72

  • ignoreErrors is a utility function we add to Promise.prototype, interestingly Promise.prototype (and the general Promise class structure) is different depending on whether the extension is loaded first or second:
extension loaded first (works) extension loaded second (bug)
image image

I am still getting this error too. (VS Code Version: 1.56.1)

Cannot activate the 'Python' extension because it depends on the 'Jupyter' extension, which is not loaded. Would you like to reload the window to load the extension?

Clicking “Reload Window” just reloads and gets the same error again

It seems that the error is fixed by some other change. Closing.