Skip to content

Can not use local ipykernel #1528

Open
Open
@lfriedri

Description

@lfriedri

Description

I want to setup an ipykernel in my own process and then use jupyter server to provide this kernel to VS code. However, the jupyter server does not recognize the running ipykernel, even though, I use allow_external_kernels=True and give the directory with the existing kernel connection file with external_connection_dir.

Reproduce

  1. Start ipykernel with the following code:
    from ipykernel import kernelapp app = kernelapp.IPKernelApp.instance() app.initialize() app.start()
  2. Commandline gives the name of the kernel connection file (kernel-34228.json)
  3. Confirm that kernel connection file exists in C:\portable_programs\winpython3.12\settings\runtime
  4. Confirm that ipykernel is available by running
    jupyter console --existing kernel-34228.json
  5. Start jupyter server by
    jupyter server --ServerApp.allow_external_kernels=True --ServerApp.external_connection_dir=C:\portable_programs\winpython3.12\settings\runtime
  6. Connect to jupyter server with VS code jupyter extension
  7. jupyter server console reports the starting of a new kernel, which can also be seen in the runtime directory.

Expected behavior

jupyter server recognizes the running ipykernel and provides option to connect to it, instead of starting a new kernel.

Context

  • Operating System and version: Windows 11
  • Jupyter Server version: jupyter_server==2.16.0
  • ipykernel==6.29.5
  • python 3.12
  • VS code version 1.100.2
  • VS code jupyter extension version 2025.5.0
Troubleshoot Output
C:\portable_programs\winpython3.12\scripts>jupyter troubleshoot
$PATH:
        C:\portable_programs\winpython3.12\python-3.12.0.amd64\Lib\site-packages\PyQt5
        C:\portable_programs\winpython3.12\python-3.12.0.amd64\Lib\site-packages\PySide2
        C:\portable_programs\winpython3.12\python-3.12.0.amd64\
        C:\portable_programs\winpython3.12\python-3.12.0.amd64\DLLs
        C:\portable_programs\winpython3.12\python-3.12.0.amd64\Scripts
        C:\portable_programs\winpython3.12\python-3.12.0.amd64\..\t
        C:\portable_programs\winpython3.12\python-3.12.0.amd64\..\t\Julia\bin
        C:\portable_programs\winpython3.12\python-3.12.0.amd64\..\n
        C:\WINDOWS\system32
        C:\WINDOWS
        C:\WINDOWS\System32\Wbem
        C:\WINDOWS\System32\WindowsPowerShell\v1.0\
        C:\WINDOWS\System32\OpenSSH\
        C:\Program Files (x86)\Symantec\VIP Access Client\
        C:\Program Files (x86)\Plantronics\Spokes3G\
        C:\Program Files\Git\cmd
        C:\Program Files\dotnet\
        C:\Program Files\nodejs\
        C:\Program Files\TortoiseHg\
        C:\Users\lars friedrich\AppData\Local\Microsoft\WindowsApps
        C:\Users\lars friedrich\AppData\Roaming\npm
        C:\Users\lars friedrich\AppData\Local\Programs\MiKTeX\miktex\bin\x64\
        C:\Users\lars friedrich\.dotnet\tools

sys.path:
C:\portable_programs\winpython3.12\python-3.12.0.amd64\Scripts\jupyter-troubleshoot.EXE
C:\local_data\rndthon4all
C:\local_data\rndthon4all\optopy
C:\portable_programs\winpython3.12\python-3.12.0.amd64\python312.zip
C:\portable_programs\winpython3.12\python-3.12.0.amd64\DLLs
C:\portable_programs\winpython3.12\python-3.12.0.amd64\Lib
C:\portable_programs\winpython3.12\python-3.12.0.amd64
C:\portable_programs\winpython3.12\python-3.12.0.amd64\Lib\site-packages
C:\portable_programs\winpython3.12\python-3.12.0.amd64\Lib\site-packages\win32
C:\portable_programs\winpython3.12\python-3.12.0.amd64\Lib\site-packages\win32\lib
C:\portable_programs\winpython3.12\python-3.12.0.amd64\Lib\site-packages\Pythonwin

sys.executable:
C:\portable_programs\winpython3.12\python-3.12.0.amd64\python.exe

sys.version:
3.12.0 (tags/v3.12.0:0fb18b0, Oct 2 2023, 13:03:39) [MSC v.1935 64 bit (AMD64)]

platform.platform():
Windows-11-10.0.26100-SP0

where jupyter:
C:\portable_programs\winpython3.12\python-3.12.0.amd64\Scripts\jupyter.exe

pip list:
Package Version
------------------------- --------------
absl-py 2.2.0
aiofiles 24.1.0
aiohappyeyeballs 2.4.6
aiohttp 3.11.12
aiosignal 1.3.2
annotated-types 0.7.0
anyio 4.8.0
apptools 5.3.0
argon2-cffi 23.1.0
argon2-cffi-bindings 21.2.0
arrow 1.3.0
asttokens 2.4.1
astunparse 1.6.3
async-lru 2.0.5
async-timeout 5.0.1
attrs 24.3.0
Automat 24.8.1
babel 2.17.0
bcrypt 4.2.0
beautifulsoup4 4.13.4
bidict 0.23.1
bleach 6.2.0
blinker 1.9.0
blosc2 2.7.1
cellpose 3.0.8
certifi 2024.12.14
cffi 1.17.1
chardet 5.2.0
charset-normalizer 3.4.1
click 8.1.7
clr-loader 0.2.6
colorama 0.4.6
comm 0.2.2
comtypes 1.4.7
configobj 5.0.9
constantly 23.10.4
contourpy 1.3.0
cryptography 43.0.1
cycler 0.12.1
dash 2.18.2
dash-core-components 2.0.0
dash-html-components 2.0.0
dash-table 5.0.0
debugpy 1.8.6
decorator 5.1.1
defusedxml 0.7.1
docutils 0.21.2
enum-compat 0.0.3
envisage 7.0.4
et-xmlfile 1.1.0
executing 2.1.0
fastapi 0.115.8
fastjsonschema 2.21.1
fastremap 1.16.1
filelock 3.17.0
fill_voids 2.0.8
fire 0.7.0
Flask 3.0.3
flatbuffers 25.2.10
fonttools 4.54.1
fqdn 1.5.1
frozenlist 1.5.0
fsspec 2025.2.0
gast 0.6.0
google-pasta 0.2.0
grpcio 1.71.0
h11 0.14.0
h5py 3.13.0
httpcore 1.0.7
httptools 0.6.4
httpx 0.28.1
hyperlink 21.0.0
idna 3.10
ifaddr 0.2.0
ignite 1.1.0
imagecodecs 2025.3.30
imageio 2.35.1
importlib_metadata 8.5.0
incremental 24.7.2
ipykernel 6.29.5
ipympl 0.9.6
ipython 8.27.0
ipywidgets 8.1.5
isoduration 20.11.0
itsdangerous 2.2.0
jedi 0.19.1
Jinja2 3.1.5
joblib 1.4.2
json5 0.12.0
jsonpointer 3.0.0
jsonrpc 3.0.1
jsonrpc-base 2.2.0
jsonrpc-websocket 3.1.5
jsonschema 4.23.0
jsonschema-specifications 2024.10.1
jupyter 1.1.1
jupyter_client 8.6.3
jupyter-console 6.6.3
jupyter_core 5.7.2
jupyter-events 0.12.0
jupyter-lsp 2.2.5
jupyter_server 2.16.0
jupyter_server_terminals 0.5.3
jupyterlab 4.4.2
jupyterlab_pygments 0.3.0
jupyterlab_server 2.27.3
jupyterlab_widgets 3.0.13
keras 3.9.0
kiwisolver 1.4.7
lazy_loader 0.4
libclang 18.1.1
llvmlite 0.43.0
LMS-Conveyor 0.3.0
LMS-Fabric 0.9.3
lxml 5.3.0
Markdown 3.7
markdown-it-py 3.0.0
markdown2 2.5.3
MarkupSafe 3.0.2
matplotlib 3.9.2
matplotlib-inline 0.1.7
mayavi 4.8.2
mdurl 0.1.2
mistune 3.1.3
ml_dtypes 0.5.1
monai 1.4.0
mpld3 0.5.10
mpmath 1.3.0
msgpack 1.1.0
msvc-runtime 14.36.32532
multidict 6.1.0
namex 0.0.8
natsort 8.4.0
nbclient 0.10.2
nbconvert 7.16.6
nbformat 5.10.4
ndindex 1.9.1
nest-asyncio 1.6.0
networkx 3.3
nicegui 2.11.1
notebook 7.4.2
notebook_shim 0.2.4
numba 0.60.0
numexpr 2.10.1
numpy 1.26.1
opencv-python 4.10.0.84
opencv-python-headless 4.11.0.86
openpyxl 3.1.5
opt_einsum 3.4.0
optree 0.14.1
orjson 3.10.15
overrides 7.7.0
packaging 25.0
pandas 2.2.3
pandocfilters 1.5.1
paramiko 3.5.0
parso 0.8.4
pillow 10.2.0
pip 24.2
platformdirs 4.3.6
plotly 5.24.1
prometheus_client 0.22.0
prompt_toolkit 3.0.47
propcache 0.2.1
protobuf 5.29.4
pscript 0.7.7
psutil 6.0.0
pure_eval 0.2.3
py-cpuinfo 9.0.0
pyasn1 0.6.1
pyasn1_modules 0.4.1
pycparser 2.22
pydantic 2.9.2
pydantic_core 2.23.4
pyface 8.0.0
Pygments 2.18.0
pylablib-lightweight 1.4.3
PyMuPDF 1.24.10
PyMuPDFb 1.24.10
PyNaCl 1.5.0
PyOpenGL 3.1.7
pyOpenSSL 25.0.0
pyparsing 3.1.4
pyperclip 1.8.2
pypiwin32 223
pyserial 3.5
python-dateutil 2.9.0.post0
python-dotenv 1.0.1
python-engineio 4.11.2
python-json-logger 3.3.0
python-multipart 0.0.20
python-socketio 5.12.1
pythonnet 3.0.4
pytorch-ignite 0.5.2
pytz 2024.2
pyueye 4.96.952
PyVISA 1.14.1
pywin32 306
pywinpty 2.0.15
PyYAML 6.0.2
pyzmq 26.2.0
referencing 0.35.1
requests 2.32.3
retrying 1.3.4
rfc3339-validator 0.1.4
rfc3986-validator 0.1.1
rich 13.9.4
roifile 2025.5.10
rpds-py 0.22.3
scikit-image 0.25.2
scikit-learn 1.5.2
scipy 1.14.1
scour 0.38.2
seaborn 0.13.2
segment-anything 1.0
Send2Trash 1.8.3
service-identity 24.2.0
setuptools 68.2.2
simple-websocket 1.1.0
six 1.16.0
sniffio 1.3.1
soupsieve 2.7
sqlite-bro 0.12.2
stack-data 0.6.3
starlette 0.45.3
sympy 1.14.0
tables 3.10.1
tenacity 9.0.0
tensorboard 2.19.0
tensorboard-data-server 0.7.2
tensorflow 2.19.0
tensorflow-hub 0.12.0
tensorflowjs 3.18.0
termcolor 2.5.0
terminado 0.18.1
tfjs-graph-converter 1.6.3
threadpoolctl 3.5.0
tifffile 2024.9.20
tinycss2 1.4.0
torch 2.7.1
torchvision 0.22.1
tornado 6.4.1
tqdm 4.66.5
traitlets 5.14.3
traits 7.0.2
traitsui 8.0.0
Twisted 24.11.0
types-python-dateutil 2.9.0.20250516
typing_extensions 4.12.2
tzdata 2024.2
umap 0.1.1
uri-template 1.3.0
urllib3 2.3.0
uvicorn 0.34.0
vbuild 0.8.2
vtk 9.3.0
watchfiles 1.0.4
wcwidth 0.2.13
webcolors 24.11.1
webencodings 0.5.1
websocket-client 1.8.0
websockets 15.0
Werkzeug 3.0.6
wheel 0.40.0
widgetsnbextension 4.0.13
winpython 7.0.20231126
wrapt 1.17.2
wsproto 1.2.0
wxPython 4.2.1
yarl 1.18.3
zipp 3.21.0
zope.interface 7.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions