Error while deploying app the file is present in my repo

Summary

Hey guys i have created a app using streamlit and while deploying it it shows two errors as mention below pls correct the code or tell me what to do to deploy my app smoothly. Ps I am new to this .
The error are mentioned -

File "/home/adminuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 552, in _run_script
    exec(code, module.__dict__)
  File "/mount/src/portfolio/SJ.py", line 2, in <module>
    import streamlit_option_menu as option_menu
ModuleNotFoundError: No module named 'streamlit_option_menu'

Steps to reproduce

Code snippet:

add code here

If applicable, please provide the steps we should take to reproduce the error or specified behavior.

Expected behavior:

Explain what you expect to happen when you run the code above.

Actual behavior:

Explain the undesired behavior or error you see when you run the code above.
If you’re seeing an error message, share the full contents of the error message here.

Debug info

  • Streamlit version: (get it with $ streamlit version)
  • Python version: (get it with $ python --version)
  • Using Conda? PipEnv? PyEnv? Pex?
  • OS version:
  • Browser version:

Requirements file

Using Conda? PipEnv? PyEnv? Pex? Share the contents of your requirements file here.
Not sure what a requirements file is? Check out this doc and add a requirements file to your app.

Links

Additional information

If needed, add any other context about the problem here.

Hey @Parth_Jain,

Thanks for sharing this question! It doesn’t look like there’s a requirements.txt file included in your repo. Looking at your Python file, the contents of your requirements.txt file should look like:

streamlit
streamlit-option-menu
streamlit-lottie

Hi can you brief me or drop the files I need to attach to my repo It would really help me.

I added requirements.txt it still does not work pls can you help me by dropping files or guiding me , You can copy my source code and make the adjustments as per required Thanls.

Looking at your GitHub’s requirements.txt file, that’s not the correct way of listing pip packages. You should only list the packages not the ‘import’ statements and aliases!
So the correct way is:

streamlit
streamlit-option-menu
streamlit-lottie
pandas
matplotlib
seaborn

Put this in your requirements.txt file and it should work.

Hi it deployed some parts of website but now its showing new error. This error I have not seen while building my code so please check it out

File "/home/adminuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 552, in _run_script
    exec(code, module.__dict__)
  File "/mount/src/portfolio/SJ.py", line 28, in <module>
    selected = option_menu(
TypeError: 'module' object is not callable

I think streamlit_option_menu is not supported (or is broke) beacuse it doesn’t seem to identify the option_menu function.
Can you instead just try st.selectbox?

selected = st.selectbox(
    "Select a Section:",
    ['About Me', 'Education and Achievements', 'Goals and Aspiration', 'Contact Page']
)

Thank you so much I was so relieved when this code worked thanks for your support…
Do you have any resources where I can learn more development in this category so do share.
Once again thank you you made my day

Glad it worked for you. Streamlit documentation is the best place to learn - API Reference - Streamlit Docs

That is not how you should use option_menu. See the example in the documentation.

Can you edit my code and write accordingly for it?
My original code -
My code as below
import streamlit as st
import streamlit_option_menu as option_menu
import requests
from streamlit_lottie import st_lottie

st.set_page_config(layout= “wide”)

def load_lottieurl(url):
r = requests.get(url)
if r.status_code != 200:
return None
return r.json()

lottie_coder1 = load_lottieurl(“https://lottie.host/79ed564b-7e14-4a8f-980f-3f592addf735/XmjPS9Ja2t.json”)
lottie_coder2 = load_lottieurl(“https://lottie.host/9ce700d3-8d1f-4c45-b92e-139912b4b12d/sdF8hW5aVU.json”)
lottie_coder3 = load_lottieurl(“https://lottie.host/6b69c3fe-e094-435a-8b5d-affd578c02a2/L3lYYqqt6D.json”)
lottie_coder4 = load_lottieurl(“https://lottie.host/e991dae4-ad0a-41ad-8a31-942d07f75f80/DZoHPPfOCH.json”)

st.write(“##”)
st.subheader(“Hey Guys :wave:”)
st.title(“Welcome to my digital portfolio to uncover my skills, achievements, and potential contributions to your organization.”)
st.write(“”“Feel free to explore my portfolio to witness my dedication to the world of finance and connect with me for exciting job opportunities or to collaborate and expand our knowledge together :smile:
“””)
st.write(“Connect with me for starting new ventures together https://www.linkedin.com/in/stutijain0201”)
st.write(‘—’)

with st.container():
selected = option_menu(
menu_title = None,
options =[‘About Me’,‘Education and Achievements’,‘Goals and Aspiration’, ‘Contact Page’],
icons = [‘person’,‘book’,‘bar-chart’,‘mailbox’],
orientation= ‘horizontal’
)
if selected == ‘About Me’:

with st.container():
    col1, col2 = st.columns(2)
    with col1:
        st.write("##")
        st.subheader("Hello :wave:, I'm Stuti Jain, a Bachelor of Business Administration graduate :mortar_board:, and I'm proud to share that I've successfully cleared CFA Level 1 with strong proficiency :medal: and will be appearing for CFA level 2 this winter :snowflake: .")
        st.subheader("Currently, I am thriving in my role as an OPERATIONS ANALYST at JPMorgan Chase & Co.:briefcase:, where my dedication and performance have earned me a Certificate of Excellence:chart_with_upwards_trend:, showcasing my commitment to delivering exceptional results:fist:.")
    with col2:
        st_lottie(lottie_coder1)
st.write("---")

if selected ==“Education and Achievements”:
with st.container():
col3, col4 = st.columns(2)
with col3:
st.subheader(“”"
Education And Achievements
- Delhi Public School Raipur :open_book:
- Class 10th CBSE BOARD
- Grade: 10 CGPA
- Delhi Public School Raipur :open_book:
- Class 12th CBSE BOARD Commerce
- Grade: 93%
- Christ University Bangalore:mortar_board:
- Bachelor of Buisness Administration
- Batch of: 2021
- Grade: 3.8/4 With Distinction:reminder_ribbon:
- OPERATION ANALYST :female-technologist:
- JP MORGAN CHASE AND CO
- (JUL 2021 - PRESENT)
- BUSINESS DEVELOMPENT INTERN :female-technologist:
- Matar
- (Aug 2019 - Sep 2019)
- Sales and Marketing Intern :female-technologist:
- Seal Ripped by Bayside Media
- (Jan 2019 - Feb 2019)
- Team Leader :female-technologist:
- Step Up for India
- (Jul 2018 - Sep 2018))
- Head of Sales and Marketing :female-technologist:
- IndiCrochet India
- (Jul 2017 - Nov 2017)
- Certificate of Scholarship :female-student:
- Christ University for consecutive two years
- (2019-2020-2021)
- Certificate of Merit :female-student:
- Delhi Public School Raipur for consecutive six years
- (2012-2013-2014-2015-2016-2017-2018)
“”“)
with col4:
st_lottie(lottie_coder2)
st.write(”—")

if selected == ‘Goals and Aspiration’:

with st.container():
    col5, col6 = st.columns(2)
    with col5:
        st.write("##")
        st.write("Hello, I'm thrilled to share my goals and aspirations with you. As I embark on this journey, my overarching goal is to continuously learn, grow, and make a meaningful impact in both my personal and professional life. Here are some of my key aspirations. Career Advancement: I aspire to excel in my chosen career path, continuously improving my skills and knowledge. I aim to take on increasingly challenging roles that allow me to contribute to my field and the organizations I work for. Education and Skill Development: Learning is a lifelong endeavor for me. I am committed to expanding my knowledge and honing my skills in areas that are relevant to my interests and career goals. This includes pursuing additional degrees, certifications, and staying up-to-date with industry trends. Leadership: I aspire to be a leader who inspires and empowers others. Whether it's in a professional setting or within my community, I want to contribute to positive change and guide others toward success. Personal Growth: Achieving a healthy work-life balance is essential. I aim to cultivate personal well-being, including physical and mental health, to ensure I can give my best in all aspects of life. Giving Back: It's important to me to give back to society. I want to actively participate in charitable and community service initiatives that make a difference in the lives of those in need.")

    with col6:
        st_lottie(lottie_coder3)
st.write("---")

if selected == ‘Contact Page’:
st.header(“Get in Touch! Via Mail Or Via Linkedin”)
st.write(“stutijain0201@gmail.com”)
st.write(“https://www.linkedin.com/in/stutijain0201”)
st_lottie(lottie_coder4)
st.write(‘—’)

The code in the example:

import streamlit as st
from streamlit_option_menu import option_menu
...

Thanks man my initial code ran errorless. :grinning:

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