Damn!linux想做单细胞想下载Seurat,依赖包stringi要怎么安装

简介: **摘要:**《R包stringi安装挑战与解决方案》`stringi`是R中的关键字符串处理包,基于ICU库,常用于生物信息学和统计分析。安装时常遇到问题,特别是在Linux上,因平台依赖和C库版本而复杂。解决办法包括检查GCC版本、网络和环境。当常规方法失败时,可尝试手动下载ICUDT,设置`configure.vars`或通过源码安装:下载zip,构建,然后使用R CMD安装。遇到类似问题的开发者可参考提供的链接和步骤。安装问题多样,需灵活应对。

Homies~,该文章非万能解决方案,一况一论!

[toc]

说在前面

stringi这个包麻烦这个是大家都知道的,win、macos麻烦,linux的更麻烦...

image.png

stringi 是 R 语言中的一个非常流行和强大的字符串处理包。它提供了一系列的功能,用于处理和操作字符串数据,特别是对于国际化和本地化的文本处理。stringi 基于 ICU(International Components for Unicode)库,这是一个广泛使用的、跨平台的、针对 Unicode 标准的 C 库。
stringi 是许多 R 包的依赖包。由于它提供了一系列强大且灵活的字符串处理功能,stringi 成为了许多开发者的首选包来处理字符串相关的任务。这些功能包括但不限于字符串的搜索、替换、排序、分割和国际化处理。

上述是引用GPT的话来凑字数,大家记住两点即可:

  • stringi是基于C/C++开发的二进制分发包,跟源码,平台依赖性强,所以说linux安装起来挺麻烦,如果报错起来不同发行版不同C库不同版本号都可能会有不同的情况,M3~
  • stringi、stringr这些,是几乎,God的,所有生信/统计分析所用到的R包的依赖包,绕不过去的,只能解决报错,乖乖安装。

这个包笔者曾经刚学R的时候也苦受折磨,自己本地的win本安装无问题,但是实验室服务安装,;后面入坑了黑苹果,;换了macbook,

怎么办

怎么办,八仙过海各显神通,随机应变灵活解决。

1st:GCC版本问题

这是笔者第一次记录过的解决方案,当时是用的服务器,用jupyter死活装不成功捣鼓了几天:

在C站有blog这里就不重复了,可以参考一下,那一次是版本问题好像是,https://blog.csdn.net/weixin_48093827/article/details/130066097

image.png

2st:不确定是环境还是网络问题

报错内容:

> install.packages("stringi")
Installing package into ‘/home/xu_zw/R/x86_64-pc-linux-gnu-library/4.2(as ‘lib’ is unspecified)
trying URL 'https://mirrors.e-ducation.cn/CRAN/src/contrib/stringi_1.7.12.tar.gz'
Content type 'application/x-gzip' length 7602365 bytes (7.3 MB)
==================================================
downloaded 7.3 MB

* installing *source* package ‘stringi’ ...
** package ‘stringi’ successfully unpacked and MD5 sums checked
** using staged installation
checking for R_HOME... /opt/R/4.2.1/lib/R
checking for R... /opt/R/4.2.1/lib/R/bin/R
checking for endianness... little
checking for R >= 3.1.0 for C++11 use... yes
checking for R < 3.4.0 for CXX1X flag use... no
checking for cat... /usr/bin/cat
checking for local ICUDT_DIR... icu69/data
checking for gcc... gcc -std=gnu11
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether gcc -std=gnu11 accepts -g... yes
checking for gcc -std=gnu11 option to enable C11 features... none needed
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for elf.h... yes
checking whether the compiler supports GNU C++... yes
checking whether g++ -std=gnu++11 accepts -g... yes
checking for g++ -std=gnu++11 option to enable C++11 features... none needed
checking whether the C++ compiler supports the long long type... yes
checking whether the compiler implements namespaces... yes
checking whether the compiler supports the Standard Template Library... yes
checking whether std::map is available... yes
checking for pkg-config... /usr/bin/pkg-config
checking with pkg-config for the system ICU4C... 50.2
checking for ICU4C >= 55... no
*** ICU4C 50.2 has been detected
*** Minimal requirements, i.e., ICU4C >= 55, are not met
*** Trying with 'standard' fallback flags
checking whether an ICU4C-based project can be built... yes
checking programmatically for sufficient U_ICU_VERSION_MAJOR_NUM... no
*** This version of ICU4C cannot be used.
*** Using the ICU 69 bundle.
checking whether we may compile src/icu69/common/putil.cpp... yes
checking whether we may compile src/icu69/i18n/number_affixutils.cpp... yes
checking whether alignof(std::max_align_t) is available... yes
checking whether the ICU data library can be downloaded... downloading the ICU data library (icudt)
output path: icu69/data/icu4c-69_1-data-bin-l.zip
trying URL 'https://raw.githubusercontent.com/gagolews/stringi/master/src/icu69/data/icu4c-69_1-data-bin-l.zip'
Error in download.file(paste(href, fname, sep = ""), icudtzipfname, mode = "wb"): cannot open URL 'https://raw.githubusercontent.com/gagolews/stringi/master/src/icu69/data/icu4c-69_1-data-bin-l.zip'

trying URL 'http://raw.githubusercontent.com/gagolews/stringi/master/src/icu69/data/icu4c-69_1-data-bin-l.zip'
Error in download.file(paste(href, fname, sep = ""), icudtzipfname, mode = "wb"): cannot open URL 'http://raw.githubusercontent.com/gagolews/stringi/master/src/icu69/data/icu4c-69_1-data-bin-l.zip'

icudt download failed
Error: Stopping on error
In addition: Warning messages:
1: In download.file(paste(href, fname, sep = ""), icudtzipfname, mode = "wb") :
  URL 'https://raw.githubusercontent.com/gagolews/stringi/master/src/icu69/data/icu4c-69_1-data-bin-l.zip': status was 'Couldn't connect to server'
2: In download.file(paste(href, fname, sep = ""), icudtzipfname, mode = "wb") :
  URL 'http://raw.githubusercontent.com/gagolews/stringi/master/src/icu69/data/icu4c-69_1-data-bin-l.zip': status was 'Couldn't connect to server'
Execution halted
*** *********************************************************************
*** stringi cannot be built.
*** Failed to download the ICU data library (icudt). Stopping now.
*** For build environments that have no internet access,
*** see the INSTALL file for a workaround.
*** *********************************************************************
ERROR: configuration failed for package ‘stringi’
* removing ‘/home/xu_zw/R/x86_64-pc-linux-gnu-library/4.2/stringi’
* restoring previous ‘/home/xu_zw/R/x86_64-pc-linux-gnu-library/4.2/stringi’

The downloaded source packages are in/tmp/Rtmp1tLgZj/downloaded_packages’
Warning message:
In install.packages("stringi") :
  installation of package ‘stringi’ had non-zero exit status

这次的报错,不确定是环境问题还是网络问题,单看报错内容,应该是网络问题,但是我尝试ping一下github是有回应的。谷歌了一下,有说版本问题的,以及还是库的,问题。

版本的问题也看了,非也

image.png

type shit~ Conda也是过了,装不成功的

大家留意报错内容ERROR的部分,不尽相同的!!M3~
这环节可以参考一下官网的方法:
https://stringi.gagolewski.com/install.html

image.png

本篇的成功解决方法

直接点题了,也是愚了,关键就是本地安装

1.加载ICUDT安装,官方文件https://raw.githubusercontent.com/gagolews/stringi/master/INSTALL,应该要科学上网

install.packages("stringi", configure.vars="ICUDT_DIR=<icudt_dir>")

2.不行没关系,自己下载安装解压

wget https://github.com/gagolews/stringi/archive/master.zip -O stringi.zip
unzip stringi.zip
sed -i '/\/icu..\/data/d' stringi-master/.Rbuildignore
R CMD build stringi-master

image.png

3.终端或者在R中下载r包,xyz换成第二步结果的版本号,例如这里是1.8.1

# bash
R CMD INSTALL stringi_x.y.z.tar.gz
# R
install.packages("stringi_x.y.z.tar.gz", repos=NULL)

4.over~

image.png

如有其他情况或者其他解决方案,欢迎大家私信交流,my heart~

目录
相关文章
|
1月前
|
Ubuntu Linux
任何Ubuntu用户都应安装的四大Linux应用程序
当然,这款程序不需要太多介绍。我们面对的是网上最庞大最完整的多媒体中心,由于丰富的插件,我们能够高度细化地定制其每一项功能。这是我们的Linux发行版不可或缺的必备软件。 我们可以通过运行以下命令来轻松安装Kodi:sudo apt install kodi。
|
28天前
|
弹性计算 安全 Linux
阿里云服务器ECS安装宝塔Linux面板、安装网站(新手图文教程)
本教程详解如何在阿里云服务器上安装宝塔Linux面板,涵盖ECS服务器手动安装步骤,包括系统准备、远程连接、安装命令执行、端口开放及LNMP环境部署,手把手引导用户快速搭建网站环境。
|
1月前
|
安全 Ubuntu Linux
如何安装Linux操作系统?
此时,您可以选择重新启动计算机,然后从硬盘上的Linux系统启动。以上是一个大致的安装过程。请注意,不同的Linux发行版可能会在细节上有所差异,因此在进行安装之前,请确保您阅读并理解了相应发行版的安装指南或文档。
|
1月前
|
Ubuntu Linux 数据安全/隐私保护
Win10安装Linux子系统教程!如何在Win10系统中安装Ubuntu!
登录系统后,输入cd /返回上一级,然后再输入“ls”查看一下系统文件目录,看看对不对!
|
1月前
|
Ubuntu Linux Shell
手把手教你安装适用于Linux的Windows子系统——Ubuntu
重启完成,你看看重新打开Ubuntu是不是发生了变化,等待几分钟,系统配置完成,根据提示设置用户名和密码即可
|
NoSQL Java Linux
linux 安装 neo4j简介
Neo4j是高性能NoSQL图形数据库,利用图结构存储数据。推荐使用JDK 11配合Neo4j 3.x版本。下载3.5.9版,通过`curl`命令在Linux上获取tar.gz文件,然后解压。配置`neo4j.conf`,调整内存设置,开启远程访问。执行`./bin/neo4j start`启动,通过`http://服务器IP:7474`访问,默认凭据是username: neo4j, password: neo4j,登录后应更改密码。
1184 1
|
存储 缓存 Ubuntu
【嵌入式开发】 Linux Kernel 下载 配置 编译 安装 及 驱动简介(二)
【嵌入式开发】 Linux Kernel 下载 配置 编译 安装 及 驱动简介(二)
308 0
|
Ubuntu 安全 Unix
【嵌入式开发】 Linux Kernel 下载 配置 编译 安装 及 驱动简介(一)
【嵌入式开发】 Linux Kernel 下载 配置 编译 安装 及 驱动简介(一)
381 0