ModuleNotFoundError: for lottie file inclusion

Summary

I am getting this error when I am trying to deploy my ML model on streamlit however it runs perfectly normal on my local host. It seems to be some issue with the lottie file.

I have included a requirements.txt file but still am getting issues to deploy.

Hey @sk_29,

Thanks for sharing your question! Could you please update your post to include the link to your GitHub repo and the link to your deployed app?

hi ! can you describe how your are importing lottlie files? in JSON format form path or fetching it form URL
if you are using JSON input the method needs path to be defined

from streamlit_lottie import st_lottie
with open("tree-in-the-wind.json", "r") as f:
    data = json.load(f)
st_lottie(data)

it may cause dude to directory error in lottlie file import at streamlit cloud, at your requirement.txt might be missing with dependency of lottlie to import which makes lottlie work.

as per st_lottlie it depends on this few import includes

 pip install setuptools wheel twine

this help lottlie to build setup it imports.
as if could you please update your post ? with your github repo or deploy link !

Hey thanks for replying !
Here is the link to my github repo-
SrishtiKaranth/Breast_Cancer_Classification_with_Streamlit: Deployed on Streamlit. (github.com)

Hey thanks for replying!
This is my lottie file inclusion code->
def load_lottiefile(filepath:str):
with open(filepath,β€œr”) as f:
return json.load(f)
lottie_coding=load_lottiefile(β€œC:\Users\srish\Desktop\ML Projects\Breast Cancer Detection\animation_ln4fa54w.json”)
st_lottie(
lottie_coding,
speed=1,
reverse=False,
loop=True,
quality=β€œhigh”,
# renderer=β€œsvg”,
height=β€œ200px”,
width=β€œ300px”,
key=None,
)
I have commented my github repo link above, in case you have time please do check it out
thank you :))

Streamlit (breastcancerclassificationwithapp-7vechqte88fdsz9numhayq.streamlit.app)

You forgot to install streamlit-lottie.

That is not a file path, it is an http url. You cannot use open with it.

See the usage section in github to learn how to load animations from urls.

hello yes, i unfortunately overlooked this url part.
i changed my code. its working well. thanks @inline-arc
i edited my code following your reply.
all issues have been resolved.
thank you to everyone who replied to this thread. :+1:

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.