CentOS7 部署 catalyst 框架步骤

由于需要将catalyst框架部署到Linux(CentOS7.0)服务器 ,所以这里记录相关的部署步骤,以备后用。

一、安装Anaconda

1、下载 Anaconda(python3.6 catalyst官方推荐)

各版本镜像包:https://repo.anaconda.com/arc...

python3.6的对应的是 Anaconda 5.2,5.3以后的都是python 3.7的不要看错了,这里我们要安装 python 3.6, 如果安装python3.7 版本,在环境中安装 catalyst 框架会失败。

file

下载命令:

wget --no-check-certificate  https://repo.anaconda.com/archive/Anaconda3-5.2.0-Linux-x86_64.sh

2、更改为可执行权限

chmod +x Anaconda3-5.2.0-Linux-x86_64.sh

3、执行脚本

./Anaconda3-5.2.0-Linux-x86_64.sh 2>&1 | tee conda-all.log

如果在安装的时候报这样的错bunzip2: command not found,则执行下边的命令安装:

yum install -y bzip2

4、安装记录
by running conda init ?是否初始化,我们选 yes

[/root/anaconda3] >>> 
PREFIX=/root/anaconda3
installing: python-3.6.5-hc3d631a_2 ...
Python 3.6.5 :: Anaconda, Inc.
installing: blas-1.0-mkl ...

by running conda init? [yes|no]
[no] >>> yes
no change     /root/anaconda3/condabin/conda
no change     /root/anaconda3/bin/conda
no change     /root/anaconda3/bin/conda-env
no change     /root/anaconda3/bin/activate
no change     /root/anaconda3/bin/deactivate
no change     /root/anaconda3/etc/profile.d/conda.sh
no change     /root/anaconda3/etc/fish/conf.d/conda.fish
no change     /root/anaconda3/shell/condabin/Conda.psm1
no change     /root/anaconda3/shell/condabin/conda-hook.ps1
no change     /root/anaconda3/lib/python3.7/site-packages/xontrib/conda.xsh
no change     /root/anaconda3/etc/profile.d/conda.csh
modified      /root/.bashrc

installing: anaconda-5.2.0-py36_3 ...
installation finished.
Do you wish the installer to prepend the Anaconda3 install location
to PATH in your /root/.bashrc ? [yes|no]
[no] >>> yes

Appending source /root/anaconda3/bin/activate to /root/.bashrc
A backup will be made to: /root/.bashrc-anaconda3.bak

For this change to become active, you have to open a new terminal.

Thank you for installing Anaconda3!

我们可以看到在安装的时候,已经将bin目录加入到了环境变量PATH:

php3.7版本:

[root@vultr software_sources]# cat ~/.bashrc
# .bashrc

# User specific aliases and functions

alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

# Source global definitions
if [ -f /etc/bashrc ]; then
    . /etc/bashrc
fi

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/root/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/root/anaconda3/etc/profile.d/conda.sh" ]; then
        . "/root/anaconda3/etc/profile.d/conda.sh"
    else
        export PATH="/root/anaconda3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda initialize <<<

php3.6版本:

[root@vultr software_sources]# cat ~/.bashrc
# .bashrc

# User specific aliases and functions

alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

# Source global definitions
if [ -f /etc/bashrc ]; then
    . /etc/bashrc
fi



# added by Anaconda3 installer
export PATH="/root/anaconda3/bin:$PATH"

重新加载 bashrc 立即生效:

# 将anaconda的bin目录加入PATH,根据版本不同,也可能是~/anaconda3/bin
# echo 'export PATH="/root/anaconda3/bin:$PATH"' >> ~/.bashrc # 如果.bashrc没有路径则需要执行该命令

# 更新bashrc以立即生效()
source ~/.bashrc  #Anaconda 5.2不需要执行此命令,Anaconda 5.2以上需要

5、测试

 [root@vultr software]# conda -V
conda 4.5.4

可以看到conda已经安装ok。

6、卸载(参考)
如果conda安装错版本,则需要卸载重装,也非常简单,直接在根目录移除即可

rm -rf  ~/anaconda3

删掉环境变量的conda路径:

vim ~/.bashrc

二、安装Catalyst

Catalyst框架官方文档:https://enigma.co/catalyst/in...

1、下载 python3.6-environment.yml 文件到本地

# 地址
https://github.com/enigmampc/catalyst/blob/master/etc/python3.6-environment.yml

或者直接复制 python3.6-environment.yml 文件内容 到本地:
python3.6-environment.yml

name: catalyst
channels:
- conda-forge
- defaults
dependencies:
- ca-certificates=2017.08.26
- certifi=2018.1.18
- intel-openmp=2018.0.0
- ipython=6.4.0
- jupyter=1.0.0
- mkl=2018.0.1
- numpy=1.14.0
- openssl=1.0.2n
- matplotlib=2.2.2
- pip=9.0.1
- python=3.6.4
- scipy=1.0.0
- setuptools=38.4.0=py36_0
- sqlite=3.22.0
- tk=8.6.7
- wheel=0.30.0
- xz=5.2.3
- zlib=1.2.11
- pip:
  - aiodns==1.1.1
  - aiohttp==3.0.1
  - alembic==0.9.7
  - async-timeout==2.0.0
  - attrdict==2.0.0
  - attrs==17.4.0
  - bcolz==1.2.1
  - boto3==1.5.27
  - botocore==1.8.41
  - bottleneck==1.2.1
  - cchardet==2.1.1
  - ccxt==1.17.94
  - chardet==3.0.4
  - click==6.7
  - contextlib2==0.5.5
  - cyordereddict==1.0.0
  - cython==0.27.3
  - cytoolz==0.9.0
  - docutils==0.14
  - empyrical==0.2.1
  - enigma-catalyst>=0.5.18
  - eth-abi==1.1.1
  - eth-account==0.2.2
  - eth-hash==0.1.3
  - eth-keyfile==0.5.1
  - eth-keys==0.2.0b3
  - eth-rlp==0.1.2
  - eth-utils==1.0.3
  - hexbytes==0.1.0
  - idna==2.6
  - idna-ssl==1.0.0
  - intervaltree==2.1.0
  - jmespath==0.9.3
  - jupyter_nbextensions_configurator==0.4.0
  - logbook==1.2.1
  - lru-dict==1.1.6
  - lxml==4.1.1
  - mako==1.0.7
  - multidict==4.1.0
  - multipledispatch==0.4.9
  - networkx==2.1
  - numexpr==2.6.4
  - pandas==0.19.2
  - pandas-datareader==0.6.0
  - parsimonious==0.8.0
  - patsy==0.5.0
  - pycares==2.3.0
  - pycryptodome==3.6.1
  - pysha3==1.0.2
  - python-editor==1.0.3
  - redo==2.0.1
  - requests==2.20.1
  - requests-file==1.4.3
  - requests-ftp==0.3.1
  - requests-toolbelt==0.8.0
  - rlp==0.6.0
  - s3transfer==0.1.12
  - sortedcontainers==1.5.9
  - sqlalchemy==1.2.2
  - statsmodels==0.8.0
  - tables==3.4.2
  - toolz==0.9.0
  - urllib3==1.22
  - virtualenv==15.2.0
  - web3==4.4.1
  - websockets==5.0
  - wrapt==1.10.11
  - yarl==1.1.0

2、使用conda创建单独环境

conda env create -f python3.6-environment.yml
source activate catalyst

在安装时可能系统会缺少某些必要的包,这是我在CentOS7.0安装时缺少必要的包:

# g++
yum install gcc-c++

安装完成后:

#
# To activate this environment, use:
# > source activate catalyst
#
# To deactivate an active environment, use:
# > source deactivate

3、激活环境测试

[root@vultr catalyst_env]#  source activate catalyst
(catalyst) [root@vultr catalyst_env]# catalyst ingest-exchange -x binance -i btc_usdt -f daily
Trying to ingest exchange bundle binance...
    [====================================]  Ingesting daily price data on binance:  100%
(catalyst) [root@vultr catalyst_env]# 

相关文章:
Python数据分析及Anaconda集成包安装
数字货币量化系统之策略回测和 Catalyst 框架使用
CentOS7 部署 catalyst 框架步骤

你可能感兴趣的:(centos7,conda,anaconda)