Getting Streamlit running

Hi, streamlit looks great and I’m looking forward to using it but I’m struggling with running it.

I’m running python 3.8
pycharm 2020.2
anaconda 1.9.12

I first tried in pycharm which is what I code in.

I installed by:
settings > python interpreter -> + > searched for streamlit

I installed it without issue. I coded a test streamlit app but when I run it no window appears in my browser. Nothing happens at all.

I tried running “streamlit hello” in the pycharm terminal window

Fatal error in launcher: Unable to create process using ‘“c:\users\user\appdata\local\programs\python\python38-32\python.exe” “C:\Users\user\AppData\Local\Programs\Python\Python38\Scripts\streamlit.exe” hello’: The system cannot
find the file specified.

I then tried running in git bash by using:

“streamlit hello”
Git bash goes to a new line but nothing else happens.

I tried following the instructions on the streamlit website for anaconda.

I set up a new environment for python 3.8, and installed streamlit but it was already installed

When I try “streamlit hello”

I get:

Fatal error in launcher: Unable to create process using ‘“c:\users\user\appdata\local\programs\python\python38-32\python.exe” “C:\Users\user\AppData\Local\Programs\Python\Python38\Scripts\streamlit.exe” hello’: The system cannot find the file specified.

I’m wondering if anyone could help.Thanks

Hi @29f3j092j3f0j, welcome to the Streamlit community!

This sounds like you don’t have Windows on your PATH, or PyCharm can’t find it (I’m not a PyCharm user, so I don’t know that part specifically).

Check out our documentation for a discussion of adding Python to your Windows PATH:

Best,
Randy

Thanks for the reply, I’ve Python38 in the PATH, I can’t understand why its running ‘“c:\users\user\appdata\local\programs\python\python38-32\python.exe”

I’m guessing that it thinks streamlit is in that location even though it doesn’t exist?

Maybe these instructions would help?

Sorry, that response is just from the command prompt. I did pip install, and tried to run streamlit from the command prompt in windows. Shouldn’t be affect by pycharm

I installed python 3.8.6 [Windows x86 executable installer]

pip install streamlit

Got this error

wordcloud 1.8.0 requires matplotlib, which is not installed.

pip install matplotlob

pip install wordcloud

pip install streamlit

Tried:

streamlit hello

And got this error

  File "C:\Users\thisuser\AppData\Local\Programs\Python\Python38-32\lib\ctypes\__init__.py", line 373, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: [WinError 193] %1 is not a valid Win32 application

This is the full error

C:\Users\thisuser>streamlit hello
Traceback (most recent call last):
  File "c:\users\thisuser\appdata\local\programs\python\python38-32\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\users\thisuser\appdata\local\programs\python\python38-32\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\thisuser\AppData\Local\Programs\Python\Python38\Scripts\streamlit.exe\__main__.py", line 4, in <module>
  File "C:\Users\thisuser\AppData\Roaming\Python\Python38\site-packages\streamlit\__init__.py", line 99, in <module>
    from streamlit.delta_generator import DeltaGenerator as _DeltaGenerator
  File "C:\Users\thisuser\AppData\Roaming\Python\Python38\site-packages\streamlit\delta_generator.py", line 40, in <module>
    from streamlit.elements.altair import AltairMixin
  File "C:\Users\thisuser\AppData\Roaming\Python\Python38\site-packages\streamlit\elements\altair.py", line 22, in <module>
    import altair as alt
  File "C:\Users\thisuser\AppData\Roaming\Python\Python38\site-packages\altair\__init__.py", line 4, in <module>
    from .vegalite import *
  File "C:\Users\thisuser\AppData\Roaming\Python\Python38\site-packages\altair\vegalite\__init__.py", line 2, in <module>
    from .v4 import *
  File "C:\Users\thisuser\AppData\Roaming\Python\Python38\site-packages\altair\vegalite\v4\__init__.py", line 2, in <module>
    from .schema import *
  File "C:\Users\thisuser\AppData\Roaming\Python\Python38\site-packages\altair\vegalite\v4\schema\__init__.py", line 2, in <module>
    from .core import *
  File "C:\Users\thisuser\AppData\Roaming\Python\Python38\site-packages\altair\vegalite\v4\schema\core.py", line 4, in <module>
    from altair.utils.schemapi import SchemaBase, Undefined, _subclasses
  File "C:\Users\thisuser\AppData\Roaming\Python\Python38\site-packages\altair\utils\__init__.py", line 1, in <module>
    from .core import (
  File "C:\Users\thisuser\AppData\Roaming\Python\Python38\site-packages\altair\utils\core.py", line 14, in <module>
    import pandas as pd
  File "C:\Users\thisuser\AppData\Roaming\Python\Python38\site-packages\pandas\__init__.py", line 11, in <module>
    __import__(dependency)
  File "C:\Users\thisuser\AppData\Roaming\Python\Python38\site-packages\numpy\__init__.py", line 138, in <module>
    from . import _distributor_init
  File "C:\Users\thisuser\AppData\Roaming\Python\Python38\site-packages\numpy\_distributor_init.py", line 26, in <module>
    WinDLL(os.path.abspath(filename))
  File "c:\users\thisuser\appdata\local\programs\python\python38-32\lib\ctypes\__init__.py", line 373, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: [WinError 193] %1 is not a valid Win32 application

C:\Users\thisuser>streamlit hello
Traceback (most recent call last):
  File "c:\users\thisuser\appdata\local\programs\python\python38-32\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\users\thisuser\appdata\local\programs\python\python38-32\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\thisuser\AppData\Local\Programs\Python\Python38\Scripts\streamlit.exe\__main__.py", line 4, in <module>
  File "C:\Users\thisuser\AppData\Roaming\Python\Python38\site-packages\streamlit\__init__.py", line 99, in <module>
    from streamlit.delta_generator import DeltaGenerator as _DeltaGenerator
  File "C:\Users\thisuser\AppData\Roaming\Python\Python38\site-packages\streamlit\delta_generator.py", line 40, in <module>
    from streamlit.elements.altair import AltairMixin
  File "C:\Users\thisuser\AppData\Roaming\Python\Python38\site-packages\streamlit\elements\altair.py", line 22, in <module>
    import altair as alt
  File "C:\Users\thisuser\AppData\Roaming\Python\Python38\site-packages\altair\__init__.py", line 4, in <module>
    from .vegalite import *
  File "C:\Users\thisuser\AppData\Roaming\Python\Python38\site-packages\altair\vegalite\__init__.py", line 2, in <module>
    from .v4 import *
  File "C:\Users\thisuser\AppData\Roaming\Python\Python38\site-packages\altair\vegalite\v4\__init__.py", line 2, in <module>
    from .schema import *
  File "C:\Users\thisuser\AppData\Roaming\Python\Python38\site-packages\altair\vegalite\v4\schema\__init__.py", line 2, in <module>
    from .core import *
  File "C:\Users\thisuser\AppData\Roaming\Python\Python38\site-packages\altair\vegalite\v4\schema\core.py", line 4, in <module>
    from altair.utils.schemapi import SchemaBase, Undefined, _subclasses
  File "C:\Users\thisuser\AppData\Roaming\Python\Python38\site-packages\altair\utils\__init__.py", line 1, in <module>
    from .core import (
  File "C:\Users\thisuser\AppData\Roaming\Python\Python38\site-packages\altair\utils\core.py", line 14, in <module>
    import pandas as pd
  File "C:\Users\thisuser\AppData\Roaming\Python\Python38\site-packages\pandas\__init__.py", line 11, in <module>
    __import__(dependency)
  File "C:\Users\thisuser\AppData\Roaming\Python\Python38\site-packages\numpy\__init__.py", line 138, in <module>
    from . import _distributor_init
  File "C:\Users\thisuser\AppData\Roaming\Python\Python38\site-packages\numpy\_distributor_init.py", line 26, in <module>
    WinDLL(os.path.abspath(filename))
  File "c:\users\thisuser\appdata\local\programs\python\python38-32\lib\ctypes\__init__.py", line 373, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: [WinError 193] %1 is not a valid Win32 application

C:\Users\thisuser>streamlit run hello
Traceback (most recent call last):
  File "c:\users\thisuser\appdata\local\programs\python\python38-32\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\users\thisuser\appdata\local\programs\python\python38-32\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\thisuser\AppData\Local\Programs\Python\Python38\Scripts\streamlit.exe\__main__.py", line 4, in <module>
  File "C:\Users\thisuser\AppData\Roaming\Python\Python38\site-packages\streamlit\__init__.py", line 99, in <module>
    from streamlit.delta_generator import DeltaGenerator as _DeltaGenerator
  File "C:\Users\thisuser\AppData\Roaming\Python\Python38\site-packages\streamlit\delta_generator.py", line 40, in <module>
    from streamlit.elements.altair import AltairMixin
  File "C:\Users\thisuser\AppData\Roaming\Python\Python38\site-packages\streamlit\elements\altair.py", line 22, in <module>
    import altair as alt
  File "C:\Users\thisuser\AppData\Roaming\Python\Python38\site-packages\altair\__init__.py", line 4, in <module>
    from .vegalite import *
  File "C:\Users\thisuser\AppData\Roaming\Python\Python38\site-packages\altair\vegalite\__init__.py", line 2, in <module>
    from .v4 import *
  File "C:\Users\thisuser\AppData\Roaming\Python\Python38\site-packages\altair\vegalite\v4\__init__.py", line 2, in <module>
    from .schema import *
  File "C:\Users\thisuser\AppData\Roaming\Python\Python38\site-packages\altair\vegalite\v4\schema\__init__.py", line 2, in <module>
    from .core import *
  File "C:\Users\thisuser\AppData\Roaming\Python\Python38\site-packages\altair\vegalite\v4\schema\core.py", line 4, in <module>
    from altair.utils.schemapi import SchemaBase, Undefined, _subclasses
  File "C:\Users\thisuser\AppData\Roaming\Python\Python38\site-packages\altair\utils\__init__.py", line 1, in <module>
    from .core import (
  File "C:\Users\thisuser\AppData\Roaming\Python\Python38\site-packages\altair\utils\core.py", line 14, in <module>
    import pandas as pd
  File "C:\Users\thisuser\AppData\Roaming\Python\Python38\site-packages\pandas\__init__.py", line 11, in <module>
    __import__(dependency)
  File "C:\Users\thisuser\AppData\Roaming\Python\Python38\site-packages\numpy\__init__.py", line 138, in <module>
    from . import _distributor_init
  File "C:\Users\thisuser\AppData\Roaming\Python\Python38\site-packages\numpy\_distributor_init.py", line 26, in <module>
    WinDLL(os.path.abspath(filename))
  File "c:\users\thisuser\appdata\local\programs\python\python38-32\lib\ctypes\__init__.py", line 373, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: [WinError 193] %1 is not a valid Win32 application

C:\Users\thisuser>python -m streamlit hello
Traceback (most recent call last):
  File "C:\Users\thisuser\AppData\Local\Programs\Python\Python38-32\lib\runpy.py", line 185, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "C:\Users\thisuser\AppData\Local\Programs\Python\Python38-32\lib\runpy.py", line 144, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "C:\Users\thisuser\AppData\Local\Programs\Python\Python38-32\lib\runpy.py", line 111, in _get_module_details
    __import__(pkg_name)
  File "C:\Users\thisuser\AppData\Roaming\Python\Python38\site-packages\streamlit\__init__.py", line 99, in <module>
    from streamlit.delta_generator import DeltaGenerator as _DeltaGenerator
  File "C:\Users\thisuser\AppData\Roaming\Python\Python38\site-packages\streamlit\delta_generator.py", line 40, in <module>
    from streamlit.elements.altair import AltairMixin
  File "C:\Users\thisuser\AppData\Roaming\Python\Python38\site-packages\streamlit\elements\altair.py", line 22, in <module>
    import altair as alt
  File "C:\Users\thisuser\AppData\Roaming\Python\Python38\site-packages\altair\__init__.py", line 4, in <module>
    from .vegalite import *
  File "C:\Users\thisuser\AppData\Roaming\Python\Python38\site-packages\altair\vegalite\__init__.py", line 2, in <module>
    from .v4 import *
  File "C:\Users\thisuser\AppData\Roaming\Python\Python38\site-packages\altair\vegalite\v4\__init__.py", line 2, in <module>
    from .schema import *
  File "C:\Users\thisuser\AppData\Roaming\Python\Python38\site-packages\altair\vegalite\v4\schema\__init__.py", line 2, in <module>
    from .core import *
  File "C:\Users\thisuser\AppData\Roaming\Python\Python38\site-packages\altair\vegalite\v4\schema\core.py", line 4, in <module>
    from altair.utils.schemapi import SchemaBase, Undefined, _subclasses
  File "C:\Users\thisuser\AppData\Roaming\Python\Python38\site-packages\altair\utils\__init__.py", line 1, in <module>
    from .core import (
  File "C:\Users\thisuser\AppData\Roaming\Python\Python38\site-packages\altair\utils\core.py", line 14, in <module>
    import pandas as pd
  File "C:\Users\thisuser\AppData\Roaming\Python\Python38\site-packages\pandas\__init__.py", line 11, in <module>
    __import__(dependency)
  File "C:\Users\thisuser\AppData\Roaming\Python\Python38\site-packages\numpy\__init__.py", line 138, in <module>
    from . import _distributor_init
  File "C:\Users\thisuser\AppData\Roaming\Python\Python38\site-packages\numpy\_distributor_init.py", line 26, in <module>
    WinDLL(os.path.abspath(filename))
  File "C:\Users\thisuser\AppData\Local\Programs\Python\Python38-32\lib\ctypes\__init__.py", line 373, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: [WinError 193] %1 is not a valid Win32 application

It feels like you might need to start from the beginning.

When you run where python from the Command Prompt, do you get something like this?

Once you ensure that you are pointing to the correct version of Python, you can then create a virtual environment and run pip install streamlit:

The result will be something like this:

Finally, when you type streamlit hello, you should see the following:

Please run these commands and let us know what you get.

Best,
Randy

1 Like

Thanks very much for going through this with me.

I get an error with "where python"

'where' is not recognized as an internal or external command,
operable program or batch file.

If I type python I get:
Python 3.8.6 (tags/v3.8.6:db45529, Sep 23 2020, 15:37:30) [MSC v.1927 32 bit (Intel)] on win32
Type “help”, “copyright”, “credits” or “license” for more information.

Python 3.8.6 (tags/v3.8.6:db45529, Sep 23 2020, 15:37:30) [MSC v.1927 32 bit (Intel)] on win32

Are you intentionally running 32-bit Python? What version of Windows are you running?

I have 32bit and 64bit installed (python38 and python 38-32)

I’ve windows 10 Pro, 64 bit

You should only be trying to use 64-bit Python with Streamlit. If you get the 32-bit version when you type python at the command prompt, then you have a path issue.

Thanks.

I checked the path and it was set to the 64 bit. I couldn’t understand why I was still getting the 32 in command prompt. So I uninstalled both versions and installed the 3.9 64 bit version and made sure the installer added it to the path.

Python 3.9.0 (tags/v3.9.0:9cf6752, Oct  5 2020, 15:34:40) [MSC v.1927 64 bit (AMD64)] on win32

When I tried to pip install streamlit I got this error:

File "numpy\core\setup.py", line 655, in get_mathlib_info
    raise RuntimeError("Broken toolchain: cannot link a simple C program")
RuntimeError: Broken toolchain: cannot link a simple C program

Googling that suggested it was a mt.exe related error and that I needed to install Windows 10 SDK

Which I’ve done. but I’m still getting the same error

File “numpy\core\setup.py”, line 655, in get_mathlib_info
raise RuntimeError(“Broken toolchain: cannot link a simple C program”)
RuntimeError: Broken toolchain: cannot link a simple C program
----------------------------------------
ERROR: Command errored out with exit status 1: ‘c:\users\user\appdata\local\programs\python\python39\python.exe’ ‘c:\users\user\appdata\local\programs\python\python39\lib\site-packages\pip_vendor\pep517_in_process.py’ prepare_metadata_for_build_wheel ‘C:\Users\user\AppData\Local\Temp\tmpo8euccn3’ Check the logs for full command output.

An issue compiling packages sounds like this issue:

Thanks I installed that and continued to have the same issue.

I installed 3.8.6

I installed numpy and streamlit with that version with no issue.

However I still get this error:
where python 'where' is not recognized as an internal or external command, operable program or batch file.

Just to confirm, in Windows “Enviroment Variables” python should be in PATH under the “User variables”? Not the “System variables”?

I tried running the virtual environment as described in your previous post, and the streamlit hello file ran perfectly.

I’m by no means a Windows expert, but if you can’t run where, it sounds like you’ve got something really messed up on your system:

On a stock Win 10 virtual machine, this is the setup I used to make the instructions in this thread

thanks. I fixed the “where” issue.

I was missing system variables in path

I added:

C:\WINDOWS\system32
C:\WINDOWS
C:\WINDOWS\system32\Wbem

C:\Users\user>where pip
C:\Users\user\pip
C:\Users\user\AppData\Local\Programs\Python\Python38\Scripts\pip.exe
C:\Users\user\AppData\Local\Programs\Python\Python39\Scripts\pip.exe

I’m still running into an issue here though:

C:\Users\user>streamlit hello
Fatal error in launcher: Unable to create process using ‘“c:\users\user\appdata\local\programs\python\python38-32\python.exe” “C:\Users\user\AppData\Local\Programs\Python\Python38\Scripts\streamlit.exe” hello’: The system cannot find the file specified.

Do I have to use a virtual environment?
I’m able to access the hello page running the code you posted.

C:\Users\user>python -m venv streamlitenv

C:\Users\user>cd streamlitenv

C:\Users\user\streamlitenv>.\Scripts\activate

Could I run my own scripts through that method?

You dont have to do it, but it’s a good practice to use a virtual environment for every project. Using virtual environments keeps you from breaking your global environment by installing a package that breaks something else.

At this point, I’m having a hard time following where you are in terms of cleaning up your system, so hopefully you can get this resolved. I’d get started using the virtual environment that works, and hopefully all of this will click in your mind and you’ll figure out the solution.

Good luck!

With conda and windows it is absolutely essential to work in a ‘conda’ console even if you are not using an explicit conda environment. In this case you are using the ‘base’ environmennt. If you start a terminal with cmd.exe, then you need to do:
activate base
first, before you can even open python or do a conda/pip install! Otherwise things likely go south. You should see then the command prompt have a ‘(base)’ tag at the beginning. If you are using vscode with the python extension it should take care of activating the conda environment in the built in terminal.
I also have a mix of conda envs and additional pip installs and it is sometimes very confusing. I would rather avoid conda but there are some heavier packages that dont install for me with pip only on windows (devloper stuff like compilers missing). One more tip: Check out the new Microsoft Terminal app with unlimited consoles in a single window. You can define your own terminal configuration there. I have defined one for jupyter notebooks, activated conda envs and I also launch my streamlit apps from there.

good luck!