ImportError: DLL load failed: The specified module could not be found

when run streamlit, this error shows. Any idea please?

Hi @ssann

Can you provide a little more info?

  • What version of Windows are you using?
  • What version of Python?
  • Are you using any environment managers, like Anaconda?
  • How are you running Streamlit? Like this: streamlit run your_app.py?
  • Does it work when you try streamlit hello?
  • Does anything else print to the terminal? That error message looks incomplete.

Thanks!

Hi
-windows 10
-python 3
-Anaconda yes
-yes streamlit run
-it works but with same error as below

  • ImportError : DLL load failed: The specified module could not be found.

File “c:\users\sarah\anaconda\lib\site-packages\streamlit\ScriptRunner.py”, line 310, in _run_script exec(code, module.dict)

File “c:\users\sarah\anaconda\lib\site-packages\streamlit\hello\hello.py”, line 110, in run()

File “c:\users\sarah\anaconda\lib\site-packages\streamlit\hello\hello.py”, line 101, in run demo()

File “c:\users\sarah\anaconda\lib\site-packages\streamlit\hello\demos.py”, line 159, in fractal_demo image.image(1.0 - (N / N.max()), use_column_width=True)

File “c:\users\sarah\anaconda\lib\site-packages\streamlit\DeltaGenerator.py”, line 121, in wrapped_method return dg._enqueue_new_element_delta(marshall_element, delta_type, last_index)

File “c:\users\sarah\anaconda\lib\site-packages\streamlit\DeltaGenerator.py”, line 316, in _enqueue_new_element_delta rv = marshall_element(msg.delta.new_element)

File “c:\users\sarah\anaconda\lib\site-packages\streamlit\DeltaGenerator.py”, line 119, in marshall_element return method(dg, element, *args, **kwargs)

File “c:\users\sarah\anaconda\lib\site-packages\streamlit\DeltaGenerator.py”, line 1289, in image import streamlit.elements.image_proto as image_proto

File “c:\users\sarah\anaconda\lib\site-packages\streamlit\elements\image_proto.py”, line 26, in from PIL import Image, ImageFile

File “c:\users\sarah\anaconda\lib\site-packages\PIL\Image.py”, line 64, in from . import _imaging as core

@thiago

@thiago
problem solved…there was some issue with my code

Awesome!

But from your answers above it looks like streamlit hello was failing too, so something else could be going on. Unless that’s somehow fixed now… can you check?

Also, based on the error message it looks like there’s a problem with the PIL installation. So if you’re still seeing that bug, please try the solutions proposed in this Pillow Github issue: https://github.com/python-pillow/Pillow/issues/2945

My guess is this solution will do the trick:

conda install --channel conda-forge pillow=5.2.0 

…which just means: upgrade Pillow to version 5.2.0. On Windows you can use the Anaconda Navigator for this too. See https://docs.anaconda.com/anaconda/navigator/tutorials/manage-packages/#upgrading-a-package

1 Like

@thiago I suddenly started getting a similar error and I can’t run anything, even a streamlit hello.

Below is the message I get:

Traceback (most recent call last):
File “C:\Users\valmirj\AppData\Local\Programs\Python\Python36\lib\runpy.py”, line 193, in run_module_as_main
main”, mod_spec)
File “C:\Users\valmir\AppData\Local\Programs\Python\Python36\lib\runpy.py”, line 85, in run_code
exec(code, run_globals)
File "C:\Users\valmir\OneDrive\CovidTrends\venv\Scripts\streamlit.exe_main
.py", line 5, in
File "c:\users\valmir\onedrive\covidtrends\venv\lib\site-packages\streamlit_init
.py", line 121, in
from streamlit.DeltaGenerator import DeltaGenerator as _DeltaGenerator
File “c:\users\valmir\onedrive\covidtrends\venv\lib\site-packages\streamlit\DeltaGenerator.py”, line 41, in
from streamlit.proto import Alert_pb2
File “c:\users\valmir\onedrive\covidtrends\venv\lib\site-packages\streamlit\proto\Alert_pb2.py”, line 5, in
from google.protobuf import descriptor as _descriptor
File “c:\users\valmir\onedrive\covidtrends\venv\lib\site-packages\google\protobuf\descriptor.py”, line 47, in
from google.protobuf.pyext import _message
ImportError: DLL load failed: The specified procedure could not be found.

Any suggestions what this may be? I was able to run streamlit with no issues a day or two ago, and as far as I can recall I haven’t made any changes to the code or installed packages.

Thanks

Hey @vbucaj,

Based on this last line in your logs…

File “c:\users\valmir\onedrive\covidtrends\venv\lib\site-packages\google\protobuf\descriptor.py”, line 47, in
from google.protobuf.pyext import _message

…my guess is this is an issue with the protobuf package. Can you try reinstalling it?

But first, please let me know what version of the protobuf package you’re using in case we need to change Streamlit’s requirements to avoid that version :slight_smile: . For that, just open a Python console, and then:

>>> import google.protobuf                 
>>> print("BAD VERSION: ", google.protobuf.__version__)

Once you do that, please copy the output into this thread.

Then try installing the latest version:

pip uninstall protobuf
pip install protobuf

If that doesn’t work, try this instead:

pip install protobuf==3.11.2

If any of these work for you, please run this and post on this thread what it says:

>>> import google.protobuf                 
>>> print("GOOD VERSION: ", google.protobuf.__version__)