Getting an error "'streamlit' is not recognized as an internal or external command, operable program or batch file."

Hi,

I was trying to build a streamlit app. Performed the following steps:

  1. Activated my own environment using Ananconda prompt
  2. Installed streamlit using pip install streamlit
  3. Once installation is done, typed following command: streamlit hello
  4. Got the error “‘streamlit’ is not recognized as an internal or external command,
    operable program or batch file.”

Please help, what exactly am I missing.

2 Likes

Hi @NitinKaushik, sorry to hear you’re having installation issues!

I can’t reproduce your bug on my machine, so can you provide a bit more info so we can help debug?

  1. What operating system are you using? Also what OS version? What Conda version? What Python version?
  2. For steps (1) and (2) you posted above, can you provide the exact sequence of commands you used? For example:
    1. conda create --name myenv
    2. conda activate myenv
    3. pip install streamlit
    4. etc

2 Likes

Hi Thiago,
Following are the details:

  1. I’m using Windows 10 OS, conda version is 4.7.12, Python version is 3.6.9
  2. Here are the sequence of steps:
    –>First I created a fresh environment (say myenv) by going on to the Environment section of Anaconda Navigator
    –> Then I opened the Anaconda prompt and activate the myenv using command activate myenv
    –> Then I typed pip install streamlit
    –> As suggested on your website, I then typed streamlit hello command to validate the installation.
    –> Got the error “‘streamlit’ is not recognized as an internal or external command,
    operable program or batch file.”
1 Like

Hmmm
 I just went through the exact steps above and was able to run Streamlit on a brand new Windows VM.

My guess is Streamlit is blocked from connecting to a TCP port on your machine, but I don’t know Windows enough to know how to unblock it. I’ll keep investigating


1 Like

Facing the same issue as mentioned above.

getting following warning while installation can this be the reason of the issue-

Installing collected packages: base58, validators, blinker, toml, future, streamlit
** WARNING: The script base58.exe is installed in ‘C:\Users\lenovo\AppData\Roaming\Python\Python36\Scripts’ which is not on PATH.**
** Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.**
** WARNING: The scripts futurize.exe and pasteurize.exe are installed in ‘C:\Users\lenovo\AppData\Roaming\Python\Python36\Scripts’ which is not on PATH.**
** Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.**
** WARNING: The script streamlit.exe is installed in ‘C:\Users\lenovo\AppData\Roaming\Python\Python36\Scripts’ which is not on PATH.**
** Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.**
Successfully installed base58-1.0.3 blinker-1.4 future-0.18.0 streamlit-0.48.1 toml-0.10.0 validators-0.14.0

2 Likes

It is like, streamlit doesn’t work on windows machines ?

2 Likes

your system have two python installation one with anaconda and one directly, so when you are pip installing streamlit, it is being installed in the site-package of python 3.6 rather than anaconda’s python interpreter it could be possible if your environment is not properly activated. you can check “pip --version” and it will point out from where this pip is running if it shows the path to python intrepreter from python36 and not from anaconda then the issue is with the python installation you can try to install python from system as anaconda has its own python intrepreter

1 Like

anaconda already runs in a (base) virtualenv so incase you create your own venv
it should show something like this
(base) (myvenv) then it should work

1 Like

Thanks for your response imneonizer. After doing pip --version. I got the response as “pip 19.2.2 from Directory_Path\Anaconda3\lib\site-packages\pip (python 3.6)” so not sure if this is fine.

Also to your second response: When I activate my own environment then I get prefix as (myvenv) and not (base)((myvenv). (base) gets converted into (myenv) only

1 Like

Hey @NitinKaushik , I had the same issue when installing Streamlit, hope this can solve your problem

As you see in the Warning message while installing Streamlit, you need to add that folder to your enviromental path

-You can search on Windows icon in the bottom left environment variables for your account
-on PATH variable click edit
-Click on NEW and add the folder from the warning message with a semicolon in front
-in your case ;C:\Users\lenovo\AppData\Roaming\Python\Python36\Scripts

With this step I was able to run streamlit directly from my Anaconda console.
In case any issue, you can google how to add Python to your Windows PATH, note that Anaconda has a different PATH and you may need to add it as well, can’t confirm

6 Likes

I’m trying to use streamlit on windows. No luck. Get the same error.

Yet when I ‘pip list’ streamlit is there.

1 Like

Hi @Sisekelo_Dlamini,

Welcome to the forum :wave:

Are you getting the same warning during installation as mentioned in this comment? Getting an error "'streamlit' is not recognized as an internal or external command, operable program or batch file."

Did you try the solution mentioned in this comment? Getting an error "'streamlit' is not recognized as an internal or external command, operable program or batch file."

1 Like

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
Hope this works for you


8 Likes

I was getting the same error.
The thing is, it has been installed in pip, but not in conda.
Try verifying with
conda list

Then do this -
pip uninstall streamlit
pip list (you’ll see its not in the list anymore)

Then create a new environment, activate the environment and then
pip install streamlit
streamlit hello

10 Likes

Thanks! That worked for me.

Thanks, This solved my problem

2 Likes

Thanks you it’s resolved my problem

2 Likes

I tried pip list and conda list .An in both of them streamlit is there.
But when I am trying to run my .py file from cmd its saying 'streamlit' is not recognized as an internal or external command, operable program or batch file. but when I am running through anaconda prompt its running very well.
And I did pip --version and it throws this pip 20.2.1 from c:\python38\lib\site-packages\pip (python 3.8).
Dont know why this thing is happening. Any solution guys?
This is for pip :point_down:

This is for conda :point_down:

1 Like

SOLVED

I had this problem tonight on Windows 10. Streamlit was already working great in a different conda environment, so I knew I must have done something wrong creating the new environment.

Following the advice above of checking the pip version I realized that conda was using the default install of python.

Problem found! Not specifying a python version when creating the conda environment causes conda to use the system version.

Solution

Instead of this:

conda create --name streamlit  
pip install streamlit

Try this:

conda create --name streamlit python=3.8
pip install streamlit

Yep, it’s that simple!

I hope this helps you.

6 Likes

Thanks a lot.

1 Like