• 尚硅谷大数据数仓项目superset db upgrade三个报错解答


    ImportError: cannot import name ‘soft_unicode’ from 'markupsafe’和ImportError: cannot import name ‘TypedDict’ from ‘typing’ (/opt/module/miniconda3/envs/superset/lib/python3.7/typing.py)

    尚硅谷大数据数仓项目superset db upgrade有报错

    问题一

    ImportError: cannot import name ‘soft_unicode’ from ‘markupsafe’
    这个错误好像是新版本的markupsafe代码变动问题产生的,需要退回到2.0.1

    python -m pip install markupsafe==2.0.1
    #或者
    pip3 install --force-reinstall MarkupSafe==2.0.1
    
    • 1
    • 2
    • 3

    解决完这个之后我又出现了新的问题

    问题二

    ImportError: cannot import name ‘TypedDict’ from ‘typing’ (/opt/module/miniconda3/envs/superset/lib/python3.7/typing.py)

    这个问题好像是我解决了,看了下源码,因为python3.7 typing.py这个文件缺少TypedDict 这个类型。你创建一个python3.8的环境就行。先删除superset环境。
    要先返回家目录不然有些命令不能执行
    步骤一

     [atguigu@hadoop102 ~]$ 
    
    • 1

    步骤二:卸载原来的superset,

    #因为卸载superset,所以要先退出superset
    (superset) [atguigu@hadoop102 ~]$ conda deactivate
    #执行卸载superset
    [atguigu@hadoop102 ~]$ conda remove -n superset --all
    #卸载完成后按照原来的过程重新安装
    
    • 1
    • 2
    • 3
    • 4
    • 5

    第三步:卸载完成后,安装python3.8

    #创建Python3.8环境,这一步出错返回家目录执行
    [atguigu@hadoop102 ~]$ conda create --name superset python=3.8
    
    • 1
    • 2

    第四步:激活superset环境

    #
     [atguigu@hadoop102 ~]$ conda activate superset
    #安装Superset之前,需安装以下所需依赖
    (superset) [atguigu@hadoop102 ~]$ sudo yum install -y gcc gcc-c++ libffi-devel python-devel python-pip python-wheel python-setuptools openssl-devel cyrus-sasl-devel openldap-devel
    #1)安装(更新)setuptools和pip
    (superset) [atguigu@hadoop102 ~]$ pip install --upgrade setuptools pip -i https://pypi.douban.com/simple/
    #安装Supetset
    (superset) [atguigu@hadoop102 ~]$ pip install apache-superset -i https://pypi.douban.com/simple/
    #创建管理员用户
    (superset) [atguigu@hadoop102 ~]$ export FLASK_APP=superset
    #初始化Supetset数据库
    (superset) [atguigu@hadoop102 ~]$ superset db upgrade
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12

    Usage: superset [OPTIONS] COMMAND [ARGS]… Error: Could not locate a Flask application. You did not provide the “FLASK_APP” environment variable, and a “wsgi.py” or “app.py” module was not found in the current directory.

    出现这种错误是因为没有配置管理员用户
    执行一下这个就好了

    #创建管理员用户
    (superset) [atguigu@hadoop102 ~]$ export FLASK_APP=superset
    
    • 1
    • 2

    期待与梦想的不期而遇 ,嘻嘻… ~~lov-靓仔
    在这里插入图片描述

  • 相关阅读:
    Android热修复1
    【工具】java判断某个时间是否在时间范围区间内
    [unity]多脚本情况下update函数的执行顺序
    php连接mssql数据库的几种方式
    openEuler 22.03 LTS 环境使用 Docker Compose 一键部署 JumpServer (all-in-one 模式)
    Pikachu XSS(跨站脚本攻击)
    python基础(一)、列表的创建和操作
    tcpdump 抓包快速上手
    【Unity3D】UGUI回调函数
    cuda流stream,异步任务的管理
  • 原文地址:https://blog.csdn.net/Ajekseg/article/details/125402150