DonJayamanne / vscode-default-python-kernel

Default Python Kernels for Jupyter Notebooks
MIT License
1 stars 0 forks source link

Doesn't work - no effect #4

Open mcaay opened 6 months ago

mcaay commented 6 months ago

I have the newest version of vs code, jupyter extension (although not Pre-Release) and I just installed your plugin. VS Code still asks me every time which kernel to pick. I used settings.json to hide all the other kernels. I pressed cmd+shift+P to use command Python: Select interpreter and selected the desired one. Still every time I open a jupyter notebook and want to run the code it prompts me to select kernel.

image

Did I still not do something that is necessary?

DonJayamanne commented 6 months ago

Please could you enable logging as follows:

mcaay commented 6 months ago

Hey, below is the jupyter output. What I did:

  1. opened an .ipynb file that uses some API
  2. tried to run the first cell with Shift + Enter
  3. the select kernel popup appeared, but I didn't click anything
Visual Studio Code (1.87.1, undefined, desktop)
Jupyter Extension Version: 2024.2.0.
Python Extension Version: 2024.2.1.
Pylance Extension Version: 2024.2.3.
Platform: darwin (arm64).
No workspace folder opened.
14:10:56.342 [debug] Get Custom Env Variables, Class name = Rm (started execution), Arg 1: undefined, Arg 2: "RunPythonCode"
14:10:56.342 [info] Start refreshing Kernel Picker (1710076256342)
14:10:56.355 [info] Using Pylance
14:10:56.358 [debug] Get Custom Env Variables, Class name = Rm, completed in 16ms, has a truthy return value, Arg 1: undefined, Arg 2: "RunPythonCode"
14:10:56.358 [debug] Jupyter Paths /kernels: 
14:10:56.359 [debug] Kernel Spec Root Paths, /usr/share/jupyter/kernels, /usr/local/share/jupyter/kernels, ~/Library/Jupyter/kernels
14:10:56.398 [debug] No controller, hence notebook communications cannot be initialized for editor ~/Documents/My_Documents/BETIS/_INFOLINIA/_Thulium/agenci - status.ipynb
14:10:56.398 [info] Start refreshing Interpreter Kernel Picker
14:10:56.473 [debug] Python Env hidden via filter: /usr/bin/python3
14:10:56.473 [debug] Python Env hidden via filter: /opt/homebrew/bin/python3
14:10:56.473 [debug] Python Env hidden via filter: /opt/homebrew/bin/python3.11
14:10:56.473 [debug] Python Env hidden via filter: /opt/homebrew/bin/python3.9
14:10:56.473 [debug] Python Env hidden via filter: /opt/homebrew/bin/python3.12
14:10:56.484 [debug] Search for KernelSpecs in Interpreter ~/.pyenv/versions/3.6.15/bin/python
14:10:56.485 [debug] Finding Global Python KernelSpecs
14:10:56.486 [debug] Search for KernelSpecs in Interpreter ~/.pyenv/versions/3.7.13/bin/python
14:10:56.488 [debug] Search for KernelSpecs in Interpreter ~/.pyenv/versions/3.9.5/bin/python
14:10:56.489 [debug] Search for KernelSpecs in Interpreter ~/.pyenv/versions/3.6.15/envs/FRESHvenv/bin/python
14:10:56.492 [debug] Search for KernelSpecs in Interpreter ~/.pyenv/versions/3.6.15/envs/betis/bin/python
14:10:56.494 [debug] Search for KernelSpecs in Interpreter /usr/bin/python3
14:10:56.497 [debug] Search for KernelSpecs in Interpreter /opt/homebrew/bin/python3
14:10:56.500 [debug] Search for KernelSpecs in Interpreter /opt/homebrew/bin/python3.11
14:10:56.505 [debug] Search for KernelSpecs in Interpreter /opt/homebrew/bin/python3.9
14:10:56.511 [debug] Search for KernelSpecs in Interpreter /opt/homebrew/bin/python3.12
14:10:56.518 [debug] Full interpreter list is length: 10, ~/.pyenv/versions/3.6.15/bin/python::Pyenv:~/.pyenv/versions/3.6.15/bin/python, ~/.pyenv/versions/3.7.13/bin/python::Pyenv:~/.pyenv/versions/3.7.13/bin/python, ~/.pyenv/versions/3.9.5/bin/python::Pyenv:~/.pyenv/versions/3.9.5/bin/python, ~/.pyenv/versions/3.6.15/envs/FRESHvenv/bin/python:FRESHvenv:Pyenv:~/.pyenv/versions/3.6.15/envs/FRESHvenv/bin/python, ~/.pyenv/versions/3.6.15/envs/betis/bin/python:betis:Pyenv:~/.pyenv/versions/3.6.15/envs/betis/bin/python, /usr/bin/python3::Unknown:/usr/bin/python3, /opt/homebrew/bin/python3::Unknown:/opt/homebrew/bin/python3, /opt/homebrew/bin/python3.11::Unknown:/opt/homebrew/bin/python3.11, /opt/homebrew/bin/python3.9::Unknown:/opt/homebrew/bin/python3.9, /opt/homebrew/bin/python3.12::Unknown:/opt/homebrew/bin/python3.12
14:10:56.520 [debug] Getting activated env variables, Class name = yp (started execution), Arg 1: undefined, Arg 2: "~/.pyenv/versions/3.9.5/bin/python", Arg 3: undefined
14:10:56.520 [debug] Get Custom Env Variables, Class name = Rm (started execution), Arg 1: undefined, Arg 2: "RunPythonCode"
14:10:56.520 [debug] Get Custom Env Variables, Class name = Rm, completed in 0ms, has a truthy return value, Arg 1: undefined, Arg 2: "RunPythonCode"
14:10:56.700 [debug] Kernels for interpreter ~/.pyenv/versions/3.6.15/bin/python are .jvsc74a57bd07e5f5f314bd0a3d9bcba796bca529838a9e4910404a0011b83e547e80f98a9af.~/.pyenv/versions/3.6.15/python.~/.pyenv/versions/3.6.15/python.-m#ipykernel_launcher
14:10:56.700 [debug] Kernels for interpreter ~/.pyenv/versions/3.7.13/bin/python are .jvsc74a57bd0981e5646365e84f7096b6ff5dab71fa4fb69982e960cbd87982098207d537e04.~/.pyenv/versions/3.7.13/python.~/.pyenv/versions/3.7.13/python.-m#ipykernel_launcher
14:10:56.702 [debug] Kernels for interpreter ~/.pyenv/versions/3.6.15/envs/FRESHvenv/bin/python are .jvsc74a57bd00b0ec5c06dbee62d46276a0f98bcd81f96c580bb0e8439dc70a4da14a299b86b.~/.pyenv/versions/3.6.15/envs/FRESHvenv/python.~/.pyenv/versions/3.6.15/envs/FRESHvenv/python.-m#ipykernel_launcher
14:10:56.702 [debug] Kernels for interpreter ~/.pyenv/versions/3.6.15/envs/betis/bin/python are .jvsc74a57bd0253d3f7105f9d8ccb4eff3bf59fff38225bde2ab69b49065691157d58e2786a5.~/.pyenv/versions/3.6.15/envs/betis/python.~/.pyenv/versions/3.6.15/envs/betis/python.-m#ipykernel_launcher
14:10:56.703 [debug] Kernels for interpreter /usr/bin/python3 are .jvsc74a57bd031f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6./usr/bin/python3./usr/bin/python3.-m#ipykernel_launcher
14:10:56.703 [debug] Kernels for interpreter /opt/homebrew/bin/python3 are .jvsc74a57bd0b0fa6594d8f4cbf19f97940f81e996739fb7646882a419484c72d19e05852a7e./opt/homebrew/bin/python3./opt/homebrew/bin/python3.-m#ipykernel_launcher
14:10:56.704 [debug] Kernels for interpreter /opt/homebrew/bin/python3.11 are .jvsc74a57bd05c7b89af1651d0b8571dde13640ecdccf7d5a6204171d6ab33e7c296e100e08a./opt/homebrew/bin/python3.11./opt/homebrew/bin/python3.11.-m#ipykernel_launcher
14:10:56.705 [debug] Kernels for interpreter /opt/homebrew/bin/python3.9 are .jvsc74a57bd0a665b5d41d17b532ea9890333293a1b812fa0b73c9c25c950b3cedf1bebd0438./opt/homebrew/bin/python3.9./opt/homebrew/bin/python3.9.-m#ipykernel_launcher
14:10:56.706 [debug] Kernels for interpreter /opt/homebrew/bin/python3.12 are .jvsc74a57bd07500c3e1c7c786e4ba1e4b4eb7588219b4e35d5153674f92eb3a82672b534f6e./opt/homebrew/bin/python3.12./opt/homebrew/bin/python3.12.-m#ipykernel_launcher
14:10:56.763 [debug] Loading kernelspec from ~/.pyenv/versions/3.9.5/share/jupyter/kernels/python3/kernel.json for ~/.pyenv/versions/3.9.5/bin/python
14:10:56.946 [debug] Conda file returned by Python Extension is conda
14:10:56.985 [debug] Hiding default kernel spec 'Python 3', 'python395jvsc74a57bd0246d2d26a1d4bfe82f65ff254994a82449abdb5a1e288f704c3566d822652645', /python for interpreter ~/.pyenv/versions/3.9.5/bin/python and spec ~/.pyenv/versions/3.9.5/share/jupyter/kernels/python3/kernel.json
14:10:56.985 [debug] Kernels for interpreter ~/.pyenv/versions/3.9.5/bin/python are .jvsc74a57bd0246d2d26a1d4bfe82f65ff254994a82449abdb5a1e288f704c3566d822652645.~/.pyenv/versions/3.9.5/python.~/.pyenv/versions/3.9.5/python.-m#ipykernel_launcher
14:10:56.996 [debug] Got env vars with python ~/.pyenv/versions/3.9.5/bin/python, with env var count 62 in 476ms. 
    PATH value is ~/.pyenv/versions/3.9.5/bin:~/.nvm/versions/node/v20.2.0/bin:/opt/homebrew/opt/openssl@1.1/bin:~/.pyenv/shims:~/.pyenv/bin:/opt/homebrew/sbin:/opt/homebrew/bin:/opt/homebrew/Cellar/pyenv-virtualenv/1.2.1/shims:/opt/homebrew/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/TeX/texbin and 
    Path value is undefined
14:10:56.996 [debug] Prepend PATH with python bin for ~/.pyenv/versions/3.9.5/bin/python
14:10:56.996 [debug] Activated Env Variables for ~/.pyenv/versions/3.9.5/bin/python, 
    PATH value is ~/.pyenv/versions/3.9.5/bin:~/.nvm/versions/node/v20.2.0/bin:/opt/homebrew/opt/openssl@1.1/bin:~/.pyenv/shims:~/.pyenv/bin:/opt/homebrew/sbin:/opt/homebrew/bin:/opt/homebrew/Cellar/pyenv-virtualenv/1.2.1/shims:/opt/homebrew/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/TeX/texbin and 
    Path value is undefined
14:10:56.996 [debug] Getting activated env variables, Class name = yp, completed in 476ms, has a truthy return value, Arg 1: undefined, Arg 2: "~/.pyenv/versions/3.9.5/bin/python", Arg 3: undefined
14:10:56.997 [info] Process Execution: ~/.pyenv/versions/3.9.5/bin/python -m pip list
14:10:57.250 [debug] Full interpreter list is length: 10, ~/.pyenv/versions/3.6.15/bin/python::Pyenv:~/.pyenv/versions/3.6.15/bin/python, ~/.pyenv/versions/3.7.13/bin/python::Pyenv:~/.pyenv/versions/3.7.13/bin/python, ~/.pyenv/versions/3.9.5/bin/python::Pyenv:~/.pyenv/versions/3.9.5/bin/python, ~/.pyenv/versions/3.6.15/envs/FRESHvenv/bin/python:FRESHvenv:Pyenv:~/.pyenv/versions/3.6.15/envs/FRESHvenv/bin/python, ~/.pyenv/versions/3.6.15/envs/betis/bin/python:betis:Pyenv:~/.pyenv/versions/3.6.15/envs/betis/bin/python, /usr/bin/python3::Unknown:/usr/bin/python3, /opt/homebrew/bin/python3::Unknown:/opt/homebrew/bin/python3, /opt/homebrew/bin/python3.11::Unknown:/opt/homebrew/bin/python3.11, /opt/homebrew/bin/python3.9::Unknown:/opt/homebrew/bin/python3.9, /opt/homebrew/bin/python3.12::Unknown:/opt/homebrew/bin/python3.12
14:10:57.250 [debug] Refreshed Environments
14:10:57.865 [info] No interpreter for Pylance for Notebook URI "~/Documents/My_Documents/BETIS/_INFOLINIA/_Thulium/agenci - status.ipynb"
14:10:58.257 [info] End refreshing Kernel Picker (1710076256342)
Woodthorne commented 5 months ago

I also have this issue with the extension, though it does seem to work on occasion: If I select the appropriate interpreter for python and then create a new notebook it works, but if I then close down the workspace and start it up again the notebook loses the kernel and goes to the default one instead, with no means of switching back to the one I want.

karlglazebrook commented 5 months ago

I am finding this too, it seems to work inconsistently. Note I am just opening .ipynb files from the MacOS finder, not doing anything with 'workspaces'

DonJayamanne commented 4 months ago

I'm sorry for not getting back to you on this,

Please can you try the following

vscode-default-python-kernel-0.0.2.vsix.zip

karlglazebrook commented 1 month ago

2024-07-28 18:04:01.852 [info] Extension loaded 0.0.2 2024-07-28 18:04:01.852 [info] Not changing kernel for /Users/karl/Untitled10.ipynb because we have changed it before

Noting this particular notebook comes up with 'Select kernel' so it has no default.

Some kind of cacheing issue from testing? I created a fresh notebook file and now the extension seems to work as expected.

mjbaldwin commented 1 day ago

This extension is also not working for me.

I have a notebook that I repeatedly duplicate and use the new version, and every time I open the new one, no kernel is selected.

My default Python interpreter is always correctly selected.