部署Superset BI(六)Superset 的主机安装
前面试水了使用docker安装Superset,但是连接数据库的时候,虽然sqlserver安装了驱动,但是数据库类型并没有出现在选择列表中,oracle更是连驱动安装都成问题,看网上别人主机安装轻飘飘就完成了,就继续试试本地化安装是否没有这个问题。
一.安装ubuntu20.4
二.环境准备
--安装必要的组件
admin@supersetbi:~$ sudo apt-get install build-essential libssl-dev libffi-dev python3-dev python3-pip libsasl2-dev libldap2-dev default-libmysqlclient-dev
--创建虚拟环境
admin@supersetbi:~$ pip install virtualenv
admin@supersetbi:~$ python3 -m venv venv
The virtual environment was not created successfully because ensurepip is not
available. On Debian/Ubuntu systems, you need to install the python3-venv
package using the following command.
apt install python3.8-venv
You may need to use sudo with that command. After installing the python3-venv
package, recreate your virtual environment.
Failing command: ['/home/admin/venv/bin/python3', '-Im', 'ensurepip', '--upgrade', '--default-pip']
admin@supersetbi:~$ apt install python3.8-venv
E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?
admin@supersetbi:~$ sudo apt install python3.8-venv
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
python3.8-venv
0 upgraded, 1 newly installed, 0 to remove and 57 not upgraded.
Need to get 5,448 B of archives.
After this operation, 27.6 kB of additional disk space will be used.
Get:1 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/universe amd64 python3.8-venv amd64 3.8.10-0ubuntu1~20.04.18 [5,448 B]
Fetched 5,448 B in 0s (29.9 kB/s)
Selecting previously unselected package python3.8-venv.
(Reading database ... 77983 files and directories currently installed.)
Preparing to unpack .../python3.8-venv_3.8.10-0ubuntu1~20.04.18_amd64.deb ...
Unpacking python3.8-venv (3.8.10-0ubuntu1~20.04.18) ...
Setting up python3.8-venv (3.8.10-0ubuntu1~20.04.18) ...
admin@supersetbi:~$ python3 -m venv venv
--激活虚拟环境
admin@supersetbi:~$ . venv/bin/activate
三.第一次尝试安装superset,失败
(venv) admin@supersetbi:~$ pip install apache_superset
遇到错误
Building wheels for collected packages: apache-superset, func-timeout, pgsanity, admin, wtforms-json, pymeeus
Building wheel for apache-superset (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /home/admin/venv/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-dtml50dj/apache-superset/setup.py'"'"'; __file__='"'"'/tmp/pip-install-dtml50dj/apache-superset/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-7ilnt9rb
cwd: /tmp/pip-install-dtml50dj/apache-superset/
Complete output (11 lines):
fatal: not a git repository (or any of the parent directories): .git
-==--==--==--==--==--==--==--==--==--==--==--==--==--==--==-
VERSION: 2.1.3
GIT SHA:
-==--==--==--==--==--==--==--==--==--==--==--==--==--==--==-
(venv) admin@supersetbi:~$ git status
fatal: not a git repository (or any of the parent directories): .git
(venv) admin@supersetbi:~$ git init
Initialized empty Git repository in /home/admin/.git/
继续安装,pass
(venv) admin@supersetbi:~$ pip install apache_superset
--设置密码
(venv) admin@supersetbi:~$ export SUPERSET_SECRET_KEY=Wodesuperset2025
(venv) admin@supersetbi:~$ export FLASK_APP=superset
--数据库初始化
(venv) admin@supersetbi:~$ superset db upgrade
提示错误:
raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (typing-extensions 4.13.2 (/home/admin/venv/lib/python3.8/site-packages), Requirement.parse('typing-extensions==4.12.2; python_version < "3.10"'), {'kombu'})
pyth
(venv) admin@supersetbi:~$ python --version
Python 3.8.10
admin@supersetbi:~$ . venv/bin/activate
查看网站上版本已经到了4.12,可是pip版本还只有2.1.3
(venv) admin@supersetbi:~$ pip install apache_superset==4.1.2
ERROR: Could not find a version that satisfies the requirement apache_superset==4.1.2 (from versions: 0.34.0, 0.34.1, 0.35.1, 0.35.2, 0.36.0, 0.37.0, 0.37.1, 0.37.2, 0.38.0, 0.38.1, 1.0.0, 1.0.1, 1.1.0, 1.2.0, 1.3.0, 1.3.1, 1.3.2, 1.4.0, 1.4.1, 1.4.2, 1.5.0, 1.5.1, 1.5.2, 1.5.3, 2.0.0, 2.0.1, 2.1.0, 2.1.1rc1, 2.1.1rc2, 2.1.1rc3, 2.1.1, 2.1.2, 2.1.3)
ERROR: No matching distribution found for apache_superset==4.1.2
四.第二次尝试手工安装superset,失败
--下载安装包
(venv) admin@supersetbi:~$ wget https://files.pythonhosted.org/packages/f6/86/a5c2056bcfe7a05eba090212b6f71632ba45832c243a2711403ce4f53acc/apache-superset-4.1.2.tar.gz
apache-superset-4.1.2 apache-superset-4.1.2.tar.gz Python-3.10.14 Python-3.10.14.tgz venv
--安装
(venv) admin@supersetbi:~$ python3 -m pip install apache-superset-4.1.2.tar.gz
Processing ./apache-superset-4.1.2.tar.gz
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... done
ERROR: Package 'apache-superset-4.1.2' requires a different Python: 3.8.10 not in '~=3.9'
(venv) admin@supersetbi:~$
既然python不符合要求,那就升级python
--升级安装Python3.10。
(venv) admin@supersetbi:~$sudo apt update
(venv) admin@supersetbi:~$sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev libsqlite3-dev wget libbz2-dev
VERSION=3.10.14
(venv) admin@supersetbi:~$wget https://www.python.org/ftp/python/$VERSION/Python-$VERSION.tgz
(venv) admin@supersetbi:~$tar -xf Python-$VERSION.tgz</