首页 文章详情

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

生信宝典 | 1393 2020-03-30 23:25 0 0 0
UniSMS (合一短信)

前言

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命令如awk, sedcat等与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镜像等。

软件安装参考

往期精品(点击图片直达文字对应教程)

3fdbc818caeee88114beee9ebe1d81d0.webp

e658d866104c7d58f64c3013f2bf06f0.webp

8bb692323e3fb1de20cfc35ae1130db7.webp

31ef06ddd1379701de5812f080e8cf3b.webp

dfebf1b37b8b83b318cae495e1b8ea5b.webp

d890c82560b65411e791b907b1b0f1d5.webp

53bf1345e8d4f18a5dab2b7b08c0eca6.webp

49973fd89025879a52a437e61d5d248b.webp

b2fe8ef83aaf4d04ef2e79f790b54d49.webp

6e98239a3e0f8b162643ccd750820469.webp

bc8d730c2011ed8ed78dd2cc396b126d.webp

e643c79b2469ff36959a47b6c46a6c45.webp

1f21ad01fdf9c988ac51efeeb6cf77f3.webp

d90f50134f84e40288e5c54f98d1ac22.webp

c708ad0cfa17224cf06625516b902c55.webp

7bb428b6422997e35688ddeb6be452f7.webp

3f2b8ba3cfcbd57717387fa4b6c21d91.webp

f06bc4944cd67694d30a20a9a3fcb173.webp

07e0a2bfb50c4fd3dc45681d87c378ab.webp

debfe4299086bc58b1e5d1dacf3e2a68.webp

f15aca2af607d0d48324a8339a29c7aa.webp

d067f0e89f21ad58efa45e319ff4f257.webp

57e5a80a7f8cd1025ccf50dbd1dca5f6.webp

dbbe4a5a5a5f34b5e2703ecb6aa1b404.webp

0f4cf86406b2883c786f3bd5c9ebff1d.webp

23ca3f9a9ea00d551af24c4928dab6c5.webp

0c849ae66889950fe8e88a8b146c237c.webp

6f2857a3f324b72998e2f3a9c11e21aa.webp


后台回复“生信宝典福利第一波”或点击阅读原文获取教程合集

8cbd17b54b89b039b42337179442c257.webp

b821493110b3260b92aeb550c39030dd.webp

ce71a3e9707e3c330e39426aedc80960.webp

b3dbfcb51fba23788d534318713e32a0.webp

good-icon 0
favorite-icon 0
收藏
回复数量: 0
    暂无评论~~
    Ctrl+Enter