当前位置:网站首页>Superset 1.2.0 installation
Superset 1.2.0 installation
2022-08-08 15:14:00 【Congealing^】
Superset 1.2.0 安装
目录
1、Python3.7.9 安装
1.1、安装编译相关工具
yum -y groupinstall "Development tools"
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
yum install libffi-devel -y
1.2、下载安装包解压
cd #回到用户目录
wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tar.xz
tar -xvJf Python-3.7.0.tar.xz
1.3、编译安装
mkdir /usr/local/python3 #创建编译安装目录
cd Python-3.7.0
./configure --prefix=/usr/local/python3
make && make install
1.4、创建软连接
ln -s /usr/local/python3/bin/python3 /usr/local/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/local/bin/pip3
1.5、验证是否成功
python3 -V
pip3 -V
2、pip 安装Superset
2.1、下载
pip3 install --target=\default package_name==1.2.1
#将库中的pythonModules are used as scripts to run the installationscikit-learn
python3 -m pip install scikit-learn
Uninstall other components with the wrong version,Then separately make compatible version numbers,重新安装
pip3 uninstall Flask
pip3 install Flask===1.9 (这个范围内的<2,>=0.12)
#下载链接:
https://github.com/apache/superset
#进入到supersetExecute the following command directly in the directory
python3 setup.py install
#创建管理员账号
python3 superset fab create-admin
#初始化数据库
superset db upgrade
#加载例子
superset load_examples
#初始化
superset init
#启动superset 指定端口
superset run -h 0.0.0.0 -p 8088 --with-threads --debugger
#后台启动
nohup superset run -h 0.0.0.0 -p 8088 --with-threads --debugger &
2.3、Specifies the source database
#如果使用过的是mysql数据库,在superset的安装目录下,找到config.py文件,修改
SQLALCHEMY_DATABASE_URI = 'mysql://root:[email protected]:3306/superset?charset=UTF8')
#在root处填写mysql的用户名,在passwordFill in the password
2.2、虚拟机安装
#下载Linux依赖
yum install gcc gcc-c++ libffi-devel python-devel python-pip python-wheel openssl-devel cyrus-sasl-devel openldap-devel
#Python 虚拟环境
pip install virtualenv
#创建superset环境(It is best to enter the specified directory and then create it)
python3 -m venv venv
#进入虚拟环境
. venv/bin/activate
#安装superset
pip install apache-superset
pip install apache-superset -i https://pypi.tuna.tsinghua.edu.cn/simple/
#如果下载过慢 可以使用国内镜像
(1)阿里云 http://mirrors.aliyun.com/pypi/simple/
(2)豆瓣http://pypi.douban.com/simple/
(3)清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
(4)中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/
(5)华中科技大学http://pypi.hustunique.com/
#初始化db
superset db upgrade
#创建admin用户
superset fab create-admin
#superset初始化
superset init
#测试启动
superset runserver -d
superset run -p 8088 --with-threads --reload --debugger
#退出虚拟环境
deactivate
#The following are my personal favorites
##需要先安装gunicorn
pip install gunicorn -i https://pypi.douban.com/simple/
#1、进入虚拟环境
. superset/bin/activate
#2、后台启动
gunicorn --workers 10 --timeout 120 --bind 0.0.0.0:8088 "superset.app:create_app()" --daemon
#3、退出虚拟环境
deactivate
#4、停止superset
ps -ef | awk '/superset/ && !/awk/{print $2}' | xargs kill -9
3、报错
3.1、无_bz2问题
切换到python3.7对应路径,将该文件复制到该目录下:
cd /usr/local/lib/python3.7/lib-dynload
sudo cp /usr/lib/python3.6/lib-dynload/_bz2.cpython-36m-x86_64-linux-gnu.so ./
3、修改文件名称,将"-36m"修改为"-37m"即可:
sudo mv _bz2.cpython-36m-x86_64-linux-gnu.so _bz2.cpython-37m-x86_64-linux-gnu.so
3、conda 安装
3.1、安装Miniconda
1、下载 Miniconda(Python3 版本)
下载地址:https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
2)安装 Miniconda
(1)执行以下命令进行安装,并按照提示操作,直到安装完成.
[atguigu@hadoop102 lib]$ bash Miniconda3-latest-Linux-x86_64.sh
ERROR: File or directory already exists: '/root/anaconda3'
bash Anaconda3-5.2.0-Linux-x86_64.sh -u
(2)在安装过程中,出现以下提示时,可以指定安装路径
3)出现以下字样,即为安装完成
3、加载环境变量配置文件,使之生效
[[email protected] lib]$ source ~/.bashrc
4、取消激活 base 环境
Miniconda 安装完成后,每次打开终端都会激活其默认的 base 环境,我们可通过以下命令,禁止激活默认 base 环境.
[[email protected] lib]$ conda config --set auto_activate_base false
3.2、创建python空间
1)配置conda 国内镜像
(base) [atguigu@hadoop102 ~]$ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
(base) [atguigu@hadoop102 ~]$ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
2、创建Python3.7 环境
(base) [[email protected] ~]$ conda create --name superset python=3.7
2.1、conda环境管理常用命令
#创建环境:
conda create -n superset-1.2.0 python=3.7
conda create --prefix=/opt/superset python=3.7
#查看所有环境:
conda info --envs
#删除一个环境:
conda remove -n env_name --all
#激活 superset 环境
conda activate superset
#退出当前环境
conda deactivate
3、激活 superset 环境
(base) [[email protected] ~]$ conda activate superset
激活后效果如下图所示
说明:退出当前环境
(superset) [[email protected] ~]$ conda deactivate
4)执行 python 命令查看python 版本
3.3、 Superset 部署
1、安装依赖
1)安装 Superset 之前,需安装以下所需依赖
(superset) [[email protected] ~]$ sudo yum install -y gcc gcc-c++ libffi-devel python-devel python-pip python-wheel python-setuptools openssl-devel cyrus-sasl-devel openldap-devel
2)安装(更新)setuptools和pip
(superset) [[email protected] ~]$ pip install --upgrade setuptools pip -i https://pypi.douban.com/simple/
**说明:**pip 是 python 的包管理工具,可以和 centos 中的 yum 类比
2、安装 Superset
(superset) [[email protected] ~]$ pip install apache-superset -i https://pypi.douban.com/simple/
说明:-i 的作用是指定镜像,这里选择国内镜像
注:如果遇到网络错误导致不能下载,可尝试更换镜像
(superset) [[email protected] ~]$ pip install apache-superset --trusted-host https://repo.huaweicloud.com -i https://repo.huaweicloud.com/repository/pypi/simple
# pip install 名==版本
1)升级superset
pip install apache-superset --upgrade
superset db upgrade
superset init
2)Chinese and external database
修改config.py源码;Add the data source below
/superset/lib/python3.7/site-packages/superset/config.py文件, 修改内容如下:
BABEL_DEFAULT_LOCALE = "zh"
external database
修改配置文件config.pyThe database connection address in
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(DATA_DIR, 'superset.db')
# 改为
SQLALCHEMY_DATABASE_URI = 'mysql://root:[email protected]:port/superset?charset=utf8'
# Enter the virtual environment to initialize the database
source venv/bin/activate
superset db upgrade
3) 初始化Supetset数据库
(superset) [[email protected] ~]$ superset db upgrade
4)创建管理员用户
(superset) [[email protected] ~]$ export FLASK_APP=superset
(superset) [[email protected] ~]$ superset fab create-admin
**说明:**flask 是一个 python web 框架,Superset 使用的就是 flask
5)Superset初始化
(superset) [[email protected] ~]$ superset init
报错
ImportError: cannot import name '_ColumnEntity' from 'sqlalchemy.orm.query' (/Users/ahmedawny/supersetenv/lib/python3.7/site-packages/sqlalchemy/orm/query.py)
https://stackoverflow.com/questions/66644975/importerror-cannot-import-name-columnentity-from-sqlalchemy-orm-query/66648061#66648061
https://github.com/sqlalchemy/sqlalchemy/issues/6226
转到sqlalchemy_utils\functions\orm.py 文件并更改:
- from sqlalchemy.orm.query import _ColumnEntity (comment this,或者删除它)
- 从 sqlalchemy.orm.context 导入 _ColumnEntity (包括)
抱怨“flask-appbuilder 3.2.2 需要 SQLAlchemy<1.4.0
1)手动 pip install sqlalchemy==1.3.24 之后
pip install sqlalchemy==1.3.24 -i https://pypi.douban.com/simple/
2)SQLAlchemy-Utils(最新版本是 0.37.2).
3、启动Supterset
1)安装gunicorn
(superset) [[email protected] ~]$ pip install gunicorn -i https://pypi.douban.com/simple/
**说明:**gunicorn 是一个 Python Web Server,可以和 java 中的 TomCat 类比
2)启动Superset
1)确保当前 conda环境为 superset,及下图所示
2)启动
(superset) [[email protected] ~]$ gunicorn --workers 5 --timeout 120 --bind hbdn2:8787 "superset.app:create_app()" --daemon
说明:
–workers:指定进程个数
–timeout:worker进程超时时间,超时会自动重启
–bind:绑定本机地址,即为Superset 访问地址
–daemon:后台运行
3)登录Superset
访问 http://hadoop102:8787,并使用 2.2.2 节中第 4 步创建的管理员账号进行登录.
3)停止superset
停掉 gunicorn 进程
(superset) [[email protected] ~]$ ps -ef | awk '/superset/ && !/awk/{print $2}' | xargs kill -9
退出superset环境
(superset) [[email protected] ~]$ conda deactivate
4、superset 启停脚本
1)创建superset.sh文件
[[email protected] bin]$ vim superset.sh
2)加执行权限
[[email protected] bin]$ chmod +x superset.sh
报错:-bash: ./cleanup.sh: /bin/bash^M: bad interpreter: No such file or directory
sed -i “s/\r//” name.sh 之后再次执行
3)测试
启动superset
[[email protected] bin]$ superset.sh start
停止superset
[[email protected] bin]$ superset.sh stop
5、数据源下载
1)mysql
(superset) [[email protected] ~]$ conda install mysqlclient
mysql://用户名:密码@主机名:端口号/数据库名称
2)hive、Spark SQL
pip install pyhive -i https://pypi.douban.com/simple/
hive://ip:10000
hive://[email protected]{hostname}:{port}/{database}
3)impala
pip install impyla -i https://pypi.douban.com/simple/
impala:///user:[email protected]{hostname}:21050/{database}
impala://{hostname}:21050/{database}
4)kylin
pip install kylinpy -i https://pypi.douban.com/simple/
kylin://<username>:<password>@<hostname>:<port>/<project>?<param1>=<value1>&<param2>=<value2>
边栏推荐
- Common regularization methods in deep learning (Regularization) and detailed explanation of WeightDecay parameters in optimizers
- 儿子满墙奖状却没考上重点高中,妈妈愤怒撕下痛哭:不读出去打工
- 电商秒杀系统架构设计
- 超详细的最新版 2022.2 kali 安装步骤及拍摄快照的方法
- 761. 特殊的二进制序列 : 经典构造题
- 创建二维数组
- kali换源详细步骤
- JS-Bom-while (calculate leap year)
- 让您知道华为云服务器的强大【华为云至简致远】
- 基于Qt设计的课堂考勤系统(采用RDS for MySQL云数据库 )【华为云至简致远】
猜你喜欢
Elegantly detect and update web applications in real time
kali换源详细步骤
web-sql注入
手把手教你设计一个全局异常处理器
Power BI简介
Notes on the development of kindergarten enrollment registration system based on WeChat applet
JS-Bom-while (calculate leap year)
HMS Core Analysis Service Intelligent Operation Version 6.5.1 Launched
Tungsten Fabric SDN — OpenStack 与 Kubernetes 异构集群统一 SDN 方案
投资一个约20台桩的充电站需要多少钱?多久可以实现盈利?
随机推荐
PHP —— CI 框架实现微信小程序支付
全志V853芯片Tina下RTSP环境搭建方法
Is it safe to open an account online now?Which securities to choose for securities account opening?
vijos1212 Way Selection
进程和线程
Create a 2D array
Brief description of the state of the thread
我凭借这份pdf成功拿到了阿里,腾讯,京东等六家大厂offer
2022年8月中国数据库排行榜:openGauss重夺榜眼,PolarDB反超人大金仓
MySQL清除表数据 id重置
深度学习-神经网络原理1
面试官:Redis 大 key 要如何处理?
P8352-[SDOI/SXOI2022]小N的独立集【dp套dp】
Iptables防火墙iprange模块扩展匹配规则
H5不同屏幕大小显示不同的文字大小图片大小
线程本地存储 ThreadLocal
Common regularization methods in deep learning (Regularization) and detailed explanation of WeightDecay parameters in optimizers
【对线面试官】如何实现去重和幂等
vs2只运行项目中的一个文件
[内部资源] 想拿年薪30W的软件测试人员,这份资料必须领取