chen7qi的个人博客分享 http://blog.sciencenet.cn/u/chen7qi

博文

软件安装不上,可能是网速慢!Conda/R/pip/brew等国内镜像大全拿走不谢~~

已有 2385 次阅读 2020-3-30 21:30 |个人分类:生物信息|系统分类:科研笔记

NGS系列文章包括NGS基础、转录组分析 Nature重磅综述|关于RNA-seq你想知道的全在这、ChIP-seq分析 ChIP-seq基本分析流程、单细胞测序分析 (重磅综述:三万字长文读懂单细胞RNA测序分析的最佳实践教程 (原理、代码和评述))、DNA甲基化分析、重测序分析、GEO数据挖掘典型医学设计实验GEO数据分析 (step-by-step) - Limma差异分析、火山图、功能富集等内容

软件安装是生信分析的基础,除了掌握基本的软件安装理论外之后 (Linux - 命令运行监测和软件安装),就是去下载源码安装或使用包管理工具安装。通常操作都没问题时,软件却怎么都装不上,这一般都是网络问题。所以你需要一个能够快速访问的镜像,下载快还不容易断。

国内的镜像比较全的有清华镜像 (https://mirrors.tuna.tsinghua.edu.cn)和阿里云镜像 (https://developer.aliyun.com/mirror/)。下面以清华镜像为例 (阿里云镜像没有conda),展示下其操作。

Conda镜像

Conda增加清华的镜像,运行下面的代码 (后添加的通道优先级更高)

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/

或直接把下面文字拷贝到 ~/.condarc中 (越靠前的优先级越高)

channels:
 - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
 - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
 - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
 - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro
 - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
 - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
 - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/

Python包管理工具 pip镜像

可以每次安装时加-i参数 (或使用alias命令)。

注意,simple不能少,  是https而不是 http

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple some-package

升级 pip 到最新的版本 (>=10.0.0) 后进行永久配置:

pip install pip -U
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

R包安装镜像

CRAN和Bioconductor的镜像

安装前现运行这几句话,或把这几句话放在~/.Rprofile~/.Profile.site文件下 (Windows里面的路径是C:\Program Files\R\R-3.6.1\etc)。

local({r <- getOption("repos")
r["CRAN"] <- "http://mirrors.tuna.tsinghua.edu.cn/CRAN/"
options(repos=r)})

options(BioC_mirror="https://mirrors.tuna.tsinghua.edu.cn/bioconductor")

自动安装包

# 安装BiocManager
if (!requireNamespace("BiocManager", quietly = TRUE))
 install.packages("BiocManager")

# 获取已安装包
a = rownames(installed.packages())

install_package <- c("RColorBrewer", "gplots", "agricolae","optparse")

# 判断包是否存在,不存在则安装
for (i in install_package) {
 if (!i %in% a)
   BiocManager::install(i, update = F)
}

如果是Github的包安装起来比较慢,可以考虑在码云(https://gitee.com/)注册个账户,把`Github`的库先克隆到码云 (点击几下就可以实现,码云的服务器访问Github还是很快的),然后再下载到本地安装即可。

HomeBrew

Mac下默认的不少Linux命令如awksedcat等与Linux下使用方式有些差别,通常需要安装GNU系列的对应命令来统一代码操作。可以通过brew安装,但brew update过程默认是极其的慢,也需要改一下镜像。

安装Brew

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

配置镜像

# brew 程序本身,Homebrew/Linuxbrew 相同
git -C "$(brew --repo)"  remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git

# 索引的镜像
# 以下针对 mac OS 系统上的 Homebrew
git -C "$(brew --repo homebrew/core)"  remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
git -C "$(brew --repo homebrew/cask)"  remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git
git -C "$(brew --repo homebrew/cask-fonts)"  remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask-fonts.git
git -C "$(brew --repo homebrew/cask-drivers)"  remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask-drivers.git

# 更换后测试工作是否正常
brew update

# 软件包的镜像
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile

安装相应的gnu系列工具

#brew install bash
brew install coreutils

brew install gawk
brew install gnu-sed

其它镜像

还有其它镜像,如Perl的CPAN,Linux操作系统安装包,Linux操作系统自带包管理工具(yum/apt)的源,Docker镜像等。




https://blog.sciencenet.cn/blog-118204-1226042.html

上一篇:Python语法糖之:列表解析、集合解析和字典解析
下一篇:如果不是没有钱,谁想测3个重复?
收藏 IP: 114.250.123.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-4-18 20:13

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部