R:(只在源表中可用的包,可能需要C/ c++ /Fortran编译)

时间:2022-02-13 23:40:58

I'm trying to install the 'yaml' and 'stringi' packages in R-Studio, and it keeps giving me these errors:

我试着在R-Studio中安装“yaml”和“stringi”软件包,它不断给我这些错误:

> install.packages("stringi")
Package which is only available in source form, and may need compilation of C/C++/Fortran: ‘stringi’
These will not be installed

or

> install.packages('yaml')
Package which is only available in source form, and may need compilation of C/C++/Fortran: ‘yaml’
These will not be installed

How can I get these to install properly?

怎样才能正确安装这些设备?

4 个解决方案

#1


21  

This came up again a few days ago and I believe it is caused because of the (temporary) outage of some of the mirrors at cran. If you type:

这在几天前又出现了,我认为这是由于cran的一些镜像的暂时中断造成的。如果你输入:

> getOption('repos')
                                CRAN                            CRANextra 
           "http://cran.rstudio.com" "http://www.stats.ox.ac.uk/pub/RWin" 
attr(,"RStudio")
[1] TRUE

You will see that R uses "http://cran.rstudio.com" by default to look for a package to download. If you see the cran mirrors web page you can see at the top that "http://cran.rstudio.com" actually redirects you to different servers world wide (I assume according to the geo location).

您将看到R在默认情况下使用“http://cran.rstudio.com”寻找一个包来下载。如果您看到cran镜像web页面,您可以在顶部看到“http://cran.rstudio.com”实际上是将您重定向到世界各地的不同服务器(根据geo位置,我假设)。

When I had the above issue, I solved it by manually changing the repo to one of the urls in the link provided. I suggest you use a different country (or even continent) in case you receive the above error.

当我有上述问题时,我通过手动将repo更改为链接提供的一个url解决了这个问题。我建议您使用一个不同的国家(甚至是大陆),以防您收到上述错误。

I provide below some of the urls in case the link above changes:

我提供下面的一些url,以防止上述链接更改:

  1. Brazil http://nbcgib.uesc.br/mirrors/cran/
  2. 巴西http://nbcgib.uesc.br/mirrors/cran/
  3. Italy http://cran.mirror.garr.it/mirrors/CRAN/
  4. 意大利http://cran.mirror.garr.it/mirrors/CRAN/
  5. Japan http://cran.ism.ac.jp/
  6. 日本http://cran.ism.ac.jp/
  7. South Africa http://r.adu.org.za/
  8. 南非http://r.adu.org.za/
  9. USA https://cran.cnr.Berkeley.edu/
  10. 美国https://cran.cnr.Berkeley.edu/

You need to run the function install.packages as follows:

您需要运行函数安装。包如下:

install.packages('<package_name>', repo='http://nbcgib.uesc.br/mirrors/cran/')
#or any other url from the list or link

One of them should work.

其中一个应该管用。

#2


7  

You need to install RTools to build packages like this. After you install it, it will prompt you "Do you want to attempt to install these from source? y/n:" (see the picture below) and you need to answer "y" and it will try yo compile it from C code.

您需要安装RTools来构建这样的包。安装之后,它会提示您“您想尝试从源代码安装这些吗?”y/n:“(请看下图),你需要回答“y”,它会尝试从C代码中编译它。

R:(只在源表中可用的包,可能需要C/ c++ /Fortran编译)

#3


3  

Struggled with this issue today, solved it for now by first downloading the windows binary and then installing e.g.

在今天的这个问题上,我们先下载windows二进制文件,然后再安装。

install.packages("https://cran.r-project.org/bin/windows/contrib/3.3/stringi_1.1.1.zip", repos =NULL)

Just go to https://cran.r-project.org/ and then R Binaries/Windows/contrib and copy the url as argument to install.packages()

只需要访问https://cran.r project.org/,然后是R二进制文件/Windows/设计,并将url作为参数复制到install.packages()

#4


2  

Install the package from a zip file - downloadable from the r-project website.

从一个zip文件安装包-从r项目网站下载。

In basic R

在基本的R

  1. go to Packages
  2. 去包
  3. Install packages from local files.
  4. 从本地文件安装包。

In RStudio

在RStudio

  1. go to Packages
  2. 去包
  3. Install packages
  4. 安装包
  5. Install from Package Archive File.
  6. 从包存档文件安装。

#1


21  

This came up again a few days ago and I believe it is caused because of the (temporary) outage of some of the mirrors at cran. If you type:

这在几天前又出现了,我认为这是由于cran的一些镜像的暂时中断造成的。如果你输入:

> getOption('repos')
                                CRAN                            CRANextra 
           "http://cran.rstudio.com" "http://www.stats.ox.ac.uk/pub/RWin" 
attr(,"RStudio")
[1] TRUE

You will see that R uses "http://cran.rstudio.com" by default to look for a package to download. If you see the cran mirrors web page you can see at the top that "http://cran.rstudio.com" actually redirects you to different servers world wide (I assume according to the geo location).

您将看到R在默认情况下使用“http://cran.rstudio.com”寻找一个包来下载。如果您看到cran镜像web页面,您可以在顶部看到“http://cran.rstudio.com”实际上是将您重定向到世界各地的不同服务器(根据geo位置,我假设)。

When I had the above issue, I solved it by manually changing the repo to one of the urls in the link provided. I suggest you use a different country (or even continent) in case you receive the above error.

当我有上述问题时,我通过手动将repo更改为链接提供的一个url解决了这个问题。我建议您使用一个不同的国家(甚至是大陆),以防您收到上述错误。

I provide below some of the urls in case the link above changes:

我提供下面的一些url,以防止上述链接更改:

  1. Brazil http://nbcgib.uesc.br/mirrors/cran/
  2. 巴西http://nbcgib.uesc.br/mirrors/cran/
  3. Italy http://cran.mirror.garr.it/mirrors/CRAN/
  4. 意大利http://cran.mirror.garr.it/mirrors/CRAN/
  5. Japan http://cran.ism.ac.jp/
  6. 日本http://cran.ism.ac.jp/
  7. South Africa http://r.adu.org.za/
  8. 南非http://r.adu.org.za/
  9. USA https://cran.cnr.Berkeley.edu/
  10. 美国https://cran.cnr.Berkeley.edu/

You need to run the function install.packages as follows:

您需要运行函数安装。包如下:

install.packages('<package_name>', repo='http://nbcgib.uesc.br/mirrors/cran/')
#or any other url from the list or link

One of them should work.

其中一个应该管用。

#2


7  

You need to install RTools to build packages like this. After you install it, it will prompt you "Do you want to attempt to install these from source? y/n:" (see the picture below) and you need to answer "y" and it will try yo compile it from C code.

您需要安装RTools来构建这样的包。安装之后,它会提示您“您想尝试从源代码安装这些吗?”y/n:“(请看下图),你需要回答“y”,它会尝试从C代码中编译它。

R:(只在源表中可用的包,可能需要C/ c++ /Fortran编译)

#3


3  

Struggled with this issue today, solved it for now by first downloading the windows binary and then installing e.g.

在今天的这个问题上,我们先下载windows二进制文件,然后再安装。

install.packages("https://cran.r-project.org/bin/windows/contrib/3.3/stringi_1.1.1.zip", repos =NULL)

Just go to https://cran.r-project.org/ and then R Binaries/Windows/contrib and copy the url as argument to install.packages()

只需要访问https://cran.r project.org/,然后是R二进制文件/Windows/设计,并将url作为参数复制到install.packages()

#4


2  

Install the package from a zip file - downloadable from the r-project website.

从一个zip文件安装包-从r项目网站下载。

In basic R

在基本的R

  1. go to Packages
  2. 去包
  3. Install packages from local files.
  4. 从本地文件安装包。

In RStudio

在RStudio

  1. go to Packages
  2. 去包
  3. Install packages
  4. 安装包
  5. Install from Package Archive File.
  6. 从包存档文件安装。