刚出生的 Ubuntu 趁热安装 Anaconda3,配置metapi
2022-05-25
之前的服务器到期了,呜呜呜。
所以把腾讯云上海的轻量服务器从 win 重装成了 Ubuntu 18,一张白纸,啥也没有,为了跑宏基因组分析,先装一个Anaconda3。
下载&安装 Anaconda3
下载 Anaconda3
先建一个路径,然后下载 Anaconda3,以轻量服务器的带宽大概几分钟。
wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-2021.11-Linux-x86_64.sh
查看文件:
ubuntu@VM-16-13-ubuntu:~/Down_sw/25-05-2022$ ls
Anaconda3-2021.11-Linux-x86_64.sh
安装 Anaconda3
bash Anaconda3-2021.11-Linux-x86_64.sh
一路回车,然后yes,回车
Please answer 'yes' or 'no':'
>>> yes
Anaconda3 will now be installed into this location:
/home/ubuntu/anaconda3
- Press ENTER to confirm the location
- Press CTRL-C to abort the installation
- Or specify a different location below
[/home/ubuntu/anaconda3] >>>
PREFIX=/home/ubuntu/anaconda3
Unpacking payload ...
Extracting : sniffio-1.2.0-py39h06a4308_1.conda: 40%|████████████▎ | 154/389 [00:09<00:17, 13.26it/s]
继续yes
installation finished.
Do you wish the installer to initialize Anaconda3
by running conda init? [yes|no]
[no] >>> yes
no change /home/ubuntu/anaconda3/condabin/conda
no change /home/ubuntu/anaconda3/bin/conda
no change /home/ubuntu/anaconda3/bin/conda-env
no change /home/ubuntu/anaconda3/bin/activate
no change /home/ubuntu/anaconda3/bin/deactivate
no change /home/ubuntu/anaconda3/etc/profile.d/conda.sh
no change /home/ubuntu/anaconda3/etc/fish/conf.d/conda.fish
no change /home/ubuntu/anaconda3/shell/condabin/Conda.psm1
no change /home/ubuntu/anaconda3/shell/condabin/conda-hook.ps1
no change /home/ubuntu/anaconda3/lib/python3.9/site-packages/xontrib/conda.xsh
no change /home/ubuntu/anaconda3/etc/profile.d/conda.csh
modified /home/ubuntu/.bashrc
==> For changes to take effect, close and re-open your current shell. <==
If you'd prefer that conda's base environment not be activated on startup,
set the auto_activate_base parameter to false:
conda config --set auto_activate_base false
Thank you for installing Anaconda3!
===========================================================================
Working with Python and Jupyter notebooks is a breeze with PyCharm Pro,
designed to be used with Anaconda. Download now and have the best data
tools at your fingertips.
PyCharm Pro for Anaconda is available at: https://www.anaconda.com/pycharm
ubuntu@VM-16-13-ubuntu:~/Down_sw/25-05-2022$
source 一下,出现 (base) 环境
ubuntu@VM-16-13-ubuntu:~/Down_sw/25-05-2022$ conda
conda: command not found
ubuntu@VM-16-13-ubuntu:~/Down_sw/25-05-2022$ source ~/.bashrc
(base) ubuntu@VM-16-13-ubuntu:~/Down_sw/25-05-2022$
conda deactivate
退出 (base) 环境
想要升级 conda:
conda update -n base -c defaults conda
结果:
The following packages will be UPDATED:
conda 4.10.3-py39h06a4308_0 --> 4.12.0-py39h06a4308_0
conda-package-han~ 1.7.3-py39h27cfd23_1 --> 1.8.1-py39h7f8727e_0
创建虚拟环境
metapi已经2.1.1版本了,https://anaconda.org/bioconda/metapi
创建名为 skin 的虚拟环境,python 版本为 3.7(先试一试)
conda create -n skin python=3.7
ubuntu@VM-16-13-ubuntu:~/Down_sw/25-05-2022$ conda activate skin
(skin) ubuntu@VM-16-13-ubuntu:~/Down_sw/25-05-2022$
vim ~/.bashrc
加快捷命令
alias skin='conda activate skin'
常用conda 命令
#创建虚拟环境
conda create -n your_env_name python=X.X(3.6、3.7等)
#激活虚拟环境
source activate your_env_name(虚拟环境名称)
#退出虚拟环境
source deactivate your_env_name(虚拟环境名称)
#删除虚拟环境
conda remove -n your_env_name(虚拟环境名称) --all
#查看安装了哪些包
conda list
#安装包
conda install package_name(包名)
conda install scrapy==x.x # 安装指定版本的包
conda install -n 环境名 包名 # 在conda指定的某个环境中安装包
#查看当前存在哪些虚拟环境
conda env list
#或
conda info -e
参考:https://blog.csdn.net/qq_52813185/article/details/124826603
pip更新:
python -m pip install --upgrade pip
安装metapi
刚更新的 2.1.1 ,真热乎啊,要是早一天就好了,昨天本地配置最后发现有依赖项不支持win64很难受,今天先在Ubuntu上试一试。
pip3 install metapi==2.1.1
测试,报错:
(skin) ubuntu@VM-16-13-ubuntu:~/Down_sw/25-05-2022$ metapi --help
Traceback (most recent call last):
File "/home/ubuntu/anaconda3/envs/skin/bin/metapi", line 5, in <module>
from metapi.corer import main
File "/home/ubuntu/anaconda3/envs/skin/lib/python3.7/site-packages/metapi/__init__.py", line 25, in <module>
from metapi.qcer import change
File "/home/ubuntu/anaconda3/envs/skin/lib/python3.7/site-packages/metapi/qcer.py", line 5, in <module>
import seaborn as sns
ModuleNotFoundError: No module named 'seaborn'
安装所缺依赖:
pip install seaborn
成功:
(skin) ubuntu@VM-16-13-ubuntu:~/Down_sw/25-05-2022$ metapi --help
usage: metapi [-h] [-v] ...
.___ ___. _______ .___________. ___ .______ __
| \/ | | ____|| | / \ | _ \ | |
| \ / | | |__ `---| |----` / ^ \ | |_) | | |
| |\/| | | __| | | / /_\ \ | ___/ | |
| | | | | |____ | | / _____ \ | | | |
|__| |__| |_______| |__| /__/ \__\ | _| |__|
Omics for All, Open Source for All
A general metagenomics data mining system focus on robust microbiome research
optional arguments:
-h, --help show this help message and exit
-v, --version print software version and exit
available subcommands:
跟作者反馈一下: