ubuntu 16.04 LTS 上的 rgdal 安装难度 [英] rgdal installation difficulty on ubuntu 16.04 LTS
问题描述
我搜索了一个可以帮助我避免重复的答案,但无济于事.
I searched for an answer helping my situation to avoid duplicate, but to no avail.
我想在 ubuntu 16.04 LTS 上将rgdal"包安装到 R.如果我在 R-studio 中编码如下
I want to install 'rgdal' package to R on ubuntu 16.04 LTS. If I code in R-studio as follows
install.packages("rgdal", type = "source")
它给出了以下错误;
Installing package into ‘/home/kocesat/R/x86_64-pc-linux-gnu-library/3.2’
(as ‘lib’ is unspecified)
Warning in install.packages :
package ‘rgdal’ is not available (for R version 3.2.3)
然后我尝试安装 libgdal1-dev , libproj-dev 如下
Then I try to install libgdal1-dev , libproj-dev as the following
$ sudo apt-get install libgdal1-dev libproj-dev
它成功安装了开发文件.然后我尝试使用相同的命令在 R-studio 中再次安装rgdal".它再次不起作用.
It succesfully installed the dev files.Then I tried to install again "rgdal" in R-studio with the same command. It did not work again.
然后我安装了自制软件并尝试使用 gdal
Then I installed homebrew and try to get gdal with
~$ brew install gdal
它回来了
Error: undefined method `rebuild' for
#<BottleSpecification:0x000000015ddc60>
Please report this bug:
https://github.com/Linuxbrew/linuxbrew/blob/master/share/doc/homebrew
/Troubleshooting.md#troubleshooting
/home/kocesat/.linuxbrew/Library/Taps/homebrew/homebrew-core/Formula
/jpeg.rb:9:in `block in <class:Jpeg>'
/home/kocesat/.linuxbrew/Library/Homebrew/software_spec.rb:91:in
`instance_eval'
/home/kocesat/.linuxbrew/Library/Homebrew/software_spec.rb:91:in `bottle'
/home/kocesat/.linuxbrew/Library/Homebrew/formula.rb:1729:in `bottle'
/home/kocesat/.linuxbrew/Library/Taps/homebrew/homebrew-core/Formula
/jpeg.rb:7:in `<class:Jpeg>'
/home/kocesat/.linuxbrew/Library/Taps/homebrew/homebrew-core/Formula
/jpeg.rb:1:in `load_formula'
/home/kocesat/.linuxbrew/Library/Homebrew/formulary.rb:21:in `module_eval'
/home/kocesat/.linuxbrew/Library/Homebrew/formulary.rb:21:in
`load_formula'
/home/kocesat/.linuxbrew/Library/Homebrew/formulary.rb:34:in
`load_formula_from_path'
/home/kocesat/.linuxbrew/Library/Homebrew/formulary.rb:83:in `load_file'
/home/kocesat/.linuxbrew/Library/Homebrew/formulary.rb:74:in `klass'
/home/kocesat/.linuxbrew/Library/Homebrew/formulary.rb:70:in `get_formula'
/home/kocesat/.linuxbrew/Library/Homebrew/formulary.rb:207:in `factory'
/home/kocesat/.linuxbrew/Library/Homebrew/dependency.rb:32:in `to_formula'
/home/kocesat/.linuxbrew/Library/Homebrew/dependency.rb:93:in `block in
expand'
/home/kocesat/.linuxbrew/Library/Homebrew/dependencies.rb:9:in `each'
/home/kocesat/.linuxbrew/Library/Homebrew/dependencies.rb:9:in `each'
/home/kocesat/.linuxbrew/Library/Homebrew/dependency.rb:80:in `expand'
/home/kocesat/.linuxbrew/Library/Homebrew/formula.rb:1223:in
`recursive_dependencies'
/home/kocesat/.linuxbrew/Library/Homebrew/requirement.rb:196:in `expand'
/home/kocesat/.linuxbrew/Library/Homebrew/formula.rb:1229:in `recursive_requirements'
/home/kocesat/.linuxbrew/Library/Homebrew/formula_installer.rb:313:in `expand_requirements'
/home/kocesat/.linuxbrew/Library/Homebrew/formula_installer.rb:263:in `compute_dependencies'
/home/kocesat/.linuxbrew/Library/Homebrew/formula_installer.rb:130:in `verify_deps_exist'
/home/kocesat/.linuxbrew/Library/Homebrew/formula_installer.rb:123:in `prelude'
/home/kocesat/.linuxbrew/Library/Homebrew/cmd/install.rb:231:in `install_formula'
/home/kocesat/.linuxbrew/Library/Homebrew/cmd/install.rb:93:in `block in install'
/home/kocesat/.linuxbrew/Library/Homebrew/cmd/install.rb:93:in `each'
/home/kocesat/.linuxbrew/Library/Homebrew/cmd/install.rb:93:in `install'
/home/kocesat/.linuxbrew/Library/brew.rb:84:in `<main>'
现在,我该怎么办?任何输入将不胜感激.
Now, what I should I do? Any input will be appreciated.
推荐答案
这是我使用最新的 R-cran PPA 存储库在 Ubuntu 16.04 上安装的内容:
Here is what I use to install on Ubuntu 16.04 with the latest R-cran PPA repositories:
sudo add-apt-repository 'deb https://mirror.ibcp.fr/pub/CRAN/bin/linux/ubuntu xenial/'
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9
sudo apt-get update
sudo apt-get install libgdal1-dev libproj-dev libgeos-dev
sudo apt-get install r-base-core
您可以根据您的位置使用另一个 CRAN 镜像:https://cran.r-project.org/mirrors.html
You can use another CRAN mirror depending on your location: https://cran.r-project.org/mirrors.html
然后,install.packages("rgdal")
应该可以工作了.
Then, install.packages("rgdal")
should work.
如果您想要 Ubuntu LTS 版本上的最新空间库,您还可以使用 ubuntugis
PPA:https://launchpad.net/~ubuntugis/+archive/ubuntu/ppa
If you want the latest spatial libraries on Ubuntu LTS versions, you can also use ubuntugis
PPA: https://launchpad.net/~ubuntugis/+archive/ubuntu/ppa
sudo add-apt-repository 'deb http://ppa.launchpad.net/ubuntugis/ppa/ubuntu xenial main'
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 314DF160
sudo apt update
sudo apt upgrade
这篇关于ubuntu 16.04 LTS 上的 rgdal 安装难度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!