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

jupyter.notebookFileRoot not working with ${fileWorkspaceFolder} #16258

Open
1 of 2 tasks
stertingen opened this issue Nov 29, 2024 · 0 comments
Open
1 of 2 tasks

jupyter.notebookFileRoot not working with ${fileWorkspaceFolder} #16258

stertingen opened this issue Nov 29, 2024 · 0 comments
Assignees
Labels
debt Code quality issues notebook-execution Kernels issues (start/restart/switch/execution, install ipykernel)

Comments

@stertingen
Copy link

Applies To

  • Notebooks (.ipynb files)
  • Interactive Window and/or Cell Scripts (.py files with #%% markers)

What happened?

Setting the jupyter.notebookFileRoot setting to "${fileWorkspaceFolder}" does not work, but "${workspaceFolder}" does.

Steps to reproduce: Create a script in a workspace's subdirectory with the following content:

#!/usr/bin/env python3
# %%
%pwd

And run the snippet interactively.
The script is run in its subdirectory instead of the workspace root.

VS Code Version

Version: 1.95.3 (system setup) Commit: f1a4fb101478ce6ec82fe9627c43efbf9e98c813 Date: 2024-11-13T14:50:04.152Z Electron: 32.2.1 ElectronBuildId: 10427718 Chromium: 128.0.6613.186 Node.js: 20.18.0 V8: 12.8.374.38-electron.0 OS: Windows_NT x64 10.0.26100

Jupyter Extension Version

v2024.11.2024102401 (pre-release)

Jupyter logs

Visual Studio Code (1.95.3, undefined, desktop)
Jupyter Extension Version: 2024.10.0.
Python Extension Version: 2024.20.0.
Pylance Extension Version: 2024.11.3.
Platform: win32 (x64).
Temp Storage folder ~\AppData\Roaming\Code\User\globalStorage\ms-toolsai.jupyter\version-2024.10.0
Workspace folder ~\Git\PyFleetSim, Home = c:\Users\kleist
13:47:20.052 [info] Telemetry level is off
13:47:20.052 [info] Experiments are disabled, only manually opted experiments are active.
13:47:20.170 [debug] Start refreshing Kernel Picker (1732884440170)
13:47:20.224 [info] Deleting old temp dir c:\Users\~\AppData\Roaming\Code\User\globalStorage\ms-toolsai.jupyter\version-2024.11.2024102401
13:47:20.446 [debug] Get Custom Env Variables, Class name = Em, completed in 277ms, has a truthy return value, Arg 1: undefined, Arg 2: "RunPythonCode"
13:47:20.447 [debug] Jupyter Paths kernels: 
13:47:20.447 [debug] Kernel Spec Root Paths, home\~\.local\share\jupyter\kernels, c:\ProgramData\jupyter\kernels
13:47:20.454 [debug] creating new code watcher with matching document file:///c%3A/Users/~/Git/PyFleetSim/scripts/sample.py
13:47:20.455 [debug] CodeLensFactory: Generating new code lenses for version 4 of document file:///c%3A/Users/~/Git/PyFleetSim/scripts/sample.py for commands jupyter.runcell, jupyter.runallcellsabove, jupyter.debugcell, jupyter.debugcontinue, jupyter.debugstop, jupyter.debugstepover
13:47:20.970 [debug] Controller selection change completed
13:47:21.317 [debug] Get Custom Env Variables, Class name = Em, completed in 1ms, has a truthy return value, Arg 1: "/c:/Users/~/Git/PyFleetSim", Arg 2: "RunPythonCode"
13:47:21.365 [debug] End refreshing Kernel Picker (1732884440170)
13:47:22.250 [debug] Got env vars from Python Ext in 934ms for ~\Git\PyFleetSim\venv\Scripts\python.exe, with env var count 76.
13:47:22.251 [debug] Getting activated env variables, Class name = Id, completed in 935ms, has a truthy return value, Arg 1: "/c:/Users/~/Git/PyFleetSim", Arg 2: "~\\GIT\\PYFLEETSIM\\VENV\\SCRIPTS\\PYTHON.EXE", Arg 3: undefined
13:47:22.267 [info] Process Execution: ~\Git\PyFleetSim\venv\Scripts\python.exe -m pip list
13:47:22.862 [debug] Interpreter for Pylance for Notebook URI "Interactive-1.interactive" is ~\Git\PyFleetSim\venv\Scripts\python.exe
13:47:35.513 [debug] CodeWatcher::runCell, Class name = qt (started execution)
13:47:35.516 [debug] start the kernel, options.disableUI=false for Interactive-1.interactive
13:47:35.518 [info] Starting Kernel (Python Path: ~\Git\PyFleetSim\venv\Scripts\python.exe, Venv, 3.9.13) for 'Interactive-1.interactive' (disableUI=false)
13:47:35.548 [debug] Get Custom Env Variables, Class name = Em, completed in 0ms, has a truthy return value, Arg 1: "/c:/Users/~/Git/PyFleetSim/scripts/sample.py", Arg 2: "RunPythonCode"
13:47:35.549 [debug] Got env vars from Python Ext in 1ms for ~\Git\PyFleetSim\venv\Scripts\python.exe, with env var count 76.
13:47:35.550 [debug] Getting activated env variables, Class name = Id, completed in 2ms, has a truthy return value, Arg 1: "/c:/Users/~/Git/PyFleetSim/scripts/sample.py", Arg 2: "~\\GIT\\PYFLEETSIM\\VENV\\SCRIPTS\\PYTHON.EXE", Arg 3: undefined
13:47:35.564 [info] Process Execution: ~\Git\PyFleetSim\venv\Scripts\python.exe -c "import ipykernel; print(ipykernel.__version__); print("5dc3a68c-e34e-4080-9c3e-2a532b2ccb4d"); print(ipykernel.__file__)"
13:47:35.683 [debug] Launching kernel .jvsc74a57bd0c3240c0253d6f6dfac3ee8a340291267d72d7fb2d19801612b2c923d47e61a47.c:\Users\~\Git\PyFleetSim\venv\Scripts\python.exe.c:\Users\~\Git\PyFleetSim\venv\Scripts\python.exe.-m#ipykernel_launcher for ~\Git\PyFleetSim\scripts\sample.py in ~\Git\PyFleetSim\scripts with ports 9001, 9000, 9004, 9002, 9003
13:47:35.686 [debug] Get Custom Env Variables, Class name = Em, completed in 1ms, has a truthy return value, Arg 1: "/c:/Users/~/Git/PyFleetSim/scripts/sample.py", Arg 2: "RunPythonCode"
13:47:35.709 [warn] Failed to get activated env vars for ~\AppData\Local\Programs\Python\Python312\python.exe in 24ms
13:47:35.710 [debug] Create ProcessService, Class name = wm (started execution), Arg 1: undefined
13:47:35.713 [debug] Get Custom Env Variables, Class name = Em, completed in 3ms, has a truthy return value, Arg 1: undefined, Arg 2: "RunNonPythonCode", Arg 3: undefined
13:47:35.713 [debug] Create ProcessService, Class name = wm, completed in 3ms, has a truthy return value, Arg 1: undefined
13:47:35.725 [info] Process Execution: ~\AppData\Local\Programs\Python\Python312\python.exe -c "import site;print("USER_BASE_VALUE");print(site.USER_SITE);print("USER_BASE_VALUE");"
13:47:35.812 [debug] Getting activated env variables, Class name = Id, completed in 127ms, has a truthy return value, Arg 1: "/c:/Users/~/Git/PyFleetSim/scripts/sample.py", Arg 2: "~\\APPDATA\\LOCAL\\PROGRAMS\\PYTHON\\PYTHON312\\PYTHON.EXE", Arg 3: undefined
13:47:35.824 [info] Process Execution: ~\AppData\Local\Programs\Python\Python312\python.exe c:\Users\~\.vscode\extensions\ms-toolsai.jupyter-2024.10.0-win32-x64\pythonFiles\vscode_datascience_helpers\kernel_interrupt_daemon.py --ppid 25540
    > cwd: ~\.vscode\extensions\ms-toolsai.jupyter-2024.10.0-win32-x64\pythonFiles\vscode_datascience_helpers
13:47:36.060 [info] Process Execution: ~\Git\PyFleetSim\venv\Scripts\python.exe -m ipykernel_launcher --f=c:\Users\~\AppData\Roaming\jupyter\runtime\kernel-v38b213e22fde36607e75d330ed1a4ce83c7119c0d.json
    > cwd: ~\Git\PyFleetSim\scripts
13:47:36.061 [debug] Kernel process 20012.
13:47:37.358 [debug] Waiting for Raw Session to be ready in postStartRawSession
13:47:37.358 [debug] Waiting for Raw session to be ready, status: connected
13:47:37.358 [debug] Waited for Raw session to be ready & got status: connected
13:47:37.358 [debug] Successfully waited for Raw Session to be ready in postStartRawSession
13:47:37.358 [debug] Kernel status is 'unknown' before requesting kernel info and after ready
13:47:37.358 [debug] Sending request for kernelInfo
13:47:37.360 [debug] Kernel output 20012: To connect another client to this kernel, use:
--existing c:\Users\~\AppData\Roaming\jupyter\runtime\kernel-v38b213e22fde36607e75d330ed1a4ce83c7119c0d.json
13:47:37.609 [debug] Successfully completed postStartRawSession after 1 attempt(s) in 251ms
13:47:38.538 [debug] Requesting Kernel info
13:47:38.543 [info] Kernel successfully started
13:47:38.545 [debug] getDataDirsImpl, Class name = Kr (started execution), Arg 1: "/c:/Users/~/Git/PyFleetSim/scripts/sample.py", Arg 2: "~\\GIT\\PYFLEETSIM\\VENV\\SCRIPTS\\PYTHON.EXE"
13:47:38.546 [debug] Get Custom Env Variables, Class name = Em, completed in 0ms, has a truthy return value, Arg 1: undefined, Arg 2: "RunPythonCode"
13:47:38.546 [debug] Jupyter Paths : 
13:47:38.547 [debug] Initializing __file__ in setFileInKernel with file:///c%3A/Users/~/Git/PyFleetSim/scripts/sample.py for mode multiple
13:47:38.550 [debug] Start refreshing Kernel Picker (1732884458550)
13:47:38.569 [info] Process Execution: ~\Git\PyFleetSim\venv\Scripts\python.exe c:\Users\~\.vscode\extensions\ms-toolsai.jupyter-2024.10.0-win32-x64\pythonFiles\printJupyterDataDir.py
13:47:38.570 [debug] End refreshing Kernel Picker (1732884458550)
13:47:38.578 [info] Generated code for 1 = <ipython-input-1-69b794a0490f> with 2 lines
13:47:38.646 [debug] Kernel acknowledged execution of cell 4 @ 1732884458646
13:47:38.724 [debug] CodeWatcher::runCell, Class name = qt, completed in 3211ms, has a falsy return value
13:47:38.745 [debug] Got an empty Jupyter Data Dir from C:\USERS\~\GIT\PYFLEETSIM\VENV\SCRIPTS\PYTHON.EXE, stderr = undefined
13:47:38.745 [debug] getDataDirsImpl, Class name = Kr, completed in 200ms, has a truthy return value, Arg 1: "/c:/Users/~/Git/PyFleetSim/scripts/sample.py", Arg 2: "~\\GIT\\PYFLEETSIM\\VENV\\SCRIPTS\\PYTHON.EXE", Return Value: <Uri:/C:/Users/~/AppData/Roaming/jupyter>, <Uri:/c:/Users/~/Git/PyFleetSim/venv/share/jupyter>, <Uri:/C:/ProgramData/jupyter>

Coding Language and Runtime Version

3.9.13 (tags/v3.9.13:6de2ca5, May 17 2022, 16:36:42) [MSC v.1929 64 bit (AMD64)]

Language Extension Version (if applicable)

No response

Anaconda Version (if applicable)

No response

Running Jupyter locally or remotely?

Local

@stertingen stertingen added the bug Issue identified by VS Code Team member as probable bug label Nov 29, 2024
@vs-code-engineering vs-code-engineering bot added the triage-needed Issue needs to be triaged label Nov 29, 2024
@DonJayamanne DonJayamanne added feature-request Request for new features or functionality debt Code quality issues and removed bug Issue identified by VS Code Team member as probable bug feature-request Request for new features or functionality labels Dec 3, 2024
@DonJayamanne DonJayamanne added notebook-execution Kernels issues (start/restart/switch/execution, install ipykernel) and removed triage-needed Issue needs to be triaged labels Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
debt Code quality issues notebook-execution Kernels issues (start/restart/switch/execution, install ipykernel)
Projects
None yet
Development

No branches or pull requests

2 participants