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.

VS Code Jupyter integration does not consider custom LD_LIBRARY_PATH

See original GitHub issue

I recently setup a fresh EC2 instance for development running Amazon Linux 2. To run the recent version of prefect (https://orion-docs.prefect.io/) I had to install an up to date version of SQLite3, which I compiled from source. I then set the LD_LIBRARY_PATH environmental variable to “/usr/local/lib”, and installed python 3.10.5 with the LDFLAGS and CPPFLAGS compiler arguments to include that folder as well, so that the new sqlite libraries are found by python. All good so far, when running the jupyter notebook server or the prefect orion server from the terminal everything works fine. If I want to use the integrated jupyter environment from VS Code I run into the issue that the kernel does not start:

Failed to start the Kernel.

ImportError: /home/mickelj/.pyenv/versions/3.10.5/lib/python3.10/lib-dynload/_sqlite3.cpython-310-x86_64-linux-gnu.so: undefined symbol: sqlite3_trace_v2.

This leads me to believe that the system sqlite library is used, as this is the same error I get when I unset the LD_LIBRARY_PATH env variable. However when calling ldd /home/mickelj/.pyenv/versions/3.10.5/lib/python3.10/lib-dynload/_sqlite3.cpython-310-x86_64-linux-gnu.so I am getting the following:

linux-vdso.so.1 (0x00007ffcde9c8000) libsqlite3.so.0 => /usr/local/lib/libsqlite3.so.0 (0x00007f96a3339000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f96a311b000) libc.so.6 => /lib64/libc.so.6 (0x00007f96a2d6e000) libz.so.1 => /lib64/libz.so.1 (0x00007f96a2b59000) libm.so.6 => /lib64/libm.so.6 (0x00007f96a2819000) libdl.so.2 => /lib64/libdl.so.2 (0x00007f96a2615000) /lib64/ld-linux-x86-64.so.2 (0x00007f96a3870000)

Where the new sqlite3 library is correctly referenced. If I unset the LD_LIBRARY_PATH variable the second line changes to:

libsqlite3.so.0 => /lib64/libsqlite3.so.0 (0x00007f9dce52e000)

So my guess is that the VS Code jupyter integration does not consider environment variables, so my question is: is there a way to specify them (and in particular the LD_LIBRARY_PATH) globally for VS Code or for the built-in jupyter server at runtime or anywhere else to fix this?

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
gchenfccommented, Oct 11, 2022

I had the same issue. I switched to pre-release then killed all vscode processes (pkill -f vscode) and now it works.

I think this might related to needing to “log-out” for changes .profile to update, but I’m not exactly sure what fixed it (pre-release or killing vscode or both) and can’t reproduce.

0reactions
DonJayamannecommented, Oct 9, 2022

Closing this issue as its been over 4 weeks, since the information was requested. We’ll be happy to reopen the issue when the requested information has been provided.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Working with Jupyter Notebooks in Visual Studio Code
Jupyter (formerly IPython Notebook) is an open-source project that lets you easily combine Markdown text and executable Python source code on one canvas...
Read more >
Working with Jupyter code cells in the Python Interactive window
The Visual Studio Code debugger lets you step through your code, set breakpoints, examine state, and analyze problems. Using the debugger is a...
Read more >
Notebooks, Visual Studio Code style
Bringing custom notebook experiences to the Visual Studio Code extension ... The Notebook APIs are not limited to Jupyter Notebooks, ...
Read more >
Settings Reference for Python - Visual Studio Code
Note: Changes to this setting made after an interpreter has been selected for a workspace will not be applied or considered by the...
Read more >
Changing LD_LIBRARY_PATH on Google Colab
I'm trying to compile and run some c++ code on google colab, which depends on the GSL library.
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