question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Python Kernel dies when using ibm_db.connect

See original GitHub issue

Issue Type: Bug

My python kernel dies when I run ibm_db.connect() or ibm_db_dbi.connect() in VS Code Jupyter notebook cells. Here is the console output:

Error 08:48:19: Disposing session as kernel process died ExitCode: undefined, Reason: /usr/local/lib/python3.9/site-packages/traitlets/traitlets.py:2202: FutureWarning: Supporting extra quotes around strings is deprecated in traitlets 5.0. You can use 'hmac-sha256' instead of '"hmac-sha256"' if you require traitlets >=5.
  warn(
/usr/local/lib/python3.9/site-packages/traitlets/traitlets.py:2157: FutureWarning: Supporting extra quotes around Bytes is deprecated in traitlets 5.0. Use 'b13bc39e-6f5f-4a5e-b875-93a86653eb31' instead of 'b"b13bc39e-6f5f-4a5e-b875-93a86653eb31"'.
  warn(

Info 08:48:19: Dispose Kernel process
Error 08:48:19: Raw kernel process exited code: undefined

I cannot reproduce the issue outside of the VS Code Jupyter renderer; the same function runs fine as a python script in VS Code and in a local Jupyterlab environment. In all cases, I’m using the same python environment and packages.

MacOS 12.2.1 Python 3.9.10 python3 -m pip install ipykernel jupyterlab pandas ibm-db

Extension version: 2022.2.1924087327 VS Code version: Code 1.65.2 (c722ca6c7eed3d7987c0d5c3df5c45f6b15e77d1, 2022-03-10T14:33:49.188Z) OS version: Darwin x64 21.3.0 Restricted Mode: No

System Info
Item Value
CPUs Intel® Core™ i9-9980HK CPU @ 2.40GHz (16 x 2400)
GPU Status 2d_canvas: enabled
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: disabled_off_ok
video_decode: enabled
webgl: enabled
webgl2: enabled
Load (avg) 2, 2, 2
Memory (System) 32.00GB (3.73GB free)
Process Argv –crash-reporter-id 91bde56a-ddbf-4e4b-9ab2-5db38b83b07e
Screen Reader no
VM 0%
Extensions (11)
Extension Author (truncated) Version
gather ms- 2022.3.0
python ms- 2022.2.1924087327
vscode-pylance ms- 2022.3.1
jupyter ms- 2022.2.1030672458
jupyter-renderers ms- 1.0.6
remote-containers ms- 0.224.2
remote-ssh ms- 0.76.1
remote-ssh-edit ms- 0.76.1
autodocstring njp 0.6.1
vscode-data-preview Ran 2.3.0
vscodeintellicode Vis 1.2.17
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492cf:30256860
vstes627:30244334
pythonvspyl392:30443607
pythontb:30283811
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
vscorecescf:30445987
pythondataviewer:30285071
vscod805cf:30301675
pythonvspyt200:30340761
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593:30376534
vsc1dst:30438360
pythonvs932:30410667
wslgetstarted:30449410
vsclayoutctrt:30451275
dsvsc008:30440022
pythonvsnew555:30450902
vscscmwlcmt:30438805
vscgsvidc:30447482
cppdebugcf:30451567
pynewfile477cf:30450039

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:28 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
parodaycocommented, Apr 14, 2022

@DonJayamanne I created an .env file in my Projects folder with the DYLD_LIBRARY_PATH hard-coded and ibm_db.connect() now works in VSCode Jupyter. Hallelujah!

I use VS Code all the time since I run many notebooks that do not depend on a Db2 connection. To be honest, I use jaydebeapi on my laptop but wished to use ibm-db since it’s the default connector in our production environment. Now I can edit and run the same notebook code in both places. Thank you so much for you help.

My only feedback is that your documentation could do better at explaining how VS Code reads env variables, since it has very specific limitations and requirements. I originally believed that VS Code was reading my .zshenv file correctly because I see this in my test.ipynb:

!echo $DYLD_LIBRARY_PATH
/usr/local/Cellar/gcc/11.2.0_3/lib/gcc/11:/Applications/dsdriver/lib:

…yet the kernel crashed when I ran ibm_db.connect()

VS Code requires me to store that DYLD_LIBRARY_PATH in an .env file in my VS Code workspace. When I restart VS Code and run !echo $DYLD_LIBRARY_PATH, I see the same output but the kernel no longer crashes.

Any way, thank you again for all your patience and help. I appreciate it immensely.

1reaction
kfchoucommented, Mar 16, 2022

I’m experiencing the same issue when I run dataframe.to_parquet().

error message:

Error 10:32:49: Disposing session as kernel process died ExitCode: undefined, Reason: /home/kfchou/anaconda3/envs/obs-resp/lib/python3.8/site-packages/traitlets/traitlets.py:2202: FutureWarning: Supporting extra quotes around strings is deprecated in traitlets 5.0. You can use 'hmac-sha256' instead of '"hmac-sha256"' if you require traitlets >=5.
  warn(
/home/kfchou/anaconda3/envs/obs-resp/lib/python3.8/site-packages/traitlets/traitlets.py:2157: FutureWarning: Supporting extra quotes around Bytes is deprecated in traitlets 5.0. Use '684fb716-4f0e-4ca1-b66c-fea21b2dfa18' instead of 'b"684fb716-4f0e-4ca1-b66c-fea21b2dfa18"'.
  warn(

Info 10:32:49: Dispose Kernel process

I’m running Ubuntu (WSL) in windows.

Python 3.8.10

VS code info: Version: 1.65.0 (user setup) Commit: b5205cc8eb4fbaa726835538cd82372cc0222d43 Date: 2022-03-02T11:12:08.962Z Electron: 13.5.2 Chromium: 91.0.4472.164 Node.js: 14.16.0 V8: 9.1.269.39-electron.0 OS: Windows_NT x64 10.0.19042

edit: My issue was resolved by using pyarrow rather than fastparquet

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dying Kernel while accessing IBM DB2 database with SQL ...
I'm using a Anaconda Jupyter Notebook. After installing these libraries: !pip install --force-reinstall ibm_db==3.1.0 ibm_db_sa==0.3.3 !pip ...
Read more >
Kernel dies in Jupyter Notebook | Watson Studio
Hi there,I'm using a Python 3.6 kernel in my Jupyter Notebook running on 2 CPUs and 8GB of RAM. At a certain point...
Read more >
How to connect Db2 from Jupyter Notebook? - anjinikumar.com
I recently came across a problem where I needed to connect to a Db2 server with SSL connection from Jupyter Lab. Our environment...
Read more >
raw kernel process exited code: undefined - You.com | The AI ...
I've been using the Interactive window in VSCode to test my code and the ... microsoft/vscode-jupyterPython Kernel dies when using ibm_db.connect#9347.
Read more >
Connecting to DB2 from Jupyter Notebook - DataGeek.blog
Jupyter Notebook is a Python based tool that is often used in data science. It is open source and web-based. The real power...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found