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

Unable to enter the python executable path in kernel picker under Select a Python Environment #15086

Closed
Allan-xmos opened this issue Jan 23, 2024 · 7 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster notebook-kernel-picker

Comments

@Allan-xmos
Copy link

Type: Bug

Can't enter a pre-existing venv other than the 2 suggested, entering path to venv in "Select a Python Environment" doesn't work, hitting enter does nothing.

VS Code version: Code 1.85.2 (8b3775030ed1a69b13e4f4c628c612102e30a681, 2024-01-18T06:40:10.514Z)
OS version: Windows_NT x64 10.0.19045
Modes:

@DonJayamanne DonJayamanne transferred this issue from microsoft/vscode Jan 28, 2024
@DonJayamanne
Copy link
Contributor

Thanks for filing this issue, unfortunately entering a path in the kernel picker does not work.
I would suggest you first pick that environment via the Python interpreter picker first (use the command Python: Select Interpreter)
It should then appear as a kernel.
If it still does not, please let me know

@DonJayamanne DonJayamanne added bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster notebook-kernel-picker labels Jan 28, 2024
@DonJayamanne DonJayamanne changed the title ipynb venv doesn't work Unable to enter the python executable path in kernel picker under Select a Python Environment Jan 28, 2024
@Allan-xmos
Copy link
Author

Hi, I already had picked my venv via the python interpreter picker. Some of my venvs in other folders come up in the kernel picker, but not the one I'm trying to use.

For reference, the relative paths (from my workspace folder Documents/my_project/my_lib) are something like:

venv I want: ../other_lib/.venv
venv I'm offered: ../../other_project/venv

I notice that both the venvs I'm offered in the kernel picker are in foldered named venv, whereas the one I'm trying to use is in a folder named .venv. I'm not sure if this is related.

@DonJayamanne
Copy link
Contributor

Please could you enable logging as follows:

  • Open settings & go into Jupyter->Logging
  • Change the value to verbose
  • Reload VS Code,
  • Attempt to repro the issue & then copy the output from the Jupyter output panel.

Please do share all of the logs.

@vscodenpa
Copy link

This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.

Happy Coding!

@vscodenpa vscodenpa closed this as not planned Won't fix, can't repro, duplicate, stale Feb 6, 2024
@Allan-xmos
Copy link
Author

Please see below for the debug output. The kernel picker seems to be trying to pick up a deleted folder in my onedrive, which might be causing issues? I never see the current_project\lib\.venv in the kernel picker.

Visual Studio Code (1.86.1, undefined, desktop)
Jupyter Extension Version: 2024.1.1.
Python Extension Version: 2024.0.1.
Pylance Extension Version: 2024.2.1.
Platform: win32 (x64).
Workspace folder ~\Documents\current_project\sw, Home = c:\Users\allan
10:03:22.304 [info] Telemetry level is off
10:03:22.304 [info] Experiments are disabled, only manually opted experiments are active.
10:03:22.304 [info] User belongs to experiment group 'KernelCompletions'
10:03:22.304 [info] User belongs to experiment group 'DoNotWaitForZmqPortsToBeUsed'
10:03:22.831 [debug] Get Custom Env Variables, Class name = Tm (started execution), Arg 1: undefined, Arg 2: "RunPythonCode"
10:03:22.834 [info] Start refreshing Kernel Picker (1707836602834)
10:03:22.878 [info] Using Pylance
10:03:22.930 [debug] Get Custom Env Variables, Class name = Tm, completed in 100ms, has a truthy return value, Arg 1: undefined, Arg 2: "RunPythonCode"
10:03:22.931 [debug] Jupyter Paths kernels: 
10:03:22.935 [debug] Search for KernelSpecs in Interpreter ~\Documents\current_project\lib\.venv\Scripts\python.exe
10:03:22.937 [debug] Finding Global Python KernelSpecs
10:03:22.938 [debug] Kernel Spec Root Paths, ~\AppData\Roaming\jupyter\kernels, c:\ProgramData\jupyter\kernels
10:03:22.946 [debug] Getting activated env variables, Class name = mp (started execution), Arg 1: "/c:/Users/<username>/Documents/current_project/sw", Arg 2: "~\\DOCUMENTS\\CURRENT_PROJECT\\LIB\\.VENV\\SCRIPTS\\PYTHON.EXE", Arg 3: undefined
10:03:22.947 [debug] Get Custom Env Variables, Class name = Tm (started execution), Arg 1: "/c:/Users/<username>/Documents/current_project/sw", Arg 2: "RunPythonCode"
10:03:22.948 [debug] Get Custom Env Variables, Class name = Tm, completed in 1ms, has a truthy return value, Arg 1: "/c:/Users/<username>/Documents/current_project/sw", Arg 2: "RunPythonCode"
10:03:23.141 [debug] Search for KernelSpecs in Interpreter ~\AppData\Local\Programs\Python\Python37\python.exe
10:03:23.143 [debug] Search for KernelSpecs in Interpreter ~\AppData\Local\Programs\Python\Python39\python.exe
10:03:23.146 [debug] Search for KernelSpecs in Interpreter ~\Documents\old_project_1\venv\Scripts\python.exe
10:03:23.147 [debug] Search for KernelSpecs in Interpreter ~\AppData\Local\Programs\Python\Python310\python.exe
10:03:23.149 [debug] Search for KernelSpecs in Interpreter ~\Documents\old_project_2\venv\Scripts\python.exe
10:03:23.152 [debug] Full interpreter list is length: 5, ~\APPDATA\LOCAL\PROGRAMS\PYTHON\PYTHON37\PYTHON.EXE::Unknown:~\AppData\Local\Programs\Python\Python37\python.exe, ~\APPDATA\LOCAL\PROGRAMS\PYTHON\PYTHON39\PYTHON.EXE::Unknown:~\AppData\Local\Programs\Python\Python39\python.exe, ~\DOCUMENTS\OLD_PROJECT_1\VENV\SCRIPTS\PYTHON.EXE:venv:Venv:~\Documents\old_project_1\venv\Scripts\python.exe, ~\APPDATA\LOCAL\PROGRAMS\PYTHON\PYTHON310\PYTHON.EXE::Unknown:~\AppData\Local\Programs\Python\Python310\python.exe, ~\DOCUMENTS\OLD_PROJECT_2\VENV\SCRIPTS\PYTHON.EXE:venv:Venv:~\Documents\old_project_2\venv\Scripts\python.exe
10:03:24.879 [debug] Kernels for interpreter ~\APPDATA\LOCAL\PROGRAMS\PYTHON\PYTHON39\PYTHON.EXE are .jvsc74a57bd050cbb6ba69438cf8b1a80e9a6ba845fab536b4ac46547b12f8af63038c128207.~\AppData\Local\Programs\Python\Python39\python.exe.~\AppData\Local\Programs\Python\Python39\python.exe.-m#ipykernel_launcher
10:03:24.880 [debug] Kernels for interpreter ~\DOCUMENTS\OLD_PROJECT_1\VENV\SCRIPTS\PYTHON.EXE are .jvsc74a57bd0f6775acb1c5516f994b9bc33f16b37817fd63ad33f095907a3cf71e3b348d525.~\Documents\old_project_1\venv\Scripts\python.exe.~\Documents\old_project_1\venv\Scripts\python.exe.-m#ipykernel_launcher
10:03:24.880 [debug] Kernels for interpreter ~\APPDATA\LOCAL\PROGRAMS\PYTHON\PYTHON310\PYTHON.EXE are .jvsc74a57bd00895706b445743b41442891cc068d165c25803aac570eea9a5131c0a181def5c.~\AppData\Local\Programs\Python\Python310\python.exe.~\AppData\Local\Programs\Python\Python310\python.exe.-m#ipykernel_launcher
10:03:25.069 [debug] Kernels for interpreter ~\APPDATA\LOCAL\PROGRAMS\PYTHON\PYTHON37\PYTHON.EXE are .jvsc74a57bd05ee7cfa7c74f92f331584abcedd16ac04dee39fb2c55aa626fff5440d28a0c9d.~\AppData\Local\Programs\Python\Python37\python.exe.~\AppData\Local\Programs\Python\Python37\python.exe.-m#ipykernel_launcher
10:03:25.308 [debug] Loading kernelspec from ~\Documents\current_project\lib\.venv\share\jupyter\kernels\python3\kernel.json for ~\Documents\current_project\lib\.venv\Scripts\python.exe
10:03:25.395 [debug] Loading kernelspec from ~\Documents\old_project_2\venv\share\jupyter\kernels\python3\kernel.json for ~\Documents\old_project_2\venv\Scripts\python.exe
10:03:25.771 [debug] Hiding default kernel spec 'Python 3 (ipykernel)', 'pythonjvsc74a57bd01c935cc7ddcdbd57befa447952fbee83dc4dce25384bf41dd990915b960af541', python for interpreter ~\Documents\current_project\lib\.venv\Scripts\python.exe and spec ~\Documents\current_project\lib\.venv\share\jupyter\kernels\python3\kernel.json
10:03:25.773 [debug] Kernels for interpreter ~\DOCUMENTS\CURRENT_PROJECT\LIB\.VENV\SCRIPTS\PYTHON.EXE are .jvsc74a57bd01c935cc7ddcdbd57befa447952fbee83dc4dce25384bf41dd990915b960af541.~\Documents\current_project\lib\.venv\Scripts\python.exe.~\Documents\current_project\lib\.venv\Scripts\python.exe.-m#ipykernel_launcher
10:03:25.841 [debug] Hiding default kernel spec 'Python 3 (ipykernel)', 'pythonjvsc74a57bd0504c89be4e5742af3078857b5ace78d343c24712f3e866e190316f5eea406c40', python for interpreter ~\Documents\old_project_2\venv\Scripts\python.exe and spec ~\Documents\old_project_2\venv\share\jupyter\kernels\python3\kernel.json
10:03:25.843 [debug] Kernels for interpreter ~\DOCUMENTS\OLD_PROJECT_2\VENV\SCRIPTS\PYTHON.EXE are .jvsc74a57bd0504c89be4e5742af3078857b5ace78d343c24712f3e866e190316f5eea406c40.~\Documents\old_project_2\venv\Scripts\python.exe.~\Documents\old_project_2\venv\Scripts\python.exe.-m#ipykernel_launcher
10:03:25.843 [info] End refreshing Kernel Picker (1707836602834)
10:03:26.529 [debug] Got env vars with python ~\Documents\current_project\lib\.venv\Scripts\python.exe, with env var count 72 in 3582ms. 
    PATH value is ~\Documents\current_project\lib\.venv\Scripts;C:\ffmpeg\bin;C:\windows\system32;C:\Program Files\Graphviz\bin;C:\windows\system32;C:\windows;C:\windows\System32\WindowsPowerShell\v1.0\;C:\windows\System32\OpenSSH\;C:\windows\System32\Wbem;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Program Files\Git\cmd;~\.local\.bin;~\AppData\Local\Programs\Python\Python39\Scripts\;~\AppData\Local\Programs\Python\Python39\;~\.dnx\bin;~\AppData\Local\Programs\Python\Python37\Scripts\;~\AppData\Local\Programs\Python\Python37\;~\AppData\Local\Microsoft\WindowsApps;~\AppData\Local\Programs\Microsoft VS Code\bin;~\AppData\Roaming\Python\Python37\Scripts;C:\bazel.exe;C:\Program Files\Java\jdk-11.0.16.1;C:\Program Files (x86)\sox-14-4-2;C:\ninja-win;C:\Windows\System32; and 
    Path value is undefined
10:03:26.529 [debug] Prepend PATH with python bin for ~\Documents\current_project\lib\.venv\Scripts\python.exe
10:03:26.530 [debug] Activated Env Variables for ~\Documents\current_project\lib\.venv\Scripts\python.exe, 
    PATH value is ~\Documents\current_project\lib\.venv\Scripts;~\Documents\current_project\lib\.venv\Scripts;C:\ffmpeg\bin;C:\windows\system32;C:\Program Files\Graphviz\bin;C:\windows\system32;C:\windows;C:\windows\System32\WindowsPowerShell\v1.0\;C:\windows\System32\OpenSSH\;C:\windows\System32\Wbem;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Program Files\Git\cmd;~\.local\.bin;~\AppData\Local\Programs\Python\Python39\Scripts\;~\AppData\Local\Programs\Python\Python39\;~\.dnx\bin;~\AppData\Local\Programs\Python\Python37\Scripts\;~\AppData\Local\Programs\Python\Python37\;~\AppData\Local\Microsoft\WindowsApps;~\AppData\Local\Programs\Microsoft VS Code\bin;~\AppData\Roaming\Python\Python37\Scripts;C:\bazel.exe;C:\Program Files\Java\jdk-11.0.16.1;C:\Program Files (x86)\sox-14-4-2;C:\ninja-win;C:\Windows\System32; and 
    Path value is undefined
10:03:26.531 [debug] Getting activated env variables, Class name = mp, completed in 3585ms, has a truthy return value, Arg 1: "/c:/Users/<username>/Documents/current_project/sw", Arg 2: "~\\DOCUMENTS\\ CURRENT_PROJECT\\LIB\\.VENV\\SCRIPTS\\PYTHON.EXE", Arg 3: undefined
10:03:26.554 [info] Process Execution: ~\Documents\current_project\lib\.venv\Scripts\python.exe -m pip list
10:03:28.589 [info] No interpreter for Pylance for Notebook URI "~\Documents\current_project\sw\app_dsp_xk_evk_xu316\dsp_design.ipynb"
10:03:30.380 [debug] Python API env change detected, add => '~\OneDrive\some_deleted_folder\VENV\SCRIPTS\PYTHON.EXE'
10:03:30.381 [info] Start refreshing Kernel Picker (1707836610381)
10:03:31.208 [debug] Conda file returned by Python Extension is conda
10:03:33.051 [debug] Controller startUsingPythonInterpreter:'.jvsc74a57bd008c6674fefba1103098593c5946f82847204cf1a3479ae7958af98a260024963.~\OneDrive\some_deleted_folder\venv\Scripts\python.exe.~\OneDrive\some_deleted_folder\venv\Scripts\python.exe.-m#ipykernel_launcher' for view = 'jupyter-notebook' is no longer a valid
10:03:33.051 [debug] Controller startUsingPythonInterpreter:'.jvsc74a57bd008c6674fefba1103098593c5946f82847204cf1a3479ae7958af98a260024963.~\OneDrive\some_deleted_folder\venv\Scripts\python.exe.~\OneDrive\some_deleted_folder\venv\Scripts\python.exe.-m#ipykernel_launcher (Interactive)' for view = 'interactive' is no longer a valid
10:03:33.051 [warn] Disposing old controller startUsingPythonInterpreter:'.jvsc74a57bd008c6674fefba1103098593c5946f82847204cf1a3479ae7958af98a260024963.~\OneDrive\some_deleted_folder\venv\Scripts\python.exe.~\OneDrive\some_deleted_folder\venv\Scripts\python.exe.-m#ipykernel_launcher' for view = 'jupyter-notebook'
10:03:33.051 [debug] Disposing controller .jvsc74a57bd008c6674fefba1103098593c5946f82847204cf1a3479ae7958af98a260024963.~\OneDrive\some_deleted_folder\venv\Scripts\python.exe.~\OneDrive\some_deleted_folder\venv\Scripts\python.exe.-m#ipykernel_launcher associated with connection .jvsc74a57bd008c6674fefba1103098593c5946f82847204cf1a3479ae7958af98a260024963.~\OneDrive\some_deleted_folder\venv\Scripts\python.exe.~\OneDrive\some_deleted_folder\venv\Scripts\python.exe.-m#ipykernel_launcher 
10:03:33.052 [warn] Disposing old controller startUsingPythonInterpreter:'.jvsc74a57bd008c6674fefba1103098593c5946f82847204cf1a3479ae7958af98a260024963.~\OneDrive\some_deleted_folder\venv\Scripts\python.exe.~\OneDrive\some_deleted_folder\venv\Scripts\python.exe.-m#ipykernel_launcher (Interactive)' for view = 'interactive'
10:03:33.052 [debug] Disposing controller .jvsc74a57bd008c6674fefba1103098593c5946f82847204cf1a3479ae7958af98a260024963.~\OneDrive\some_deleted_folder\venv\Scripts\python.exe.~\OneDrive\some_deleted_folder\venv\Scripts\python.exe.-m#ipykernel_launcher (Interactive) associated with connection .jvsc74a57bd008c6674fefba1103098593c5946f82847204cf1a3479ae7958af98a260024963.~\OneDrive\some_deleted_folder\venv\Scripts\python.exe.~\OneDrive\some_deleted_folder\venv\Scripts\python.exe.-m#ipykernel_launcher 
10:03:33.054 [debug] Python API env change detected, remove => '~\OneDrive\some_deleted_folder\VENV\SCRIPTS\PYTHON.EXE'
10:03:33.070 [error] Failed to get env details from Python API for ~\OneDrive\some_deleted_folder\VENV\SCRIPTS\PYTHON.EXE without an error
10:03:33.074 [debug] Full interpreter list is length: 5, ~\APPDATA\LOCAL\PROGRAMS\PYTHON\PYTHON37\PYTHON.EXE::Unknown:~\AppData\Local\Programs\Python\Python37\python.exe, ~\APPDATA\LOCAL\PROGRAMS\PYTHON\PYTHON39\PYTHON.EXE::Unknown:~\AppData\Local\Programs\Python\Python39\python.exe, ~\DOCUMENTS\OLD_PROJECT_1\VENV\SCRIPTS\PYTHON.EXE:venv:Venv:~\Documents\old_project_1\venv\Scripts\python.exe, ~\APPDATA\LOCAL\PROGRAMS\PYTHON\PYTHON310\PYTHON.EXE::Unknown:~\AppData\Local\Programs\Python\Python310\python.exe, ~\DOCUMENTS\OLD_PROJECT_2\VENV\SCRIPTS\PYTHON.EXE:venv:Venv:~\Documents\old_project_2\venv\Scripts\python.exe
10:03:33.077 [debug] Interpreter removed ~\OneDrive\some_deleted_folder\VENV\SCRIPTS\PYTHON.EXE
10:03:33.234 [debug] Python API env change detected, add => '~\OneDrive\some_deleted_folder\VENV\SCRIPTS\PYTHON.EXE'
10:03:33.272 [debug] Python API env change detected, remove => '~\OneDrive\some_deleted_folder\VENV\SCRIPTS\PYTHON.EXE'
10:03:33.298 [debug] Full interpreter list is length: 5, ~\APPDATA\LOCAL\PROGRAMS\PYTHON\PYTHON37\PYTHON.EXE::Unknown:~\AppData\Local\Programs\Python\Python37\python.exe, ~\APPDATA\LOCAL\PROGRAMS\PYTHON\PYTHON39\PYTHON.EXE::Unknown:~\AppData\Local\Programs\Python\Python39\python.exe, ~\DOCUMENTS\OLD_PROJECT_1\VENV\SCRIPTS\PYTHON.EXE:venv:Venv:~\Documents\old_project_1\venv\Scripts\python.exe, ~\APPDATA\LOCAL\PROGRAMS\PYTHON\PYTHON310\PYTHON.EXE::Unknown:~\AppData\Local\Programs\Python\Python310\python.exe, ~\DOCUMENTS\OLD_PROJECT_2\VENV\SCRIPTS\PYTHON.EXE:venv:Venv:~\Documents\old_project_2\venv\Scripts\python.exe
10:03:33.299 [debug] Interpreter removed ~\OneDrive\some_deleted_folder\VENV\SCRIPTS\PYTHON.EXE
10:03:33.449 [error] Failed to get env details from Python API for ~\OneDrive\some_deleted_folder\VENV\SCRIPTS\PYTHON.EXE without an error
10:03:34.462 [info] End refreshing Kernel Picker (1707836610381)
10:03:59.877 [debug] creating new code watcher with matching document file:///c%3A/Users/<username>/Documents/current_project/sw/app_dsp_xk_evk_xu316/build_utils.py

@Allan-xmos
Copy link
Author

I managed to get a workaround for now by changing the Python default interpreter path in settings, this then comes up in the kernel picker

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 30, 2024
@DonJayamanne
Copy link
Contributor

Duplicate of #15087

@DonJayamanne DonJayamanne marked this as a duplicate of #15087 Jul 22, 2024
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 info-needed Issue requires more information from poster notebook-kernel-picker
Projects
None yet
Development

No branches or pull requests

4 participants