buddhi kavindra
buddhi kavindra

Reputation: 306

python streamlit run issue

I'm trying to run streamlit application(python 3.7.3) after installing it shows that error

    streamlit hello
  File "<ipython-input-2-c7a1b683aa76>", line 1
    streamlit hello
                  ^
SyntaxError: invalid syntax

Upvotes: 8

Views: 94610

Answers (9)

Mubasharali satti
Mubasharali satti

Reputation: 1

model = joblib.load('xgbpipe.joblib')

when I want to load the model then this will Issues occurs

Connection error Is Streamlit still running? If you accidentally stopped Streamlit, just restart it in your terminal:

streamlit run yourscript.py

Upvotes: 0

Rinesh Patil
Rinesh Patil

Reputation: 1

Create a virtual environment in your folder or repo with this command

$ python -m venv .venv

Activate the venv (virtual evnironment) that you created with

Windows command prompt

$ .venv\Scripts\activate.bat

Windows PowerShell

$ .venv\Scripts\Activate.ps1

macOS and Linux

$ source .venv/bin/activate

Run your Streamlit app using command

$ streamlit run "Name of file".py

If it doesn't work try this:

$ python -m streamlit run "Name of file".py

Upvotes: 0

donDrey
donDrey

Reputation: 41

Try and run it through the command prompt (anaconda prompt). If it tells you that 'streamlit' command cannot be recognised and you are sure you have installed streamlit to your environment, then add Anaconda folder into your Windows path. To do this, go to Advanced System Setting -> Advanced tab -> Environment Variables, under 'System Variables' -> Path -> Edit -> New, then copy the path to your Anaconda folder, e.g 'C:\ProgramData\Anaconda3' and click OK all through. That should work. If it does not, visit https://discuss.streamlit.io

Upvotes: 0

Manas Jadhav
Manas Jadhav

Reputation: 321

python -m streamlit run <filename.py>

This will work definitely.

Upvotes: 31

Haekal Rizky Yulianto
Haekal Rizky Yulianto

Reputation: 26

You can try this one:

streamlit run hello.py

Upvotes: 0

Ankit Kumar
Ankit Kumar

Reputation: 1

I solved it by using the below command

  1. streamlit run filename.py

Upvotes: 0

Kavindu Ravishka
Kavindu Ravishka

Reputation: 819

Actually it looks like you have misunderstood in where you have to use streamlit hello. This command will bring you to the welcome page of streamlit if you have successfully installed streamlit. I assume that you are a beginner. This streamlit hello should be entered in command prompt, But not in the Ipython Kernel. But you have entered this command into the Ipython Kernel. Look at this to learn how to use streamlit hello and how to run a python script with streamlit.

To visit welcome page

$ streamlit hello

To run python script via streamlit

$ streamlit run script.py

Upvotes: 0

Tarun Reddy
Tarun Reddy

Reputation: 2843

Copy streamlit files in C:\Users\AppData\Roaming\Python\Python36\Scripts and paste them into your C:\ProgramData\Anaconda3\Scripts and run your streamlit code in anaconda prompt.

Command to run:

streamlit run filename.py

Upvotes: 2

Azaria Gebremichael
Azaria Gebremichael

Reputation: 772

In windows

py -m streamlit run hello.py

Upvotes: 6

Related Questions