Streamlit problems

I left my application running on the remote server where I am working, when I wanted to review it to make a modification I found the following. I get errors with all the streamlit functions (not only with the one I show), could you give me a solution? I will be deeply grateful.

Hi @Vilma_Denisse , if you could post your code, that would be greatly helpful. Looking at the error, I would assume you’re not importing streamlit properly and you should be doing:
import streamlit as st

Again, I can’t really see the code so I’m just guessing. Posting the code would be extremely helpful.

Hi, thanks for your reply, this is a small part of the code. I didn’t make any modification before I received that error.

import streamlit as st
import time
import pandas as pd
from search.search import buscar
from search.internetSearch import busquedaWeb
# semantic role labeling classification
from src.srl_methods.classification import extract
# predictor
from src.transformer_predictor import predictor
from src.transformer_modules import *
from st_aggrid import GridOptionsBuilder, AgGrid, GridUpdateMode, DataReturnMode

vocab=output_vectorizer.get_vocabulary()
print(vocab)

if 'button_1' not in st.session_state:
    st.session_state.button_1 = False
if 'button_2' not in st.session_state:
    st.session_state.button_2 = False


def cb1():
    st.session_state.button_1 = True
def cb2():
    st.session_state.button_2 = True

# Text to show
file1=open('media/text/home.txt')
file2=open('media/text/tools.txt')
file3=open('media/text/authors.txt')
file4=open('media/text/searchtutorial.txt')
home=file1.read()
tools=file2.read()
authors=file3.read()
search=file4.read()
# Examples to make predictions
sentences=pd.read_csv('io/input/inputs.csv',header=0)

######################################################
################## PAGE SETTINGS #####################
######################################################
st.set_page_config(page_title="KICoDi",
                   page_icon=":book:",
                   layout="wide",
                   initial_sidebar_state="auto"
)
st.header('KICoDi')

Is it possible to ssh into your remote server and run
streamlit --version
in the terminal? I am suspecting that this could also be the issue where you don’t have it installed?

The version is
Streamlit, version 1.12.2
I have it installed.

Hm… that’s incredibly odd. This has to probably deal with some environment problem and it’s hard to tell without having access to the machine. What I would recommend doing is maybe reinstalling streamlit. Did you possibly upgrade recently?

After seeing the error, I updated Streamlit. Should I uninstall and reinstall it?

Hi @Vilma_Denisse , sorry for the late response. I was busy with some other things! As for the error, I think uninstalling and reinstalling could be a good idea. Have you done that yet?

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