hi,
I am developing my streamlit apps on a windows machine, then deploy on a aws-linux-ami server. I recently upgraded python on aws to 3.9.0.
python3 – version shows 3.9.0.
however if I output the version within the streamlit app using st.write(sys.version_info) I get the formerly installed 3.6.12:
sys.version_info(major=3, minor=6, micro=12, releaselevel=‘final’, serial=0). is there any variable I need to set to force streamlit to use the newes python version? thanks in advance for any help on this.
This is a function of what is installed on the aws-linux-ami. If you want to have a different version of Python, you can install it from python.org, use virtualenv, or use conda to create a specific environment.
It sounds like what’s happening currently is that you’re using the system install of Python in the AMI, which tends to lag the newest version by several months (and sometimes, years).
thanks Randy
I had installed my Python 3.6 and streamlit must have installed in this folder and used therefore Python 3.6 even if I later installed 3.9. It now seems logical. I followed your advice and made a virtual env but now I run in the following problem:
import ctypes
File "/usr/local/lib/python3.9/ctypes/__init__.py", line 8, in <module>
from _ctypes import Union, Structure, Array
ModuleNotFoundError: No module named '_ctypes'
I had this on a windows machine once and fixed it by installing the c libraries. I tried ot do something similar on my linux machine. This is what I used to install Python 3.9, I was under the impression that it would include the steps to install the required c libraries:
yes, since the newest builbuilt version for AMI seems to be 3.6.12, and I needed 3.8 for a sqlite3 feature, I tried to follow instructions how to compile python from source. it seems to work fine, but I still get the _ctypes error. in the meantime I have worked around the sqlite3 feature (printf statement) and am using again version 3.6, for the time being. thanks anyways for looking into this.
I do this on every machine I use, so that I can create a fresh conda environment for each project, which also allows me to install whatever Python version I choose.
Unless you are looking to make changes to base Python, I wouldn’t recommend trying to build it from source. Life is too short for that
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.