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~

目录
相关文章
|
4天前
|
Web App开发 安全 Linux
Linux系统之安装Firefox浏览器
【7月更文挑战第8天】Linux系统之安装Firefox浏览器
26 8
|
6天前
|
存储 Ubuntu Java
【Linux】已解决:Ubuntu虚拟机安装Java/JDK
【Linux】已解决:Ubuntu虚拟机安装Java/JDK
12 1
|
4天前
|
Ubuntu 安全 Linux
Linux系统之安装Ninvaders太空入侵者小游戏
【7月更文挑战第9天】Linux系统之安装Ninvaders太空入侵者小游戏
9 0
|
9天前
|
存储 Linux
Linux文件的上和下,FinalShell文件右键可下文件,先选择root文件夹,然后把他文件往里面拖动,就可以下载了,命令下载,ls -l可以看当前文件目录,sz 文件名可下载,tab补,rz出上
Linux文件的上和下,FinalShell文件右键可下文件,先选择root文件夹,然后把他文件往里面拖动,就可以下载了,命令下载,ls -l可以看当前文件目录,sz 文件名可下载,tab补,rz出上
|
9天前
|
关系型数据库 MySQL Linux
Linux部署实战前言,MySQL在CentOS安装【单机软件】,MySQL的安装需要root权限,yum install mysql,systemctl enable mysqld开机自启的意思
Linux部署实战前言,MySQL在CentOS安装【单机软件】,MySQL的安装需要root权限,yum install mysql,systemctl enable mysqld开机自启的意思
|
10天前
|
Ubuntu Linux
Linux软件安装-Linux系统靠yum命令安装软件,yum命令是一个RPM包软件管理器,用于自动化安装配置Linux软件,.rpm是Linux包下的软件,yum install下载 wget re
Linux软件安装-Linux系统靠yum命令安装软件,yum命令是一个RPM包软件管理器,用于自动化安装配置Linux软件,.rpm是Linux包下的软件,yum install下载 wget re
|
4天前
|
数据挖掘 Linux 数据处理
Linux命令sprof详解
**`sprof`是Linux下的共享库性能分析工具,补充`gprof`,专注分析`.profile`文件以识别性能瓶颈。通过调用次数、执行时间数据优化资源和代码。使用参数如`-F`、`-I`、`-d`进行定制化分析。示例:先设置`LD_PROFILE`环境变量,运行程序生成`.profile`,然后用`sprof`分析。注意需用`-g`编译程序,并在代表性的负载下分析。结合其他工具如`perf`、`valgrind`提升分析效果。**
|
4天前
|
存储 数据挖掘 Linux
Linux命令split详解:大文件处理的得力助手
`split`命令是Linux用于将大文件分割成小文件的工具,常用于日志处理、备份。它支持按行数(-l)、字节数(-b)分割,并能自定义输出文件名(-a, -d)。例如,`split -b 10M largefile.txt smallfile_`会按10MB切割`largefile.txt`,生成`smallfile_`开头的文件。注意确保磁盘空间充足,避免文件名冲突,并备份原始文件。结合其他命令使用,能提高文件管理效率。
|
23小时前
|
关系型数据库 MySQL Linux
Linux命令systemctl详解
`systemctl`是Linux系统用于管理systemd服务的核心命令,它与systemd守护进程交互,实现启动、停止、重启服务及查看服务状态等功能。主要参数包括`start`、`stop`、`restart`、`status`、`enable`和`disable`等。例如,启动Apache服务使用`systemctl start httpd.service`,查看服务状态用`systemctl status &lt;service&gt;`。使用时需注意权限,服务名通常以`.service`结尾,但命令中可省略。最佳实践包括利用tab键补全、定期查看服务状态和合理配置服务自启。
|
23小时前
|
存储 安全 Linux
Linux命令sync详解
`sync`命令在Linux中用于将内存缓冲区的数据强制写入磁盘,保证数据持久性和一致性。它在关机、重启或重要文件操作前后使用,以防数据丢失。工作原理是强制将内存中的数据同步到磁盘,特点是阻塞式执行且通常无需参数。常见用法包括安全关机、数据备份和配置文件修改后确保更改生效。应注意,过度使用可能影响性能,应适时使用`fsck`检查文件系统一致性。