1

Since a few days I can't run my code (not even a simple print("Hello wolrd")) file in my python interactive window anymore. When I try to start the kernel I get the following message:

Failed to start the Kernel. OSError: [WinError 123] Die Syntax für den Dateinamen, Verzeichnisnamen oder die Datenträgerbezeichnung ist falsch: '"c:'. View Jupyter log for further details.

I am using python 3.6.13 and running from a virtual env which I am managing with anaconda. I have ipykernel installed. When I do the same with my other python version 3.9.7 it works just fine.

I already browsed a bunch of threads on this here but couldn't find a solution.

I am working on a Windows 11 Pro, 64-bit system.

I uploaded the full output of the jupyter log here and added as much as I can add to this post below.

Thankful for any help!!

warn 9:21:53.633: DataScience Error [o [Error]: The kernel died. Error: Traceback (most recent call last):
  File "c:\Users\Ludwig Hagelstein\.conda\envs\ERSSA\lib\site-packages\ipykernel\kernelapp.py", line 248, in init_connection_file
    self.connection_file = filefind(self.connection_file, ['.', self.connection_dir])
  File "c:\Users\Ludwig Hagelstein\.conda\envs\ERSSA\lib\site-packages\ipython_genutils\path.py", line 72, in filefind
    (filename, path_dirs) )
OSError: File 'c:\\Users\\Ludwig Hagelstein\\AppData\\Roaming\\jupyter\\runtime\\kernel-v2-16516MdNhf67cgpvm.json' does not exist in any of the search paths: ['.', 'C:\\Users\\Ludwig Hagelstein\\AppData\\Roaming\\jupyter\\runtime']

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\Users\Ludwig Hagelstein\.conda\envs\ERSSA\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\Users\Ludwig Hagelstein\.conda\envs\ERSSA\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "c:\Users\Ludwig Hagelstein\.conda\envs\ERSSA\lib\site-packages\ipykernel_launcher.py", line 16, in <module>
    app.launch_new_instance()
  File "c:\Users\Ludwig Hagelstein\.conda\envs\ERSSA\lib\site-packages\traitlets\config\application.py", line 663, in launch_instance
    app.initialize(argv)
  File "<decorator-gen-125>", line 2, in initialize
  File "c:\Users\Ludwig Hagelstein\.conda\envs\ERSSA\lib\site-packages\traitlets\config\application.py", line 87, in catch_config_error
    return method(app, *args, **kwargs)
  File "c:\Users\Ludwig Hagelstein\.conda\envs\ERSSA\lib\site-packages\ipykernel\kernelapp.py", line 572, in initialize
    self.init_connection_file()
  File "c:\Users\Ludwig Hagelstein\.conda\envs\ERSSA\lib\site-packages\ipykernel\kernelapp.py", line 252, in init_connection_file
    ensure_dir_exists(os.path.dirname(self.abs_connection_file), 0o700)
  File "c:\Users\Ludwig Hagelstein\.conda\envs\ERSSA\lib\site-packages\ipython_genutils\path.py", line 167, in ensure_dir_exists
    os.makedirs(path, mode=mode)
  File "c:\Users\Ludwig Hagelstein\.conda\envs\ERSSA\lib\os.py", line 210, in makedirs
    makedirs(head, mode, exist_ok)
  File "c:\Users\Ludwig Hagelstein\.conda\envs\ERSSA\lib\os.py", line 210, in makedirs
    makedirs(head, mode, exist_ok)
  File "c:\Users\Ludwig Hagelstein\.conda\envs\ERSSA\lib\os.py", line 210, in makedirs
    makedirs(head, mode, exist_ok)
  [Previous line repeated 3 more times]
  File "c:\Users\Ludwig Hagelstein\.conda\envs\ERSSA\lib\os.py", line 220, in makedirs
    mkdir(name, mode)
OSError: [WinError 123] Die Syntax für den Dateinamen, Verzeichnisnamen oder die Datenträgerbezeichnung ist falsch: '"c:'... View Jupyter [log](command:jupyter.viewOutput) for further details.
  at ChildProcess.<anonymous> (c:\Users\Ludwig Hagelstein\.vscode\extensions\ms-toolsai.jupyter-2022.7.1001951036\out\extension.node.js:2:2345235)
  at ChildProcess.emit (node:events:402:35)
  at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)] {
  category: 'kerneldied',
  kernelConnectionMetadata: {
    kind: 'startUsingPythonInterpreter',
    kernelSpec: {
      specFile: 'c:\\Users\\Ludwig Hagelstein\\.vscode\\extensions\\ms-toolsai.jupyter-2022.7.1001951036\\temp\\jupyter\\kernels\\python3613jvsc74a57bd0a85b755b206659c3403d1cc179901771ab1197b156960f6bf546d22992d48a39\\kernel.json',
      interpreterPath: 'c:\\Users\\Ludwig Hagelstein\\.conda\\envs\\ERSSA\\python.exe',
      isRegisteredByVSC: 'registeredByNewVersionOfExt',
      name: 'python3613jvsc74a57bd0a85b755b206659c3403d1cc179901771ab1197b156960f6bf546d22992d48a39',
      argv: [Array],
      language: 'python',
      executable: 'python',
      display_name: "Python 3.6.13 ('ERSSA')",
      metadata: [Object],
      env: {}
    },
    interpreter: {
      id: 'C:\\USERS\\LUDWIG HAGELSTEIN\\.CONDA\\ENVS\\ERSSA\\PYTHON.EXE',
      sysPrefix: 'C:\\Users\\Ludwig Hagelstein\\.conda\\envs\\ERSSA',
      envType: 'Conda',
      envName: 'ERSSA',
      envPath: [w],
      architecture: 3,
      sysVersion: '3.6.13 |Anaconda, Inc.| (default, Mar 16 2021, 11:37:27) [MSC v.1916 64 bit (AMD64)]',
      version: [Object],
      companyDisplayName: 'Anaconda, Inc.',
      displayName: "Python 3.6.13 ('ERSSA')",
      detailedDisplayName: "Python 3.6.13 ('ERSSA': conda)",
      uri: [w]
    },
    id: '.jvsc74a57bd0a85b755b206659c3403d1cc179901771ab1197b156960f6bf546d22992d48a39.c:\\Users\\Ludwig Hagelstein\\.conda\\envs\\ERSSA\\python.exe.c:\\Users\\Ludwig Hagelstein\\.conda\\envs\\ERSSA\\python.exe.-m#ipykernel_launcher'
  },
  exitCode: 1,
  stdErr: 'Traceback (most recent call last):\r\n' +
    '  File "c:\\Users\\Ludwig Hagelstein\\.conda\\envs\\ERSSA\\lib\\site-packages\\ipykernel\\kernelapp.py", line 248, in init_connection_file\r\n' +
    "    self.connection_file = filefind(self.connection_file, ['.', self.connection_dir])\r\n" +
    '  File "c:\\Users\\Ludwig Hagelstein\\.conda\\envs\\ERSSA\\lib\\site-packages\\ipython_genutils\\path.py", line 72, in filefind\r\n' +
    '    (filename, path_dirs) )\r\n' +
    "OSError: File 'c:\\\\Users\\\\Ludwig Hagelstein\\\\AppData\\\\Roaming\\\\jupyter\\\\runtime\\\\kernel-v2-16516MdNhf67cgpvm.json' does not exist in any of the search paths: ['.', 'C:\\\\Users\\\\Ludwig Hagelstein\\\\AppData\\\\Roaming\\\\jupyter\\\\runtime']\r\n" +
    '\r\n' +
    'During handling of the above exception, another exception occurred:\r\n' +
    '\r\n' +
    'Traceback (most recent call last):\r\n' +
    '  File "c:\\Users\\Ludwig Hagelstein\\.conda\\envs\\ERSSA\\lib\\runpy.py", line 193, in _run_module_as_main\r\n' +
    '    "__main__", mod_spec)\r\n' +
    '  File "c:\\Users\\Ludwig Hagelstein\\.conda\\envs\\ERSSA\\lib\\runpy.py", line 85, in _run_code\r\n' +
    '    exec(code, run_globals)\r\n' +
    '  File "c:\\Users\\Ludwig Hagelstein\\.conda\\envs\\ERSSA\\lib\\site-packages\\ipykernel_launcher.py", line 16, in <module>\r\n' +
    '    app.launch_new_instance()\r\n' +
    '  File "c:\\Users\\Ludwig Hagelstein\\.conda\\envs\\ERSSA\\lib\\site-packages\\traitlets\\config\\application.py", line 663, in launch_instance\r\n' +
    '    app.initialize(argv)\r\n' +
    '  File "<decorator-gen-125>", line 2, in initialize\r\n' +
    '  File "c:\\Users\\Ludwig Hagelstein\\.conda\\envs\\ERSSA\\lib\\site-packages\\traitlets\\config\\application.py", line 87, in catch_config_error\r\n' +
    '    return method(app, *args, **kwargs)\r\n' +
    '  File "c:\\Users\\Ludwig Hagelstein\\.conda\\envs\\ERSSA\\lib\\site-packages\\ipykernel\\kernelapp.py", line 572, in initialize\r\n' +
    '    self.init_connection_file()\r\n' +
    '  File "c:\\Users\\Ludwig Hagelstein\\.conda\\envs\\ERSSA\\lib\\site-packages\\ipykernel\\kernelapp.py", line 252, in init_connection_file\r\n' +
    '    ensure_dir_exists(os.path.dirname(self.abs_connection_file), 0o700)\r\n' +
    '  File "c:\\Users\\Ludwig Hagelstein\\.conda\\envs\\ERSSA\\lib\\site-packages\\ipython_genutils\\path.py", line 167, in ensure_dir_exists\r\n' +
    '    os.makedirs(path, mode=mode)\r\n' +
    '  File "c:\\Users\\Ludwig Hagelstein\\.conda\\envs\\ERSSA\\lib\\os.py", line 210, in makedirs\r\n' +
    '    makedirs(head, mode, exist_ok)\r\n' +
    '  File "c:\\Users\\Ludwig Hagelstein\\.conda\\envs\\ERSSA\\lib\\os.py", line 210, in makedirs\r\n' +
    '    makedirs(head, mode, exist_ok)\r\n' +
    '  File "c:\\Users\\Ludwig Hagelstein\\.conda\\envs\\ERSSA\\lib\\os.py", line 210, in makedirs\r\n' +
    '    makedirs(head, mode, exist_ok)\r\n' +
    '  [Previous line repeated 3 more times]\r\n' +
    '  File "c:\\Users\\Ludwig Hagelstein\\.conda\\envs\\ERSSA\\lib\\os.py", line 220, in makedirs\r\n' +
    '    mkdir(name, mode)\r\n' +
    `OSError: [WinError 123] Die Syntax für den Dateinamen, Verzeichnisnamen oder die Datenträgerbezeichnung ist falsch: '"c:'\r\n`
}
info 9:21:53.702: Process Execution: > ~\.conda\envs\ERSSA\python.exe -c "import ipykernel"
> ~\.conda\envs\ERSSA\python.exe -c "import ipykernel"
luidwig
  • 11
  • 3

3 Answers3

2

Having same error, very frustrated to not be able to use arcpy in VSCode Jupyter Notebook. Solution above did the trick! Make sure arcgispro-py3-clone environment is selected:

pip uninstall ipykernel 
python -m pip install ipykernel
eKerney
  • 21
  • 2
0

Recently, jupyter is repairing .env related problems.

You can try to install vscode insiders and install pre-release version of jupyter extension.

enter image description here

MingJie-MSFT
  • 5,569
  • 1
  • 2
  • 13
0

it happened to me, I try to uninstall ipykernel via pip uninstall ipykernel, open vscode, then install ipykernel via a popup in vscode when running notebook file, and it worked again