vscode-jupyter icon indicating copy to clipboard operation
vscode-jupyter copied to clipboard

Jupyter extension creates countless empty "checkpoint" files after saving (autosave disabled)

Open edavidk7 opened this issue 4 years ago • 36 comments
trafficstars

Environment data

  • VS Code version: 1.57.1 (Universal)
  • Jupyter Extension version (available under the Extensions sidebar): v2021.6.999662501
  • Python Extension version (available under the Extensions sidebar): v2021.6.944021595
  • OS (Windows | Mac | Linux distro) and version: macOS 11.4 Big Sur (Apple M1 platform)
  • Python and/or Anaconda version: 3.8.10 (aarch64), 3.9.5 (aarch64) - homebrew
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): N/A
  • Jupyter server running: Local

Expected behaviour

After saving changes in a jupyter notebook, only a single checkpoint file should be created

Actual behaviour

After saving changes in a jupyter notebook, multiple random files appear in both the directory of the jupyter notebook file and the checkpoints folder

Steps to reproduce:

  1. Make changes to Jupyter notebook (adding a cell with print("Hello world") is enough)
  2. run the cell
  3. save changes
  4. refresh folder view and see the "junk" files

Logs

Info 2021-07-02 12:35:50: Executing cell NotebookImport#26
Info 2021-07-02 12:35:50: Waiting for jupyter server and web panel ...
Info 2021-07-02 12:35:50: Checking for server existence.
Info 2021-07-02 12:35:50: Checking for server usability.
Info 2021-07-02 12:35:50: Server not usable (should ask for install now)
Error 2021-07-02 12:35:50: Exception attempting to start notebook:  [o [Error]: Jupyter cannot be started. Error attempting to locate jupyter: Select an Interpreter to start Jupyter
	at S.startServer (/Users/davidkorcak/.vscode/extensions/ms-toolsai.jupyter-2021.6.999662501/out/client/extension.js:54:407589)
	at processTicksAndRejections (internal/process/task_queues.js:93:5)
	at async S.createServer (/Users/davidkorcak/.vscode/extensions/ms-toolsai.jupyter-2021.6.999662501/out/client/extension.js:54:406884)
	at async connect (/Users/davidkorcak/.vscode/extensions/ms-toolsai.jupyter-2021.6.999662501/out/client/extension.js:90:178208)
	at async D.ensureConnectionAndNotebookImpl (/Users/davidkorcak/.vscode/extensions/ms-toolsai.jupyter-2021.6.999662501/out/client/extension.js:37:641568)
	at async D.ensureConnectionAndNotebook (/Users/davidkorcak/.vscode/extensions/ms-toolsai.jupyter-2021.6.999662501/out/client/extension.js:37:639797)
	at async D.clearResult (/Users/davidkorcak/.vscode/extensions/ms-toolsai.jupyter-2021.6.999662501/out/client/extension.js:37:635459)
	at async D.reexecuteCell (/Users/davidkorcak/.vscode/extensions/ms-toolsai.jupyter-2021.6.999662501/out/client/extension.js:37:621723)
	at async D.reexecuteCells (/Users/davidkorcak/.vscode/extensions/ms-toolsai.jupyter-2021.6.999662501/out/client/extension.js:37:618182)] {
  category: 'jupyterinstall',
  action: 'https://aka.ms/pyaiinstall',
  actionTitle: 'Get more help'
}
Info 2021-07-02 12:35:50: Exception executing cell NotebookImport#26:  [o [Error]: Jupyter cannot be started. Error attempting to locate jupyter: Select an Interpreter to start Jupyter
	at S.startServer (/Users/davidkorcak/.vscode/extensions/ms-toolsai.jupyter-2021.6.999662501/out/client/extension.js:54:407589)
	at processTicksAndRejections (internal/process/task_queues.js:93:5)
	at async S.createServer (/Users/davidkorcak/.vscode/extensions/ms-toolsai.jupyter-2021.6.999662501/out/client/extension.js:54:406884)
	at async connect (/Users/davidkorcak/.vscode/extensions/ms-toolsai.jupyter-2021.6.999662501/out/client/extension.js:90:178208)
	at async D.ensureConnectionAndNotebookImpl (/Users/davidkorcak/.vscode/extensions/ms-toolsai.jupyter-2021.6.999662501/out/client/extension.js:37:641568)
	at async D.ensureConnectionAndNotebook (/Users/davidkorcak/.vscode/extensions/ms-toolsai.jupyter-2021.6.999662501/out/client/extension.js:37:639797)
	at async D.clearResult (/Users/davidkorcak/.vscode/extensions/ms-toolsai.jupyter-2021.6.999662501/out/client/extension.js:37:635459)
	at async D.reexecuteCell (/Users/davidkorcak/.vscode/extensions/ms-toolsai.jupyter-2021.6.999662501/out/client/extension.js:37:621723)
	at async D.reexecuteCells (/Users/davidkorcak/.vscode/extensions/ms-toolsai.jupyter-2021.6.999662501/out/client/extension.js:37:618182)] {
  category: 'jupyterinstall',
  action: 'https://aka.ms/pyaiinstall',
  actionTitle: 'Get more help'
}
Info 2021-07-02 12:35:50: Finished executing cell NotebookImport#26
Info 2021-07-02 12:35:53: Cached data exists getEnvironmentVariables, <No Resource>
Info 2021-07-02 12:35:53: Cached data exists getEnvironmentVariables, <No Resource>
Info 2021-07-02 12:35:53: Process Execution: > /opt/homebrew/bin/python3 -c "import jupyter"
> /opt/homebrew/bin/python3 -c "import jupyter"
Info 2021-07-02 12:35:53: Process Execution: > /opt/homebrew/bin/python3 -c "import jupyter"
> /opt/homebrew/bin/python3 -c "import jupyter"
Info 2021-07-02 12:35:53: Process Execution: > /opt/homebrew/bin/python3 -c "import notebook"
> /opt/homebrew/bin/python3 -c "import notebook"
Info 2021-07-02 12:35:53: Process Execution: > /opt/homebrew/bin/python3 -c "import notebook"
> /opt/homebrew/bin/python3 -c "import notebook"
Info 2021-07-02 12:35:53: Cached data exists getEnvironmentVariables, <No Resource>
Info 2021-07-02 12:35:53: Process Execution: > /opt/homebrew/bin/python3 -m jupyter kernelspec --version
> /opt/homebrew/bin/python3 -m jupyter kernelspec --version
Info 2021-07-02 12:35:53: Process Execution: > /opt/homebrew/bin/python3 -m jupyter kernelspec --version
> /opt/homebrew/bin/python3 -m jupyter kernelspec --version
Error 2021-07-02 12:35:53: DataScience Error [o [Error]: Jupyter cannot be started. Error attempting to locate jupyter: Select an Interpreter to start Jupyter
	at S.startServer (/Users/davidkorcak/.vscode/extensions/ms-toolsai.jupyter-2021.6.999662501/out/client/extension.js:54:407589)
	at processTicksAndRejections (internal/process/task_queues.js:93:5)
	at async S.createServer (/Users/davidkorcak/.vscode/extensions/ms-toolsai.jupyter-2021.6.999662501/out/client/extension.js:54:406884)
	at async connect (/Users/davidkorcak/.vscode/extensions/ms-toolsai.jupyter-2021.6.999662501/out/client/extension.js:90:178208)
	at async D.ensureConnectionAndNotebookImpl (/Users/davidkorcak/.vscode/extensions/ms-toolsai.jupyter-2021.6.999662501/out/client/extension.js:37:641568)
	at async D.ensureConnectionAndNotebook (/Users/davidkorcak/.vscode/extensions/ms-toolsai.jupyter-2021.6.999662501/out/client/extension.js:37:639797)
	at async D.clearResult (/Users/davidkorcak/.vscode/extensions/ms-toolsai.jupyter-2021.6.999662501/out/client/extension.js:37:635459)
	at async D.reexecuteCell (/Users/davidkorcak/.vscode/extensions/ms-toolsai.jupyter-2021.6.999662501/out/client/extension.js:37:621723)
	at async D.reexecuteCells (/Users/davidkorcak/.vscode/extensions/ms-toolsai.jupyter-2021.6.999662501/out/client/extension.js:37:618182)] {
  category: 'jupyterinstall',
  action: 'https://aka.ms/pyaiinstall',
  actionTitle: 'Get more help'
}
Info 2021-07-02 12:35:54: Cached data exists getEnvironmentVariables, <No Resource>
Info 2021-07-02 12:35:54: Creating daemon pool for /opt/homebrew/bin/python3 with env variables count 0
Info 2021-07-02 12:35:54: Process Execution: > /opt/homebrew/bin/python3 -m vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.jupyter_daemon -v
> /opt/homebrew/bin/python3 -m vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.jupyter_daemon -v
Info 2021-07-02 12:35:54: Process Execution: > /opt/homebrew/bin/python3 -m vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.jupyter_daemon -v
> /opt/homebrew/bin/python3 -m vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.jupyter_daemon -v
Info 2021-07-02 12:35:54: Process Execution: > /opt/homebrew/bin/python3 -m vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.jupyter_daemon -v
> /opt/homebrew/bin/python3 -m vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.jupyter_daemon -v
Info 2021-07-02 12:35:54: Process Execution: > /opt/homebrew/bin/python3 -m vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.jupyter_daemon -v
> /opt/homebrew/bin/python3 -m vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.jupyter_daemon -v
Info 2021-07-02 12:35:54: Process Execution: > /opt/homebrew/bin/python3 -m vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.jupyter_daemon -v
> /opt/homebrew/bin/python3 -m vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.jupyter_daemon -v
Info 2021-07-02 12:35:54: Process Execution: > /opt/homebrew/bin/python3 -m vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.jupyter_daemon -v
> /opt/homebrew/bin/python3 -m vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.jupyter_daemon -v

More info

This bug DOES NOT manifest itself on my Windows 10 system running the same environment on x86 processor. Seems to be either macOS or macOS aarch64 exclusive. Also DOES NOT happen when using jupyter notebook web environment, only in VS Code. It has been reported multiple times already with no answers: https://stackoverflow.com/questions/64259277/vscode-jupyter-server-generates-random-ipynb-files?r=SearchResults&s=1|66.8220 https://stackoverflow.com/questions/65239027/visual-studio-code-jupyter-interactive-how-to-disable-the-automatic-creation?r=SearchResults&s=3|54.7774

Screenshots

Before Snímek obrazovky 2021-07-02 v 12 20 09 After Snímek obrazovky 2021-07-02 v 12 22 18

edavidk7 avatar Jul 02 '21 10:07 edavidk7

Thanks @edavidk7, will look into this soon. @rchiodo mentioned this could be related to raw kernel vs. non-raw kernel. (Don't have support for raw kernel for M1 yet)

claudiaregio avatar Jul 02 '21 18:07 claudiaregio

I have the same problem occurring on Ubuntu 20.04. VS Code and extension versions are all identical to @edavidk7

NotLoose avatar Jul 06 '21 03:07 NotLoose

Same issure here. I am also running Ubuntu 20.04 (x86) with the same versions of VS Code and Jupyter extension as mentioned above.

yolios avatar Jul 07 '21 06:07 yolios

Apparently, this is something we likely used to clean up? Seems like a regression.

greazer avatar Jul 08 '21 20:07 greazer

We need to turn off checkpointing at least.

greazer avatar Aug 09 '21 17:08 greazer

We need to turn off checkpointing at least.

is it possible to do this as a user?

EDIT: I guess the answer is to do something like

c.FileCheckpoints.checkpoint_dir = '_ipynb_checkpoints' in ~/.jupyter/jupyter_notebook_config.py

source https://stackoverflow.com/a/53865194/9045206

makslevental avatar Sep 20 '21 17:09 makslevental

That might work. You'd have to uncheck this too:

image

rchiodo avatar Sep 20 '21 17:09 rchiodo

I have the same issue after start/restarting the kernel

  • python 3.8.8 Anaconda
  • python 3.8.10 normal

image

i3130002 avatar Dec 12 '21 07:12 i3130002

@i3130002 I'm sorry you are running into this issue.

  • Please could you update to the latest version of VS Code
  • 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. I'd like to see what's going on.

DonJayamanne avatar Dec 13 '21 18:12 DonJayamanne

Dear @DonJayamanne, thanks for your response

Please could you update to the latest version of VS Code

I'm on 1.63.1 image

Open settings & go into Jupyter->Logging

Well I can't, it will no longer open. Setting it to debug and restarting fixes it. image

i3130002 avatar Dec 16 '21 09:12 i3130002

@DonJayamanne I was able to produce the requested logs, I am running vscode 1.63.1 on Ubuntu 20.04, Python 3.8.10. It appears to be encountering an exception while trying to delete the temporary file. Have been dealing with this issue for months now so a fix would be fantastic

Verbose 16:58:46: Find kernel spec, Class name = x (started execution), Arg 1: "/data/users/ryan/git/sandbox/processTopLog.ipynb", Arg 2: {"interpreter":{"hash":"31f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6"},"kernelspec":{"display_name":"Python 3.8.10 64-bit","language":"python","name":"python3"},"language_info":{"codemirror_mode":{"name":"ipython","version":3},"file_extension":".py","mimetype":"text/x-python","name":"python","nbconvert_exporter":"python","pygments_lexer":"ipython3","version":"3.8.10"},"orig_nbformat":4}, Arg 3: ""
Verbose 16:58:46: Get Interpreters, Class name = P (started execution), Arg 1: "/data/users/ryan/git/sandbox/processTopLog.ipynb"
Info 16:58:46: Setting setActiveController for /data/users/ryan/git/sandbox/processTopLog.ipynb
Verbose 16:58:46: Intiailize notebook communications for editor /data/users/ryan/git/sandbox/processTopLog.ipynb
Verbose 16:58:46: Resolving notebook UI Comms (resolve) for /data/users/ryan/git/sandbox/processTopLog.ipynb
Verbose 16:58:46: initialize CommonMessageCoordinator
Verbose 16:58:46: Get Interpreters, Class name = P, completed in 10ms, has a truthy return value, Arg 1: "/data/users/ryan/git/sandbox/processTopLog.ipynb"
Verbose 16:58:46: Getting Jupyter KernelSpec Root Path, Class name = m (started execution), 
Verbose 16:58:46: Get Active Interpreter, Class name = P (started execution), Arg 1: "/data/users/ryan/git/sandbox/processTopLog.ipynb"
Verbose 16:58:46: Get Kernelspec root path, Class name = m (started execution), 
Verbose 16:58:46: Get Jupyter Paths, Class name = m (started execution), Arg 1: undefined
Info 16:58:46: KernelProvider switched kernel to id = .jvsc74a57bd031f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6./usr/bin/python3./usr/bin/python3.-m#ipykernel_launcher
Info 16:58:46: Starting Notebook in kernel.ts id = .jvsc74a57bd031f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6./usr/bin/python3./usr/bin/python3.-m#ipykernel_launcher
Verbose 16:58:46: Getting Jupyter KernelSpec Root Path, Class name = m, completed in 3ms, has a truthy return value, , Return Value: "/home/ryan/.local/share/jupyter/kernels"
Verbose 16:58:46: Get Active Interpreter, Class name = P, completed in 2ms, has a truthy return value, Arg 1: "/data/users/ryan/git/sandbox/processTopLog.ipynb"
Verbose 16:58:46: Registering commtarget jupyter.widget
Verbose 16:58:46: IPyWidgetMessageDispatcher.initialize
Verbose 16:58:46: Get Jupyter Paths, Class name = m, completed in 4ms, has a truthy return value, Arg 1: undefined, Return Value: []
Verbose 16:58:46: Created and initailized CommonMessageCoordinator
Verbose 16:58:46: Get Kernelspec root path, Class name = m, completed in 5ms, has a truthy return value, , Return Value: ["/usr/share/jupyter/kernels","/usr/local/share/jupyter/kernels","/home/ryan/.local/share/jupyter/kernels"]
Verbose 16:58:46: Attach Coordinator for /data/users/ryan/git/sandbox/processTopLog.ipynb
Verbose 16:58:46: Kernel python3810jvsc74a57bd031f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6 matches Python 3.8.10 64-bit based on metadata path.
Info 16:58:46: Creating controller for jupyter-notebook with interpreter /usr/bin/python3
Verbose 16:58:46: Python Daemon (pid: 176660): write to stderr: [I 16:58:46.141 NotebookApp] Creating new notebook in 

[I 16:58:46.141 NotebookApp] Creating new notebook in 
Verbose 16:58:46: Check if a kernel is usable, Class name = S (started execution), Arg 1: "/data/users/ryan/git/sandbox/processTopLog.ipynb", Arg 2: ".jvsc74a57bd031f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6./usr/bin/python3./usr/bin/python3.-m#ipykernel_launcher", Arg 3: "", Arg 4: ""
Info 16:58:46: installMissingDependencies /usr/bin/python3
Info 16:58:46: IPykernel found previously in this enviornment /usr/bin/python3
Verbose 16:58:46: Install Missing Dependencies, Class name = k, completed in 1ms, has a falsy return value, Return Value: undefined
Verbose 16:58:46: Getting Jupyter KernelSpec Root Path, Class name = m (started execution), 
Info 16:58:46: Freferred kernel connection found in cache .jvsc74a57bd031f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6./usr/bin/python3./usr/bin/python3.-m#ipykernel_launcher
Verbose 16:58:46: Getting Jupyter KernelSpec Root Path, Class name = m, completed in 0ms, has a truthy return value, , Return Value: "/home/ryan/.local/share/jupyter/kernels"
Verbose 16:58:46: Find kernel spec, Class name = x, completed in 321ms, has a truthy return value, Arg 1: "/data/users/ryan/git/sandbox/processTopLog.ipynb", Arg 2: {"interpreter":{"hash":"31f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6"},"kernelspec":{"display_name":"Python 3.8.10 64-bit","language":"python","name":"python3"},"language_info":{"codemirror_mode":{"name":"ipython","version":3},"file_extension":".py","mimetype":"text/x-python","name":"python","nbconvert_exporter":"python","pygments_lexer":"ipython3","version":"3.8.10"},"orig_nbformat":4}, Arg 3: ""
Info 16:58:46: PreferredConnection: .jvsc74a57bd031f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6./usr/bin/python3./usr/bin/python3.-m#ipykernel_launcher found for NotebookDocument: /data/users/ryan/git/sandbox/processTopLog.ipynb
Info 16:58:46: TargetController found ID: .jvsc74a57bd031f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6./usr/bin/python3./usr/bin/python3.-m#ipykernel_launcher for document /data/users/ryan/git/sandbox/processTopLog.ipynb
Info 16:58:46: Setting controller affinity for /data/users/ryan/git/sandbox/processTopLog.ipynb .jvsc74a57bd031f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6./usr/bin/python3./usr/bin/python3.-m#ipykernel_launcher
Info 16:58:46: Spec argv[0] updated from '/usr/bin/python3' to '/usr/bin/python3'
Verbose 16:58:46: Getting activated env variables, Class name = I (started execution), Arg 1: undefined, Arg 2: "/usr/bin/python3", Arg 3: true
Verbose 16:58:46: Getting activated env variables ourselves, Class name = I (started execution), Arg 1: undefined, Arg 2: "/usr/bin/python3"
Verbose 16:58:46: Getting activated env variables from Python, Class name = I (started execution), Arg 1: undefined, Arg 2: "/usr/bin/python3"
Verbose 16:58:46: Getting activated env variables ourselves, Class name = I, completed in 1ms, has a falsy return value, Arg 1: undefined, Arg 2: "/usr/bin/python3"
Verbose 16:58:46: Got env vars ourselves faster, but empty /usr/bin/python3
Verbose 16:58:46: Got env vars ourselves /usr/bin/python3 in 1ms
Verbose 16:58:46: Getting activated env variables from Python, Class name = I, completed in 49ms, has a falsy return value, Arg 1: undefined, Arg 2: "/usr/bin/python3"
Verbose 16:58:46: Got env vars with python /usr/bin/python3 in 49ms
Verbose 16:58:46: Getting activated env variables, Class name = I, completed in 50ms, has a falsy return value, Arg 1: undefined, Arg 2: "/usr/bin/python3", Arg 3: true
Verbose 16:58:46: Check if a kernel is usable, Class name = S, completed in 454ms, has a falsy return value, Arg 1: "/data/users/ryan/git/sandbox/processTopLog.ipynb", Arg 2: ".jvsc74a57bd031f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6./usr/bin/python3./usr/bin/python3.-m#ipykernel_launcher", Arg 3: "", Arg 4: "", Return Value: undefined
Info 16:58:46: Starting a new session for kernel id = .jvsc74a57bd031f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6./usr/bin/python3./usr/bin/python3.-m#ipykernel_launcher, name = python3810jvsc74a57bd031f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6
Verbose 16:58:46: Create daemon, Class name = k (started execution), Arg 1: {"daemonModule":"vscode_datascience_helpers.jupyter_daemon","interpreter":{"sysPrefix":"/usr","envType":"Global","envName":"","envPath":"","path":"/usr/bin/python3","architecture":3,"sysVersion":"3.8.10 (default, Nov 26 2021, 20:14:08) \n[GCC 9.3.0]","version":{"raw":"3.8.10","major":3,"minor":8,"patch":10,"build":[],"prerelease":["final","0"]},"displayName":"Python 3.8.10 64-bit"}}
Verbose 16:58:46: Create activated Env, Class name = k (started execution), Arg 1: ""
Verbose 16:58:46: Getting activated env variables, Class name = I (started execution), Arg 1: undefined, Arg 2: "/usr/bin/python3", Arg 3: true
Verbose 16:58:46: Getting activated env variables ourselves, Class name = I (started execution), Arg 1: undefined, Arg 2: "/usr/bin/python3"
Verbose 16:58:46: Getting activated env variables from Python, Class name = I (started execution), Arg 1: undefined, Arg 2: "/usr/bin/python3"
Verbose 16:58:46: Getting activated env variables ourselves, Class name = I, completed in 1ms, has a falsy return value, Arg 1: undefined, Arg 2: "/usr/bin/python3"
Verbose 16:58:46: Create daemon, Class name = k, completed in 1ms, has a truthy return value, Arg 1: {"daemonModule":"vscode_datascience_helpers.jupyter_daemon","interpreter":{"sysPrefix":"/usr","envType":"Global","envName":"","envPath":"","path":"/usr/bin/python3","architecture":3,"sysVersion":"3.8.10 (default, Nov 26 2021, 20:14:08) \n[GCC 9.3.0]","version":{"raw":"3.8.10","major":3,"minor":8,"patch":10,"build":[],"prerelease":["final","0"]},"displayName":"Python 3.8.10 64-bit"}}
Verbose 16:58:46: Got env vars ourselves faster, but empty /usr/bin/python3
Verbose 16:58:46: Got env vars ourselves /usr/bin/python3 in 1ms
Verbose 16:58:46: Getting activated env variables from Python, Class name = I, completed in 15ms, has a falsy return value, Arg 1: undefined, Arg 2: "/usr/bin/python3"
Verbose 16:58:46: Got env vars with python /usr/bin/python3 in 15ms
Verbose 16:58:46: Getting activated env variables, Class name = I, completed in 15ms, has a falsy return value, Arg 1: undefined, Arg 2: "/usr/bin/python3", Arg 3: true
Verbose 16:58:46: Creating execution process, Class name = k (started execution), Arg 1: {"interpreter":{"sysPrefix":"/usr","envType":"Global","envName":"","envPath":"","path":"/usr/bin/python3","architecture":3,"sysVersion":"3.8.10 (default, Nov 26 2021, 20:14:08) \n[GCC 9.3.0]","version":{"raw":"3.8.10","major":3,"minor":8,"patch":10,"build":[],"prerelease":["final","0"]},"displayName":"Python 3.8.10 64-bit"}}
Verbose 16:58:46: Create ProcessService, Class name = p (started execution), Arg 1: undefined
Verbose 16:58:46: Get Custom Env Variables, Class name = m (started execution), Arg 1: undefined
Verbose 16:58:46: Cached data exists getEnvironmentVariables, <No Resource>
Verbose 16:58:46: Get Custom Env Variables, Class name = m, completed in 1ms, has a truthy return value, Arg 1: undefined
Verbose 16:58:46: Create ProcessService, Class name = p, completed in 1ms, has a truthy return value, Arg 1: undefined
Verbose 16:58:46: Creating execution process, Class name = k, completed in 2ms, has a truthy return value, Arg 1: {"interpreter":{"sysPrefix":"/usr","envType":"Global","envName":"","envPath":"","path":"/usr/bin/python3","architecture":3,"sysVersion":"3.8.10 (default, Nov 26 2021, 20:14:08) \n[GCC 9.3.0]","version":{"raw":"3.8.10","major":3,"minor":8,"patch":10,"build":[],"prerelease":["final","0"]},"displayName":"Python 3.8.10 64-bit"}}, Return Value: {}
Verbose 16:58:46: Create activated Env, Class name = k, completed in 18ms, has a truthy return value, Arg 1: ""
Verbose 16:58:46: Python Daemon (pid: 176660): write to stderr: [I 16:58:46.633 NotebookApp] Kernel started: bb73ca2a-2d6d-4b71-8af9-68c28de2c169, name: python3810jvsc74a57bd031f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6

[I 16:58:46.633 NotebookApp] Kernel started: bb73ca2a-2d6d-4b71-8af9-68c28de2c169, name: python3810jvsc74a57bd031f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6
Info 16:58:46: Waiting for idle on (kernel): bb73ca2a-2d6d-4b71-8af9-68c28de2c169 -> unknown
Verbose 16:58:46: Python Daemon (pid: 176660): write to stderr: [W 16:58:46.657 NotebookApp] delete /processTopLog-jvsc-cabca339-b075-4cc3-af13-f7d1dff28a3f.ipynb

[W 16:58:46.657 NotebookApp] delete /processTopLog-jvsc-cabca339-b075-4cc3-af13-f7d1dff28a3f.ipynb
Verbose 16:58:46: Python Daemon (pid: 176660): write to stderr: [E 16:58:46.658 NotebookApp] Uncaught exception DELETE /api/contents/processTopLog-jvsc-cabca339-b075-4cc3-af13-f7d1dff28a3f.ipynb?1639713526650 (127.0.0.1)
    HTTPServerRequest(protocol='http', host='localhost:8888', method='DELETE', uri='/api/contents/processTopLog-jvsc-cabca339-b075-4cc3-af13-f7d1dff28a3f.ipynb?1639713526650', version='HTTP/1.1', remote_ip='127.0.0.1')
    Traceback (most recent call last):
      File "/home/ryan/.local/lib/python3.8/site-packages/send2trash/plat_gio.py", line 17, in send2trash
        f.trash(cancellable=None)
    gi.repository.GLib.GError: g-io-error-quark: Unable to find or create trash directory for /data/users/ryan/git/sandbox/processTopLog-jvsc-cabca339-b075-4cc3-af13-f7d1dff28a3f.ipynb (0)
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/home/ryan/.local/lib/python3.8/site-packages/tornado/web.py", line 1704, in _execute
        result = await result
      File "/home/ryan/.local/lib/python3.8/site-packages/tornado/gen.py", line 234, in wrapper
        yielded = ctx_run(next, result)
      File "/home/ryan/.local/lib/python3.8/site-packages/notebook/services/contents/handlers.py", line 237, in delete
        yield maybe_future(cm.delete(path))
      File "/home/ryan/.local/lib/python3.8/site-packages/notebook/services/contents/manager.py", line 279, in delete
        self.delete_file(path)
      File "/home/ryan/.local/lib/python3.8/site-packages/notebook/services/contents/filemanager.py", line 533, in delete_file
        send2trash(os_path)
      File "/home/ryan/.local/lib/python3.8/site-packages/send2trash/plat_gio.py", line 23, in send2trash
        raise OSError(e.message)
    OSError: Unable to find or create trash directory for /data/users/ryan/git/sandbox/processTopLog-jvsc-cabca339-b075-4cc3-af13-f7d1dff28a3f.ipynb

[E 16:58:46.658 NotebookApp] Uncaught exception DELETE /api/contents/processTopLog-jvsc-cabca339-b075-4cc3-af13-f7d1dff28a3f.ipynb?1639713526650 (127.0.0.1)
    HTTPServerRequest(protocol='http', host='localhost:8888', method='DELETE', uri='/api/contents/processTopLog-jvsc-cabca339-b075-4cc3-af13-f7d1dff28a3f.ipynb?1639713526650', version='HTTP/1.1', remote_ip='127.0.0.1')
    Traceback (most recent call last):
      File "/home/ryan/.local/lib/python3.8/site-packages/send2trash/plat_gio.py", line 17, in send2trash
        f.trash(cancellable=None)
    gi.repository.GLib.GError: g-io-error-quark: Unable to find or create trash directory for /data/users/ryan/git/sandbox/processTopLog-jvsc-cabca339-b075-4cc3-af13-f7d1dff28a3f.ipynb (0)
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/home/ryan/.local/lib/python3.8/site-packages/tornado/web.py", line 1704, in _execute
        result = await result
      File "/home/ryan/.local/lib/python3.8/site-packages/tornado/gen.py", line 234, in wrapper
        yielded = ctx_run(next, result)
      File "/home/ryan/.local/lib/python3.8/site-packages/notebook/services/contents/handlers.py", line 237, in delete
        yield maybe_future(cm.delete(path))
      File "/home/ryan/.local/lib/python3.8/site-packages/notebook/services/contents/manager.py", line 279, in delete
        self.delete_file(path)
      File "/home/ryan/.local/lib/python3.8/site-packages/notebook/services/contents/filemanager.py", line 533, in delete_file
        send2trash(os_path)
      File "/home/ryan/.local/lib/python3.8/site-packages/send2trash/plat_gio.py", line 23, in send2trash
        raise OSError(e.message)
    OSError: Unable to find or create trash directory for /data/users/ryan/git/sandbox/processTopLog-jvsc-cabca339-b075-4cc3-af13-f7d1dff28a3f.ipynb
Verbose 16:58:46: Python Daemon (pid: 176660): write to stderr: [W 16:58:46.659 NotebookApp] Unhandled error

[W 16:58:46.659 NotebookApp] Unhandled error
Verbose 16:58:46: Python Daemon (pid: 176660): write to stderr: [E 16:58:46.660 NotebookApp] {
      "Authorization": "token 8ffcbdcc31c4405b81efbf31d6a9fa477bef3e4addd84697",
      "Content-Type": "application/json",
      "Accept": "*/*",
      "User-Agent": "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)",
      "Accept-Encoding": "gzip,deflate",
      "Connection": "close",
      "Host": "localhost:8888"
    }

[E 16:58:46.660 NotebookApp] {
      "Authorization": "token 8ffcbdcc31c4405b81efbf31d6a9fa477bef3e4addd84697",
      "Content-Type": "application/json",
      "Accept": "*/*",
      "User-Agent": "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)",
      "Accept-Encoding": "gzip,deflate",
      "Connection": "close",
      "Host": "localhost:8888"
    }
Verbose 16:58:46: Python Daemon (pid: 176660): write to stderr: [E 16:58:46.660 NotebookApp] 500 DELETE /api/contents/processTopLog-jvsc-cabca339-b075-4cc3-af13-f7d1dff28a3f.ipynb?1639713526650 (127.0.0.1) 4.770000ms referer=None

[E 16:58:46.660 NotebookApp] 500 DELETE /api/contents/processTopLog-jvsc-cabca339-b075-4cc3-af13-f7d1dff28a3f.ipynb?1639713526650 (127.0.0.1) 4.770000ms referer=None
Verbose 16:58:46: IPyWidgetMessageDispatcher.initialize
Info 16:58:47: Finished waiting for idle on (kernel): bb73ca2a-2d6d-4b71-8af9-68c28de2c169 -> idle
Info 16:58:47: Started session for kernel .jvsc74a57bd031f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6./usr/bin/python3./usr/bin/python3.-m#ipykernel_launcher
Info 16:58:47: Waiting for idle (session) kernel .jvsc74a57bd031f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6./usr/bin/python3./usr/bin/python3.-m#ipykernel_launcher
Info 16:58:47: Waiting for idle on (kernel): bb73ca2a-2d6d-4b71-8af9-68c28de2c169 -> idle
Info 16:58:47: Finished waiting for idle on (kernel): bb73ca2a-2d6d-4b71-8af9-68c28de2c169 -> idle
Info 16:58:47: Finished connecting kernel .jvsc74a57bd031f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6./usr/bin/python3./usr/bin/python3.-m#ipykernel_launcher
Info 16:58:47: UpdateWorkingDirectoryAndPath in Kernel
Info 16:58:47: changeDirectoryIfPossible
Info 16:58:47: Executing (status idle) silently Code = import os\nimport sys\n%cd "/data/users/ryan/git/sandbox"\nif os.getcwd() not in sys.path:\nsys.path
Info 16:58:47: Executing silently Code (completed) = import os\nimport sys\n%cd "/data/users/ryan/git/sandbox"\nif os.getcwd() not in sys.path:\nsys.path
Info 16:58:47: Executing (status idle) silently Code = %config Completer.use_jedi = False
Info 16:58:47: Executing silently Code (completed) = %config Completer.use_jedi = False
Info 16:58:47: Executing (status idle) silently Code = %config InlineBackend.figure_formats = ['png']
Info 16:58:47: Executing silently Code (completed) = %config InlineBackend.figure_formats = ['png']
Info 16:58:47: Executing (status idle) silently Code = import sys\nprint(sys.executable)
Info 16:58:47: Executing silently Code (completed) = import sys\nprint(sys.executable)
Info 16:58:47: Waiting for idle on (kernel): bb73ca2a-2d6d-4b71-8af9-68c28de2c169 -> idle
Info 16:58:47: Finished waiting for idle on (kernel): bb73ca2a-2d6d-4b71-8af9-68c28de2c169 -> idle
Verbose 16:58:47: IPyWidgetMessageDispatcher.initialize
Info 16:58:47: IPyWidgetScriptSource.initialize
Verbose 16:58:47: IPyWidgetMessageDispatcher.initialize
Verbose 16:58:47: IPyWidgetMessageDispatcher.initialize

NotLoose avatar Dec 17 '21 04:12 NotLoose

@ACheekyLlama Are you using Remote SSH? Looks like the root cause is the error OSError: Unable to find or create trash directory for /data/users/ryan/git/sandbox/xxxx

Please could you check for a solution here:

  • https://askubuntu.com/questions/262817/unable-to-find-or-create-trash-directory

Basically the OS isn't allowing files to be deleted. I'll see what we can do at our end.

DonJayamanne avatar Jan 16 '22 19:01 DonJayamanne

@DonJayamanne Ah thank you, it seems to be solved now! No I am not using remote SSH, but my source files are located on a different mount point that did not have a trash folder. I followed one of the answers in the link you posted to create a new trash folder for that mount and the files are now being deleted correctly! Thanks very much for your help :)

NotLoose avatar Jan 16 '22 20:01 NotLoose

@DonJayamanne

Please could you check for a solution here:

I can confirm that using download directory (Default settings and EXT4 file system) works fine. I have a mounted NTF drive which has the problem.

Any idea what can I do?

i3130002 avatar Jan 16 '22 20:01 i3130002

Any idea what can I do?

I'm sorry, but this is out of my area of expertise, please could you check stackoverflow or the like to see if others have have solutions for this (deleting files from mounted NTF drives).

DonJayamanne avatar Jan 20 '22 19:01 DonJayamanne

deleting files from mounted NTF drives

May I ask what is your current method to remove them? The mounted NTFS drive is my main project files and so far I had no issues deleting from it. Simply rm filename deletes files and no extra permission is required.

i3130002 avatar Jan 21 '22 20:01 i3130002

We rely on Jupyter to delete the files, from what I can tell Jupyter uses this package https://github.com/arsenetar/send2trash

DonJayamanne avatar Jan 21 '22 22:01 DonJayamanne

We rely on Jupyter to delete the files, from what I can tell Jupyter uses this package https://github.com/arsenetar/send2trash

It works perfectly and deletes the file:

...$ ls
todel.txt
...$ python
Python 3.8.8 (default, Apr 13 2021, 19:58:26) 
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from send2trash import send2trash
>>> send2trash('todel.txt')
>>> exit()
...$ ls

Installing the send2trash makes my kernel not working

python -m pip install -U send2trash
File ".../.local/lib/python3.8/site-packages/notebook/services/contents/filemanager.py", line 17, in <module>
    from send2trash import send2trash
ModuleNotFoundError: No module named 'send2trash'

i3130002 avatar Jan 22 '22 17:01 i3130002

@i3130002 As mentioned we rely on Jupyter Application to delete these files, you might want to file an issue on the Jupyter repo, as thats not somethign we control.

DonJayamanne avatar Jan 24 '22 18:01 DonJayamanne

Summary

  • Seems to be fixed for Mac M1
  • Users running into issues when mounting drives (problem is Jupyter Application uses Python code to delete these files and it fails to do so in Jupyter's Python code)

DonJayamanne avatar Jan 24 '22 18:01 DonJayamanne

I believe we can eliminate some of the problem by turning off check pointing? Not sure if anybody tried that or not.

We'd make that change here: https://github.com/microsoft/vscode-jupyter/blob/69e7bf7e71eb75fb53f68baed1c87060ce6d3eff/src/client/datascience/jupyter/notebookStarter.ts#L205

rchiodo avatar Feb 22 '22 17:02 rchiodo

@i3130002 Are you still running into this issue? I'd like to create a fix and confirm it works for you.

DonJayamanne avatar Mar 15 '22 02:03 DonJayamanne

u still running into this issue? I'd like to create a fix and confirm it

OMG thanks. I managed to run it and I still have the same problem. Will message you my email on twitter for simpler communication.

i3130002 avatar Mar 15 '22 06:03 i3130002

ms-toolsai-jupyter-insiders.vsix.zip

@i3130002 I have attached a copy of the Jupyter extension that might address this issue. Please could you extract this zip file and then install this VSIX. Please use the command Extension: Install from VSIX from the command palette to select the VSIX file and install that. If you're running VS Code on SSH or a docker container or the like (i.e. a remote container), then please upload this VSIX to that remote machine and then select the command Extension: Install from VSIX.

Once you have managed to install this extension and tested this, please let me know how this goes.

DonJayamanne avatar Mar 15 '22 18:03 DonJayamanne

Once you have managed to install this extension and tested this, please let me know how this goes.

Even though I installed it successfully. Jupyter v2022.3.1000760356 It had exactly the same behavior (Creating one empty file per kernel restart).

By the way, so sorry for the late reply. @DonJayamanne

i3130002 avatar Mar 26 '22 09:03 i3130002

Hi all,

I thought I am the only one having this annoying issue, but same here. No changes even after installing the Jupyter v2022.3.1000760356 extension. Running latest version of VsCode on Mac M1.

jonas-nothnagel avatar Mar 29 '22 14:03 jonas-nothnagel

@i3130002 @jonas-nothnagel I'm sorry you're still running into these issues. Please could you try the following VSIX. I believe this should fix it, As always if this doesn't work, please provide the output from the Jupyter output panel (please do provide all of the output).

Thanks

(Note: Please extract the zip file and install the extension using the command from the command palette Extensions: Install from VSIX) ms-toolsai-jupyter-insiders.vsix.zip

DonJayamanne avatar Mar 30 '22 04:03 DonJayamanne

@DonJayamanne You are an angle. Don't know what you did there but to me it's all resolved. Thanks for your hard work and patients King regards

i3130002 avatar Apr 01 '22 15:04 i3130002

thanks for confirming the fix

DonJayamanne avatar Apr 01 '22 23:04 DonJayamanne

Reopening. The fix seems to have broken non ZMQ on windows (haven't tested mac/linux). See #9709

rchiodo avatar Apr 19 '22 17:04 rchiodo