Skip to content

New version tries to pip install kernelspec #2308

Closed

Description

vscode version : 1.42.0
vscode-python version : 2020.2.62710
python version : 3.7.3 64-bits
os : windows 10
no venv, no anaconda

I just updated VScode and the python extension. When trying to run a Jupyter notebook or a Jupyter cell, it tries to start a Jupyter server but fails and gives an error notification asking to install more dependencies. When pressing the "Install" button, it tries to pip install kernelspec.

"C:/Program Files/Python37/python.exe" c:/Users/loudur01/.vscode/extensions/ms-python.python-2020.2.62710/pythonFiles/shell_exec.py "C:/Program Files/Python37/python.exe" -m pip install -U kernelspec --user C:/Users/loudur01/AppData/Local/Temp/tmp-14796WOIAB7kweneN.log
Executing command in shell >> C:/Program Files/Python37/python.exe -m pip install -U kernelspec --user
Collecting kernelspec
 Could not find a version that satisfies the requirement kernelspec (from versions: )
No matching distribution found for kernelspec
You are using pip version 19.0.3, however version 20.0.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
Traceback (most recent call last):
  File "c:/Users/loudur01/.vscode/extensions/ms-python.python-2020.2.62710/pythonFiles/shell_exec.py", line 26, in <module>
    subprocess.check_call(shell_args, stdout=sys.stdout, stderr=sys.stderr)
  File "C:\Program Files\Python37\lib\subprocess.py", line 347, in check_call
    raise CalledProcessError(retcode, cmd)

I tried uninstalling and reinstalling jupyter, rebooting the computer, running as admin.

Edit : rolling back to 2020.1.58038 and it works again

Activity

  1. patrick-nadeau commented on Feb 12, 2020

    @patrick-nadeau

    I encountered this issue too on Mac OS with the same error. Rolling back vscode-python to 2020.1.58038 also fixed it.

  2. rchiodo commented on Feb 12, 2020

    @rchiodo
    Contributor

    Hmm, not sure why we're trying to install kernelspec. We should be installing ipykernel.

    Thanks for the bug, we'll look into it.

  3. DonJayamanne commented on Feb 12, 2020

    @DonJayamanne
    Contributor

    Louis Duret-Robert (@Louis-DR) Please could you provide a screenshot of the message and provide the logs from your extension. Please install the latest version to get the failures and get the logs from Help -> Toggle Developer Tools -> Console window.

    Looks like the interpreter doesn't have kernelspec installed as part of Jupyter.
    Please could you try one of the following:

    • Manually reinstall jupyter into C:/Program Files/Python37/python.exe
    • Or select another interpreter that has jupyter in it.

    Thanks

  4. DonJayamanne commented on Feb 12, 2020

    @DonJayamanne
    Contributor

    I think i found the place this happens, we might want to get a point release out for this.

  5. DonJayamanne commented on Feb 12, 2020

    @DonJayamanne
    Contributor

    Patrick Nadeau (@patrick-nadeau) Please could you re-install jupyter or select another interpreter containing jupyter, looks like kernelspec cannot be located in the interpreter you have selected.

  6. patrick-nadeau commented on Feb 12, 2020

    @patrick-nadeau

    Don Jayamanne (@DonJayamanne) : I tried re-installing jupyter and selecting other interpreters containing jupyter. In fact, I had tried everything that Louis Duret-Robert (@Louis-DR) mentioned in his post above. Nothing worked. I confirmed that jupyter was working by running it successfully from the terminal outside of VScode. Also, this problem only started once I upgraded to vscode-python 2020.2.62710. The interactive terminal worked fine under 2020.1.58038.

  7. DonJayamanne commented on Feb 12, 2020

    @DonJayamanne
    Contributor

    Patrick Nadeau (@patrick-nadeau) Louis Duret-Robert (@Louis-DR)

    Please could you provide the output of the following:

    • <python executable> --version
    • <python executable> -m jupyter --version
    • <python executable> -m jupyter kernelspec --version

    Details of your OS & Python interpreter:

    • OS - Mac/Linux/Windows
    • Python - Standard install, anaconda, miniconda or other
  8. patrick-nadeau commented on Feb 12, 2020

    @patrick-nadeau

    Don Jayamanne (@DonJayamanne)

    • OS: MacOS Catalina 10.15.3

    • Python: Installed via Enthought EDM into a new EDM environment. VSCode has already been set to find and use EDM environments and was working fine until latest update of vscode-python.

    • python --version:

    Python 2.7.15 -- Enthought, Inc. (x86_64)
    
    • python -m jupyter --version:
    jupyter core     : 4.5.0
    jupyter-notebook : 5.7.8
    qtconsole        : 4.4.0.dev
    ipython          : 5.8.0
    ipykernel        : 4.10.0
    jupyter client   : 5.3.1
    jupyter lab      : not installed
    nbconvert        : 5.5.0
    ipywidgets       : 6.0.0
    nbformat         : 4.4.0
    traitlets        : 4.3.2
    • python -m jupyter kernelspec --version
    Traceback (most recent call last):
      File "/Users/patrick/.edm/envs/skynet/Resources/Python.app/Contents/MacOS/../../../../bin/jupyter-kernelspec", line 8, in <module>
        from jupyter_client.kernelspecapp import main
    ImportError: cannot import name main
  9. Louis-DR commented on Feb 12, 2020

    @Louis-DR
    Author

    Sorry, I've left work so I don't have access to the computer. If still necessary, I'll give you the logs tomorrow morning (CET)

  10. DonJayamanne commented on Feb 12, 2020

    @DonJayamanne
    Contributor

    Patrick Nadeau (@patrick-nadeau) Please could you use a Python 3 interpreter to start Jupyter.

    • Use the command Select Interpreter to start Jupyter server
    • Select a Python 3 interpreter, if prompted please install jupyter or manually install jupyter into a python environment or use conda/miniconda if you have that.
    • You can still use a Python 2 kernel to run your code,

    & thanks for the feedback

  11. patrick-nadeau commented on Feb 12, 2020

    @patrick-nadeau

    Don Jayamanne (@DonJayamanne) : Thanks, that seemed to fix it. Simply launching the interactive window from a Python 3 environment with jupyter installed seems to work. In fact, it seems I can now successfully launch the interactive window from a Python 2 environment, even after reloading VSCode.

  12. 50 remaining items

  13. timmclennan commented on Feb 21, 2020

    @timmclennan
    • Python interpreter displayed string is Python 3.7.6 64-bit ('jupyter': conda)
    • python.pythonPath is "C:\\software\\Anaconda\\envs\\jupyter\\python.exe"
    • The Jupyter server interpreter prompt was empty, selecting other interpreters didn't help.
    • I cleared out the python.condaPath
    • Running a debug script gives a python executable of C:\software\Anaconda\envs\jupyter\python.exe as expected and a path of C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Microsoft SQL Server\90\Tools\binn\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\software\Anaconda\condabin;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git LFS;C:\Program Files (x86)\GitExtensions\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\PuTTY\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Microsoft VS Code\bin;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\Docker\Docker\resources\bin;C:\ProgramData\DockerDesktop\version-bin;C:\Users\tim.mclennan\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\Microsoft VS Code\bin;C:\Users\tim.mclennan\AppData\Local\Programs\MiKTeX 2.9\miktex\bin\x64\;C:\Users\tim.mclennan\AppData\Local\GitHubDesktop\bin;C:\Users\tim.mclennan\AppData\Local\Programs\Fiddler;%USERPROFILE%\AppData\Local\Microsoft\WindowsApps;
    • Manually activating the environment in a CMD based terminal adds C:\software\Anaconda\envs\jupyter;C:\software\Anaconda\envs\jupyter\Library\mingw-w64\bin;C:\software\Anaconda\envs\jupyter\Library\usr\bin;C:\software\Anaconda\envs\jupyter\Library\bin;C:\software\Anaconda\envs\jupyter\Scripts;C:\software\Anaconda\envs\jupyter\bin to the path and the script consequently works.

    Trying to select the jupyter environment as the interpreter for running jupyter generates the same error as before. I've uploaded another log -1582245861149.log
    One thing I noted is that it does seem to fail to find the list of conda environments here

    console.ts:137 [Extension Host] Error Python Extension: 2020-02-21 13:38:19: Failed to get conda environment list from conda [Error: spawn conda ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19)
    at onErrorNT (internal/child_process.js:456:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:9)] {
    errno: 'ENOENT',
    code: 'ENOENT',
    syscall: 'spawn conda',
    path: 'conda',
    spawnargs: [ 'env', 'list' ]
    }

    Although they do show up in the interpreter list.

  14. DonJayamanne commented on Feb 21, 2020

    @DonJayamanne
    Contributor

    Timothy McLennan (@timmclennan)
    Thanks for getting back with the information.

    Please could you update the setting python.condaPath with the fully qualified path to the conda executable. I think you had a invalid path previously. Since its unable to find the conda paths, its unable to properly activate the jupyter conda environment.

  15. timmclennan commented on Feb 21, 2020

    @timmclennan

    Yeah that got it working. I had to experiment with it a bit as it's not particularly clear what the setting should be, especially on Windows where the executable is a batch file.
    Setting it to C:\software\Anaconda\condabin\conda.bat did the trick and everything appears to be working as expected.

  16. rchiodo commented on Feb 25, 2020

    @rchiodo
    Contributor

    Validated by customers

  17. locked as resolved and limited conversation to collaborators on Mar 10, 2020
  18. unlocked this conversation on Nov 13, 2020
  19. Quantium commented on Nov 26, 2020

    @Quantium

    Same issue here.

    I just selected an environment in the VSCode footer to fix it.

    pic 2020-11-26 at 9 27 15

  20. locked as resolved and limited conversation to collaborators on May 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions