Please help! Can't import Pydicom


Hello everyone. I’m trying to use Pydicom and I can’t run it at all in Jupyter Lab from web Jupyterlite. What should I do?

Hi, I believe that Pydicom uses a C implementation of the DICOM library. Because you are using Jupyterlite that is powered by WebAssembly (Wasm), you will need a WebAssembly version of the DICOM library that Pydicom and I think this library isn’t avaiable.

Hi,

You’ve tried to import pydicom before you installed it.

Try:

import piplite
await piplite.install('pydicom')
import pydicom

That worked for me on a JupyterLite instance, just now.

Cheers,

Matthew

As others have pointed out you are using JupyterLite with the pyodide kernel. For future reference, when posting it is advised to note the kernel and this type of information in the original question. If you are going to do what is generally not advised in forums such as these and include an image in your post, don’t cut off this important information that would be in the upper right corner unless you are clearly noting it in the post.

1 Like

I tried this. It works. Thank you :slight_smile:

1 Like