ModuleNotFoundError: No module named 'vega_datasets'

Hi! I’m trying to deploy an app on https://share.streamlit.io/, but getting the following error:
ModuleNotFoundError: No module named 'vega_datasets'

apparently vega_datasets library is not available? Is there a way to get the script running on the platform anyway?

1 Like

Hi @mariapaskevich, and welcome to the Streamlit community! :balloon::raised_hands:

Have you tried to import these vega datasets into your script via:

from vega_datasets import data

Thanks,
Charly

2 Likes

@mariapaskevich You need to include a requirements.txt file in your repo containing the Python dependencies of your app :slightly_smiling_face:

Python dependencies are packages imported within the app that aren’t part of the Python Standard Library.

To resolve the error, upload a requirements.txt file to your repo containing the following lines:

vega_datasets==0.9.0
pandas==1.2.5
streamlit==0.86.0
altair==4.1.0

Doing so will install the :point_up: dependencies before your app is run.

Going forward, you can also automatically generate a requirements file for your app using pipreqs. To do so, open a terminal and pass the path of your app to pipreqs. For example:

pipreqs /path/to/Tokyo2020/

Happy Streamilt’ing! :balloon:
Snehan

1 Like

Good call @snehankekre! Thanks for the addition. :pray:

Charly

Thank you! it worked :+1:

1 Like