File "/home/appuser/venv/lib/python3.9/site-packages/streamlit/scriptrunner/script_runner.py", line 554, in _run_script
exec(code, module.__dict__)
File "View_RawData.py", line 7, in <module>
import snowflake.connector
File "/home/appuser/venv/lib/python3.9/site-packages/snowflake/connector/__init__.py", line 16, in <module>
from .connection import SnowflakeConnection
File "/home/appuser/venv/lib/python3.9/site-packages/snowflake/connector/connection.py", line 53, in <module>
from .cursor import LOG_MAX_QUERY_LENGTH, SnowflakeCursor
File "/home/appuser/venv/lib/python3.9/site-packages/snowflake/connector/cursor.py", line 62, in <module>
from .file_transfer_agent import SnowflakeFileTransferAgent
File "/home/appuser/venv/lib/python3.9/site-packages/snowflake/connector/file_transfer_agent.py", line 21, in <module>
from .azure_storage_client import SnowflakeAzureRestClient
File "/home/appuser/venv/lib/python3.9/site-packages/snowflake/connector/azure_storage_client.py", line 18, in <module>
from .encryption_util import EncryptionMetadata
File "/home/appuser/venv/lib/python3.9/site-packages/snowflake/connector/encryption_util.py", line 15, in <module>
from Cryptodome.Cipher import AES
File "/home/appuser/venv/lib/python3.9/site-packages/Cryptodome/Cipher/__init__.py", line 27, in <module>
from Cryptodome.Cipher._mode_ecb import _create_ecb_cipher
File "/home/appuser/venv/lib/python3.9/site-packages/Cryptodome/Cipher/_mode_ecb.py", line 29, in <module>
from Cryptodome.Util._raw_api import (load_pycryptodome_raw_lib,
File "/home/appuser/venv/lib/python3.9/site-packages/Cryptodome/Util/_raw_api.py", line 81, in <module>
ffi = FFI()
File "/home/appuser/.conda/lib/python3.7/site-packages/cffi/api.py", line 54, in __init__
raise Exception("Version mismatch: this is the 'cffi' package version %s, located in %r. When we import the top-level '_cffi_backend' extension module, we get version %s, located in %r. The two versions should be equal; check your installation." % (
I would guess the solution is to set the Python version explicitly in the advanced settings of Streamlit Cloud to whatever version you were using on Colab so that you don’t have a version mismatch with the Snowflake connector package.
I am facing the same error and i dont see a solution on how to match the versions. Can you share where i can look for advanced settings, i did not find them on streamlit.io. I have also tried multiple versions of snowflake python connector, but of no use. Please help.
Thanks Randy, The information is useful. Unfortunately its not helping. I tried all different versions 3.7, 3.8, 3.9 and 3.10. I have also tried with below code in requirements cffi==1.15.0 did not work, tried cffi==1.15.1 did not work. I still get below error, even after reboot and cache clearing. any other thoughts on what i should try to make it work?
Here is my repo link, if that helps. renuka-tumati/first-streamlit-app (github.com)
File "/home/appuser/.conda/lib/python3.7/site-packages/cffi/api.py", line 54, in __init__
raise Exception("Version mismatch: this is the 'cffi' package version %s, located in %r. When we import the top-level '_cffi_backend' extension module, we get version %s, located in %r. The two versions should be equal; check your installation." % (
Exception: Version mismatch: this is the 'cffi' package version 1.15.0, located in '/home/appuser/.conda/lib/python3.7/site-packages/cffi/api.py'. When we import the top-level '_cffi_backend' extension module, we get version 1.15.1, located in '/home/appuser/venv/lib/python3.9/site-packages/_cffi_backend.cpython-39-x86_64-linux-gnu.so'. The two versions should be equal; check your installation.
From this thread, it looks like users are skipping directly to point 3 which concerns pip install.
Point 2 states:
To install the dependent libraries, run the pip (or pip3 ) command and point to the requirements file for that version of the connector.
For example, suppose the latest Snowflake Connector for Python version is 2.7.9 and you are using Python 3.9. To install the dependent libraries for that version of the connector, run the following command: pip install -r https://raw.githubusercontent.com/snowflakedb/snowflake-connector-python/main/tested_requirements/requirements_39.reqs
Solution
Determine the version of Python you want your app to use and specify the Python version in the Advanced settings modal on Streamlit Cloud
Get the raw URL of the .reqs file for the corresponding version of Python from the Snowflake repo
Add the raw link to the .reqs file in your requirements.txt file and prepend the line with -r
So, if you’re using the default Python 3.9 on Streamlit Cloud
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.