通过remotes::install_github函数安装github上的包时报错:
Error: Failed to install 'SeuratWrappers' from github:
Failed to connect to api.github.com port 443 after 11 ms: Couldn't connect to server
我尝试很久没法解决,选择手动下载zip包后上传至服务器,然后local安装,仍然报错:
r$> remotes::install_local('~/r_packages//seurat-wrappers-master.zip')
Error: Failed to install 'seurat-wrappers-master.zip' from local:
Failed to connect to api.github.com port 443 after 5 ms: Couldn't connect to server
在其他人的安装问题中我发现安装过程包含一个整理打包为tar.gz的过程:
Cannot install seurat-wrapers #32
devtools::install_github('satijalab/seurat-wrappers')
Downloading GitHub repo satijalab/seurat-wrappers@master
✓ checking for file ‘/private/var/folders/k6/kc8fk3c56j5d_msh9ttjvjxr0000gn/T/RtmpwyP1Vv/remotesc4b97ff971c7/satijalab-seurat-wrappers-1e814d1/DESCRIPTION’ ...
─ preparing ‘SeuratWrappers’:
✓ checking DESCRIPTION meta-information
─ checking for LF line-endings in source and make files and shell scripts
─ checking for empty or unneeded directories
─ building ‘SeuratWrappers_0.1.0.tar.gz’
installing source package ‘SeuratWrappers’ ...
** using staged installation
** R
** byte-compile and prepare package for lazy loading
sh: line 1: 64739 Killed: 9 R_TESTS= '/Library/Frameworks/R.framework/Resources/bin/R' --no-save --slave 2>&1 < '/var/folders/k6/kc8fk3c56j5d_msh9ttjvjxr0000gn/T//RtmpsUkqSj/filefcdc4d4df839'
...
然后我尝试,先解压zip文件,再手动压缩为tar.gz文件,参考其中的文件名:SeuratWrappers_0.1.0.tar.gz。
unzip seurat-wrappers-master.zip
tar -zcvf SeuratWrappers_0.3.1.tar.gz ./seurat-wrappers-master
然后在R中安装:
##使用remotes安装仍然报错
r$> remotes::install_local('~/r_packages//SeuratWrappers_0.3.1.tar.gz')
Error: Failed to install 'SeuratWrappers' from local:
Failed to connect to api.github.com port 443 after 11 ms: Couldn't connect to server
##使用install.packages安装
r$> install.packages('SeuratWrappers_0.3.1.tar.gz')
* installing *source* package ‘SeuratWrappers’ ...
** using staged installation
** R
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (SeuratWrappers)
## 可以正常使用
library(SeuratWrappers)
r$> neu
An object of class Seurat
23064 features across 54999 samples within 1 assay
Active assay: RNA (23064 features, 2000 variable features)
3 dimensional reductions calculated: pca, umap, harmony
r$> cds <- SeuratWrappers::as.cell_data_set(neu)
Warning: Monocle 3 trajectories require cluster partitions, which Seurat does not calculate. Please run 'cluster_cells' on your cell_data_set object
当然,以上是笨办法,最简单的本地安装github包的方法是:
- 下载zip包,然后解压;
- install.packages安装。
#shell script:
unzip xxx-master.zip
mv xxx-master xxx
#R script
install.packages("xxx", repos = NULL, type = "source")