初始化 superset 数据库时失败,执行superset db upgrade报错:
(superset) [diyizu@diyizu12 ~]$ superset db upgrade
/opt/module/miniconda3/envs/superset/lib/python3.6/site-packages/sqlalchemy_utils/types/encrypted/encrypted_type.py:18: CryptographyDeprecationWarning: Python 3.6 is no longer supported by the Python core team. Therefore, support for it is deprecated in cryptography. The next release of cryptography (40.0) will be the last to support Python 3.6.
import cryptography
Traceback (most recent call last):
File "/opt/module/miniconda3/envs/superset/bin/superset", line 5, in
from superset.cli import superset
File "/opt/module/miniconda3/envs/superset/lib/python3.6/site-packages/superset/init.py", line 21, in
from superset.app import create_app
File "/opt/module/miniconda3/envs/superset/lib/python3.6/site-packages/superset/app.py", line 45, in
from superset.security import SupersetSecurityManager
File "/opt/module/miniconda3/envs/superset/lib/python3.6/site-packages/superset/security/init.py", line 17, in
from superset.security.manager import SupersetSecurityManager # noqa: F401
File "/opt/module/miniconda3/envs/superset/lib/python3.6/site-packages/superset/security/manager.py", line 49, in
from superset.utils.core import DatasourceName, RowLevelSecurityFilterType
File "/opt/module/miniconda3/envs/superset/lib/python3.6/site-packages/superset/utils/core.py", line 70, in
from cryptography.hazmat.backends.openssl.x509 import _Certificate
ModuleNotFoundError: No module named 'cryptography.hazmat.backends.openssl.x509'
ModuleNotFoundError: No module named 'cryptography.hazmat.backends.openssl.x509'
ModuleNotFoundError:没有名为“cryptography.hazmat.backends.openssl.x509”的模块
分析:因为cryptography模块陈旧,
思路:
python -m pip uninstall cryptography
python -m pip install cryptography
这个我也经历过,这是因为cryptography模块陈旧,恢复办法是
python -m pip uninstall cryptography
python -m pip install cryptography
大功告成!望采纳
看日志很关键哈
/opt/module/miniconda3/envs/superset/lib/python3.6/site-packages/sqlalchemy_utils/types/encrypted/encrypted_type.py:18: CryptographyDeprecationWarning: Python 3.6 is no longer supported by the Python core team. Therefore, support for it is deprecated in cryptography. The next release of cryptography (40.0) will be the last to support Python 3.6.
import cryptography
确实是cryptography跟python版本不对应的问题。
安装superset(详细版)
跟着步骤走
https://blog.csdn.net/qq_46020525/article/details/125593865
有几种可能的解决方法:
1.重新安装 cryptography 库,确保安装了正确的版本。
2.尝试使用其他版本的 Python 运行 superset db upgrade 命令,看看是否能正常执行。
3.检查 superset 环境中是否有其他库与 cryptography 冲突,尝试删除冲突的库。