Note: installation issues with Python 3.9 and Streamlit

Hi everyone -

We’re starting to selectively see reports about using Python 3.9 with Streamlit with pip, with compiler errors like the following:

We’ve been evaluating this internally and believe the issue is due to issues with pyarrow when installed from PyPI (i.e. via pip). If you must use Python 3.9 right now, you can work around this issue using conda:

conda create -n streamlitpy39 -c conda-forge python=3.9 pyarrow=1.0 -y
conda activate streamlitpy39
pip install streamlit

(streamlitpy39) rzwitch@threadripper:~$ streamlit hello

  Welcome to Streamlit. Check out our demo in your browser.

  Local URL: http://localhost:8501
  Network URL: http://192.168.0.199:8501

  Ready to create your own Python apps super quickly?
  Head over to https://docs.streamlit.io

  May you create awesome apps!

As we continue to explore how to fix this permanently, please feel free to comment below if you have alternative methods for installing streamlit on Python 3.9!

Best,
Randy

2 Likes

I am still getting an issue.
I am using python 3.9 in pycharm from a recent update to 3.8. I am a college student who does not have a lot of experience with python. Thank you so much

Collecting streamlit
  Using cached streamlit-0.71.0-py2.py3-none-any.whl (7.4 MB)
Collecting tornado>=5.0
  Using cached tornado-6.1-cp39-cp39-win_amd64.whl (422 kB)
Collecting enum-compat
  Using cached enum_compat-0.0.3-py3-none-any.whl (1.3 kB)
Collecting altair>=3.2.0
  Using cached altair-4.1.0-py3-none-any.whl (727 kB)
Requirement already satisfied: pandas>=0.21.0 in c:\users\cory vogel\pycharmprojects\streamlit_3.9\lib\site-packages (from streamlit) (1.1.4)
Collecting gitpython
  Using cached GitPython-3.1.11-py3-none-any.whl (159 kB)
Collecting boto3
  Using cached boto3-1.16.25-py2.py3-none-any.whl (129 kB)
Collecting requests
  Using cached requests-2.25.0-py2.py3-none-any.whl (61 kB)
Collecting watchdog
  Using cached watchdog-0.10.4.tar.gz (98 kB)
Collecting pyarrow
  Using cached pyarrow-2.0.0.tar.gz (58.9 MB)
  Installing build dependencies: started
  Installing build dependencies: finished with status 'error'

DEPRECATION: The -b/--build/--build-dir/--build-directory option is deprecated. pip 20.3 will remove support for this functionality. A possible replacement is use the TMPDIR/TEMP/TMP environment variable, possibly combined with --no-clean. You can find discussion regarding this at https://github.com/pypa/pip/issues/8333.
  ERROR: Command errored out with exit status 1:
   command: 'C:\Users\Cory Vogel\PycharmProjects\streamlit_3.9\Scripts\python.exe' 'C:\Users\Cory Vogel\PycharmProjects\streamlit_3.9\lib\site-packages\pip' install --ignore-installed --no-user --prefix 'C:\Users\Cory Vogel\AppData\Local\Temp\pip-build-env-mt29mw50\overlay' --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'cython >= 0.29' 'numpy==1.14.5; python_version<'"'"'3.7'"'"'' 'numpy==1.16.0; python_version>='"'"'3.7'"'"'' setuptools setuptools_scm wheel
       cwd: None
  Complete output (270 lines):
  Ignoring numpy: markers 'python_version < "3.7"' don't match your environment
  Collecting cython>=0.29
    Using cached Cython-0.29.21-py2.py3-none-any.whl (974 kB)
  Collecting numpy==1.16.0
    Using cached numpy-1.16.0.zip (5.1 MB)
  Collecting setuptools
    Using cached setuptools-50.3.2-py3-none-any.whl (785 kB)
  Collecting setuptools_scm
    Using cached setuptools_scm-4.1.2-py2.py3-none-any.whl (27 kB)
  Collecting wheel
    Using cached wheel-0.35.1-py2.py3-none-any.whl (33 kB)
  Using legacy 'setup.py install' for numpy, since package 'wheel' is not installed.
  Installing collected packages: cython, numpy, setuptools, setuptools-scm, wheel
      Running setup.py install for numpy: started
      Running setup.py install for numpy: finished with status 'error'
      ERROR: Command errored out with exit status 1:
       command: 'C:\Users\Cory Vogel\PycharmProjects\streamlit_3.9\Scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Cory Vogel\\AppData\\Local\\Temp\\pip-install-euoon89o\\numpy\\setup.py'"'"'; __file__='"'"'C:\\Users\\Cory Vogel\\AppData\\Local\\Temp\\pip-install-euoon89o\\numpy\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Cory Vogel\AppData\Local\Temp\pip-record-4idnd9td\install-record.txt' --single-version-externally-managed --prefix 'C:\Users\Cory Vogel\AppData\Local\Temp\pip-build-env-mt29mw50\overlay' --compile --install-headers 'C:\Users\Cory Vogel\AppData\Local\Temp\pip-build-env-mt29mw50\overlay\include\site\python3.9\numpy'
           cwd: C:\Users\Cory Vogel\AppData\Local\Temp\pip-install-euoon89o\numpy\
      Complete output (249 lines):
      Running from numpy source directory.
  
      Note: if you need reliable uninstall behavior, then install
      with pip instead of using `setup.py install`:
  
        - `pip install .`       (from a git repo or downloaded source
                                 release)
        - `pip install numpy`   (last NumPy release on PyPi)
  
  
      C:\Users\Cory Vogel\AppData\Local\Temp\pip-install-euoon89o\numpy\numpy\distutils\misc_util.py:476: SyntaxWarning: "is" with a literal. Did you mean "=="?
        return is_string(s) and ('*' in s or '?' is s)
      blas_opt_info:
      blas_mkl_info:
      No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
      customize MSVCCompiler
        libraries mkl_rt not found in ['C:\\Users\\Cory Vogel\\PycharmProjects\\streamlit_3.9\\lib', 'C:\\']
        NOT AVAILABLE
  
      blis_info:
      No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
      customize MSVCCompiler
        libraries blis not found in ['C:\\Users\\Cory Vogel\\PycharmProjects\\streamlit_3.9\\lib', 'C:\\']
        NOT AVAILABLE
  
      openblas_info:
      No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
      customize MSVCCompiler
      No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
      customize MSVCCompiler
        libraries openblas not found in ['C:\\Users\\Cory Vogel\\PycharmProjects\\streamlit_3.9\\lib', 'C:\\']
      get_default_fcompiler: matching types: '['gnu', 'intelv', 'absoft', 'compaqv', 'intelev', 'gnu95', 'g95', 'intelvem', 'intelem', 'flang']'
      customize GnuFCompiler
      Could not locate executable g77
      Could not locate executable f77
      customize IntelVisualFCompiler
      Could not locate executable ifort
      Could not locate executable ifl
      customize AbsoftFCompiler
      Could not locate executable f90
      customize CompaqVisualFCompiler
      Could not locate executable DF
      customize IntelItaniumVisualFCompiler
      Could not locate executable efl
      customize Gnu95FCompiler
      Could not locate executable gfortran
      Could not locate executable f95
      customize G95FCompiler
      Could not locate executable g95
      customize IntelEM64VisualFCompiler
      customize IntelEM64TFCompiler
      Could not locate executable efort
      Could not locate executable efc
      customize PGroupFlangCompiler
      Could not locate executable flang
      don't know how to compile Fortran code on platform 'nt'
        NOT AVAILABLE
  
      atlas_3_10_blas_threads_info:
      Setting PTATLAS=ATLAS
      No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
      customize MSVCCompiler
        libraries tatlas not found in ['C:\\Users\\Cory Vogel\\PycharmProjects\\streamlit_3.9\\lib', 'C:\\']
        NOT AVAILABLE
  
      atlas_3_10_blas_info:
      No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
      customize MSVCCompiler
        libraries satlas not found in ['C:\\Users\\Cory Vogel\\PycharmProjects\\streamlit_3.9\\lib', 'C:\\']
        NOT AVAILABLE
  
      atlas_blas_threads_info:
      Setting PTATLAS=ATLAS
      No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
      customize MSVCCompiler
        libraries ptf77blas,ptcblas,atlas not found in ['C:\\Users\\Cory Vogel\\PycharmProjects\\streamlit_3.9\\lib', 'C:\\']
        NOT AVAILABLE
  
      atlas_blas_info:
      No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
      customize MSVCCompiler
        libraries f77blas,cblas,atlas not found in ['C:\\Users\\Cory Vogel\\PycharmProjects\\streamlit_3.9\\lib', 'C:\\']
        NOT AVAILABLE
  
      accelerate_info:
        NOT AVAILABLE
  
      C:\Users\Cory Vogel\AppData\Local\Temp\pip-install-euoon89o\numpy\numpy\distutils\system_info.py:625: UserWarning:
          Atlas (http://math-atlas.sourceforge.net/) libraries not found.
          Directories to search for the libraries can be specified in the
          numpy/distutils/site.cfg file (section [atlas]) or by setting
          the ATLAS environment variable.
        self.calc_info()
      blas_info:
      No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
      customize MSVCCompiler
        libraries blas not found in ['C:\\Users\\Cory Vogel\\PycharmProjects\\streamlit_3.9\\lib', 'C:\\']
        NOT AVAILABLE
  
      C:\Users\Cory Vogel\AppData\Local\Temp\pip-install-euoon89o\numpy\numpy\distutils\system_info.py:625: UserWarning:
          Blas (http://www.netlib.org/blas/) libraries not found.
          Directories to search for the libraries can be specified in the
          numpy/distutils/site.cfg file (section [blas]) or by setting
          the BLAS environment variable.
        self.calc_info()
      blas_src_info:
        NOT AVAILABLE
  
      C:\Users\Cory Vogel\AppData\Local\Temp\pip-install-euoon89o\numpy\numpy\distutils\system_info.py:625: UserWarning:
          Blas (http://www.netlib.org/blas/) sources not found.
          Directories to search for the sources can be specified in the
          numpy/distutils/site.cfg file (section [blas_src]) or by setting
          the BLAS_SRC environment variable.
        self.calc_info()
        NOT AVAILABLE
  
      'svnversion' is not recognized as an internal or external command,
      operable program or batch file.
      non-existing path in 'numpy\\distutils': 'site.cfg'
      lapack_opt_info:
      lapack_mkl_info:
      No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
      customize MSVCCompiler
        libraries mkl_rt not found in ['C:\\Users\\Cory Vogel\\PycharmProjects\\streamlit_3.9\\lib', 'C:\\']
        NOT AVAILABLE
  
      openblas_lapack_info:
      No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
      customize MSVCCompiler
      No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
      customize MSVCCompiler
        libraries openblas not found in ['C:\\Users\\Cory Vogel\\PycharmProjects\\streamlit_3.9\\lib', 'C:\\']
        NOT AVAILABLE
  
      openblas_clapack_info:
      No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
      customize MSVCCompiler
      No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
      customize MSVCCompiler
        libraries openblas,lapack not found in ['C:\\Users\\Cory Vogel\\PycharmProjects\\streamlit_3.9\\lib', 'C:\\']
        NOT AVAILABLE
  
      atlas_3_10_threads_info:
      Setting PTATLAS=ATLAS
      No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
      customize MSVCCompiler
        libraries lapack_atlas not found in C:\Users\Cory Vogel\PycharmProjects\streamlit_3.9\lib
      No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
      customize MSVCCompiler
        libraries tatlas,tatlas not found in C:\Users\Cory Vogel\PycharmProjects\streamlit_3.9\lib
      No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
      customize MSVCCompiler
        libraries lapack_atlas not found in C:\
      No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
      customize MSVCCompiler
        libraries tatlas,tatlas not found in C:\
      <class 'numpy.distutils.system_info.atlas_3_10_threads_info'>
        NOT AVAILABLE
  
      atlas_3_10_info:
      No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
      customize MSVCCompiler
        libraries lapack_atlas not found in C:\Users\Cory Vogel\PycharmProjects\streamlit_3.9\lib
      No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
      customize MSVCCompiler
        libraries satlas,satlas not found in C:\Users\Cory Vogel\PycharmProjects\streamlit_3.9\lib
      No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
      customize MSVCCompiler
        libraries lapack_atlas not found in C:\
      No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
      customize MSVCCompiler
        libraries satlas,satlas not found in C:\
      <class 'numpy.distutils.system_info.atlas_3_10_info'>
        NOT AVAILABLE
  
      atlas_threads_info:
      Setting PTATLAS=ATLAS
      No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
      customize MSVCCompiler
        libraries lapack_atlas not found in C:\Users\Cory Vogel\PycharmProjects\streamlit_3.9\lib
      No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
      customize MSVCCompiler
        libraries ptf77blas,ptcblas,atlas not found in C:\Users\Cory Vogel\PycharmProjects\streamlit_3.9\lib
      No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
      customize MSVCCompiler
        libraries lapack_atlas not found in C:\
      No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
      customize MSVCCompiler
        libraries ptf77blas,ptcblas,atlas not found in C:\
      <class 'numpy.distutils.system_info.atlas_threads_info'>
        NOT AVAILABLE
  
      atlas_info:
      No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
      customize MSVCCompiler
        libraries lapack_atlas not found in C:\Users\Cory Vogel\PycharmProjects\streamlit_3.9\lib
      No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
      customize MSVCCompiler
        libraries f77blas,cblas,atlas not found in C:\Users\Cory Vogel\PycharmProjects\streamlit_3.9\lib
      No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
      customize MSVCCompiler
        libraries lapack_atlas not found in C:\
      No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
      customize MSVCCompiler
        libraries f77blas,cblas,atlas not found in C:\
      <class 'numpy.distutils.system_info.atlas_info'>
        NOT AVAILABLE
  
      lapack_info:
      No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
      customize MSVCCompiler
        libraries lapack not found in ['C:\\Users\\Cory Vogel\\PycharmProjects\\streamlit_3.9\\lib', 'C:\\']
        NOT AVAILABLE
  
      C:\Users\Cory Vogel\AppData\Local\Temp\pip-install-euoon89o\numpy\numpy\distutils\system_info.py:625: UserWarning:
          Lapack (http://www.netlib.org/lapack/) libraries not found.
          Directories to search for the libraries can be specified in the
          numpy/distutils/site.cfg file (section [lapack]) or by setting
          the LAPACK environment variable.
        self.calc_info()
      lapack_src_info:
        NOT AVAILABLE
  
      C:\Users\Cory Vogel\AppData\Local\Temp\pip-install-euoon89o\numpy\numpy\distutils\system_info.py:625: UserWarning:
          Lapack (http://www.netlib.org/lapack/) sources not found.
          Directories to search for the sources can be specified in the
          numpy/distutils/site.cfg file (section [lapack_src]) or by setting
          the LAPACK_SRC environment variable.
        self.calc_info()
        NOT AVAILABLE
  
      C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.240.0_x64__qbz5n2kfra8p0\lib\distutils\dist.py:274: UserWarning: Unknown distribution option: 'define_macros'
        warnings.warn(msg)
      running install
      running build
      running config_cc
      unifing config_cc, config, build_clib, build_ext, build commands --compiler options
      running config_fc
      unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
      running build_src
      build_src
      building py_modules sources
      creating build
      creating build\src.win-amd64-3.9
      creating build\src.win-amd64-3.9\numpy
      creating build\src.win-amd64-3.9\numpy\distutils
      building library "npymath" sources
      No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
      error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
      ----------------------------------------
  ERROR: Command errored out with exit status 1: 'C:\Users\Cory Vogel\PycharmProjects\streamlit_3.9\Scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Cory Vogel\\AppData\\Local\\Temp\\pip-install-euoon89o\\numpy\\setup.py'"'"'; __file__='"'"'C:\\Users\\Cory Vogel\\AppData\\Local\\Temp\\pip-install-euoon89o\\numpy\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Cory Vogel\AppData\Local\Temp\pip-record-4idnd9td\install-record.txt' --single-version-externally-managed --prefix 'C:\Users\Cory Vogel\AppData\Local\Temp\pip-build-env-mt29mw50\overlay' --compile --install-headers 'C:\Users\Cory Vogel\AppData\Local\Temp\pip-build-env-mt29mw50\overlay\include\site\python3.9\numpy' Check the logs for full command output.
  ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\Cory Vogel\PycharmProjects\streamlit_3.9\Scripts\python.exe' 'C:\Users\Cory Vogel\PycharmProjects\streamlit_3.9\lib\site-packages\pip' install --ignore-installed --no-user --prefix 'C:\Users\Cory Vogel\AppData\Local\Temp\pip-build-env-mt29mw50\overlay' --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'cython >= 0.29' 'numpy==1.14.5; python_version<'"'"'3.7'"'"'' 'numpy==1.16.0; python_version>='"'"'3.7'"'"'' setuptools setuptools_scm wheel Check the logs for full command output.

Hi @Cory_Vogel, welcome to the Streamlit community!

In the error message you are posting:

error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/

Once you install that package however, you are still going to run into the same issue as mentioned above with Python 3.9, until pyarrow fixes its build system. Either use Python 3.8, or you can use conda to install Python:

conda install -c conda-forge streamlit

1 Like

Hi @randyzwitch, Thank you for your quick response. I am sorry that I am such a beginner at this. Where do I download that package to? I reverted back to 3.8.

No need to apologize for being a beginner!

If you’ve already downgraded to Python 3.8, then you can install the Visual CPP Build tools as my previous message shows, and then you should be able to install Streamlit by running pip install streamlit. It’s only Python 3.9 that has an installation issue.

Separately, Windows and Python can have issues, due to packages the pre-compile code. conda is one solution to working around these issues:

Best,
Randy

Here’s the Arrow 3.9 support issue for anyone who wants to track it:

Seems pretty close to resolution, except maybe on Windows.

1 Like

An option for installing pyarrow on Python 3.9 with pip is to run the following:

pip install --extra-index-url https://pypi.fury.io/arrow-nightlies/ --pre pyarrow

This carries the downside of ending up with development release versions. But that may be “okay” for now as a stop gap for some cases.

1 Like