Initializing the superset database error

miniconda change source

Create a virtual environment error

Solution:
1. vim ~/.condarc
2. Replace the contents with

channels:
  - defaults
show_channel_urls: true
channel_alias: https://mirrors.tuna.tsinghua.edu.cn/anaconda
default_channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
  conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud

See the blog: Solve the problem that Conda cannot connect to the network_”connectionerror(readtimeouterror(“httpsconnectio_ncst’s blog-CSDN Blog

After adding the above content, both the download and the creation environment are very fast. You can add a wave without thinking.

If you are installing a third-party library, you should no longer need to specify the replacement source, but it is best to add the replacement source

Such as: -i https://mirrors.aliyun.com/pypi/simple/

It is worth recommending Alibaba Cloud. I feel that the speed is not bad, and it is okay to replace it with other ones.

Encountered error 1

solve:
Check if the markupsafe library is properly installed in your environment.
Check whether the markupsafe package exists
pip show markupsafe
Download markupsafe version 2.0.1 (pip will help us uninstall the previous version and download markupsafe version 2.0.1)
pip install markupsafe==2.0.1

Encountered error 2,

Solution:
pip install importlib-metadata==4.13.0

But still unable to initialize the superset database

Encountered error 3,

This error is usually caused by an outdated version of Python, since TypedDict was introduced in Python 3.8.
This problem occurs if you are using Python 3.7 or earlier.
To solve this problem, you can upgrade the Python version to 3.8 or higher. In addition, you can also use the third-party library typing_extensions to achieve similar functions. (The third-party library I use here still doesn’t work, I chose to update the python version)

The steps are still to create the conda environment as before.

Encountered error 4,

Solution:
pip install sqlparse==0.4.3

Encountered error 5,

Solution:

Enter the envs/superset/lib/python3.8/ directory under the installation path of miniconda3
cd /opt/module/miniconda3/envs/superset/lib/python3.8/
Add configuration file: vim superset_config.py
Add the following:

# Superset specific config
# SS related configuration
# The number of lines is limited to 5000 lines
ROW_LIMIT = 5000
 
# Web server port 8088
SUPERSET_WEBSERVER_PORT = 8088
 
# Flask App Builder configuration
# Your App secret key will be used for securely signing the session cookie
# and encrypting sensitive information on the database
# Make sure you are changing this key for your deployment with a strong key.
# You can generate a strong key using `openssl rand -base64 42`
# Flask application builder configuration
# The application key is used to protect the security signature of the session cookie
# And used to encrypt sensitive information in the database
# Make sure to choose a strong key in your deployment environment
# You can use the command openssl rand -base64 42 to generate a strong key
 
SECRET_KEY = "ZT2uRVAMPKpVkHM/QA1QiQlMuUgAi7LLo160AHA99aihEjp03m1HR6Kg"
 
# The SQLAlchemy connection string to your database backend
# This connection defines the path to the database that stores your
# superset metadata (slices, connections, tables, dashboards, ...).
# Note that the connection information to connect to the datasources
# you want to explore are managed directly in the web UI
# SQLAlchemy database connection information
# This connection info defines the path to the SS metabase (slices, joins, tables, datapanels, etc.)
# Note: The data source connections and database connections that need to be explored are managed directly through the web interface
#SQLALCHEMY_DATABASE_URI = 'sqlite:path/to/superset.db'
 
# Flask-WTF flag for CSRF
# Cross domain request attack flag
WTF_CSRF_ENABLED = True
 
# Add endpoints that need to be exempt from CSRF protection
# CSRF whitelist
WTF_CSRF_EXEMPT_LIST = []
 
# A CSRF token that expires in 1 year
# CSFR token expiration time 1 year
WTF_CSRF_TIME_LIMIT = 60*60*24*365
 
# Set this API key to enable Mapbox visualizations
# Interface key used to enable Mapbox visualization
MAPBOX_API_KEY = ''

Encountered error 6,

File “/opt/module/miniconda3/envs/superset/lib/python3.8/site-packages/superset/databases/schemas.py”, line 28, in
from marshmallow_enum import EnumField
ModuleNotFoundError: No module named ‘marshmallow_enum’

Solution:
pip install marshmallow_enum

Finally, the initialization of the superset database is successful.

Reference blog: superset db upgrade error record_sheygshsi’s Blog-CSDN Blog

I also followed the method of this blogger, and solved various errors one by one. It is very effective and worth referring to.

Summary

The above are the problems encountered in installing superset and creating a conda environment. The above methods have been successfully solved for me.

If you want to know more, just read the blog I pointed out, these are very detailed and easy to operate.

The above are the problems and solutions I encountered during the learning process. They may not be helpful to your problems, but they can be used as a reference for you. If there is any similarity, please contact! ! !