Streamlit deploy problem ImportError of common python packages

When deploying on Streamlit Cloud it failed with the following ImportError. This occurs when import common python packages such as matplotlib, seaborn, scipy, etc. In my local Windows (with Anaconda installations) it runs without issues. Does anyone know how to fix this? Thanks!

  File "/home/appuser/.conda/lib/python3.7/site-packages/matplotlib/transforms.py", line 46, in <module>
    from matplotlib._path import (
ImportError: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by /home/appuser/.conda/lib/python3.7/site-packages/matplotlib/_path.cpython-37m-x86_64-linux-gnu.so)

Link to source code https://github.com/luan-th-nguyen/spatial_kriging

1 Like

Can you try adding a packages.txt file with this line and see if that resolves the issue?

libstdc++6

Did not resolve the issue for me. I wonder if itā€™s something on your end. I suppose I can switch to pip in requirements.txt, but Iā€™d rather stick with conda. Thanks.

@blackary
Hello there sir i am facing issues while deployment of my application, the error is that error while installing requirements.

Kindly sir help me out

@blackary: thanks for the suggestion but it doesnā€™t solve the problem yet.

1 Like

@LuanNguyen Weā€™ve been able to deploy the app here without issues: https://carolinedlu-spatial-kriging-streamlit-app-qmv85d.streamlit.app/

Could you try deleting and redeploying with python 3.9?

@blackary I do not mean to take attention away from @LuanNguyen , but I am chiming in because I am experiencing the same problem. I tried redeploying with 3.9 even before I changed packages.txt, but to no avail. My code is at https://github.com/akurlovs/DiSiR_app . Thanks!

The app is here https://disir-scrna.streamlit.app/

1 Like

@blackary
I have a similar issue. Running the app on my system works fine. But once I deploy it on the cloud, importing seaborn causes the error. Matplotlib works, inlcuding

in my environment.yml does not solve the problem.

Maybe there is an update since this was first posted?

Thank you!

@Amina and @blahblahblah Can you post your code in a public repo where I can see it?

1 Like

Hey @blackary,

I put up a minimal example here.
Please let me know if this is sufficient.

Thank you!

Thanks @Amina! Iā€™ll take a look.

@Amina It seems to be working for me https://sfc-gh-zblackwood-st-app-home-r84x0f.streamlit.app/ ā€“ are you experiencing something different from what that is showing?

@blackary I made the repo public. Thanks.

@blackary
I run into the same problem with: GitHub - IsoldeGlissenaar/example_streamlit

I get errors when trying to use scipy or matplotlib

ImportError: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.29' not found

I could still do with some help! Should I start a new thread?

https://isoldeglissenaar-example-streamlit-home-z66aej.streamlit.app/

See my pull request on github, should work now.

Thanks for helping! I see your solution is using pip install instead of conda. Only problem is that what Iā€™ve shared here is a quick example, but in my actual project Iā€™m using cartopy, which is a bit of a mess to install using pipā€¦ Iā€™ll give it a try but if anyone finds a solution using conda Iā€™ll be happy to hear it!

It should be possible with conda as well as with pip. If you provide me with a real project on github, I can help.

Okay, thanks.

This is the real project:

The page I made (https://isoldeglissenaar-procast-home-m0hdpf.streamlit.app/) looks fine on the homepage because Iā€™m not applying scipy or matplotlib yet. If you click on ā€˜archiveā€™ in the sidebar though it crashes when trying to use matplotlib.

Tried to fix your issues, see my github fork:

However, it still does not work on streamlit cloud. IMHO the problem is not matplotlib or cartopy, it seems to be the format of the data files in the data folder, read by the xarray library. They are probably in a strange or new HDF5 format variant.