2017-06-06 124 views
2

我搜索了一個答案,幫助我避免重複的情況,但無濟於事。rgdal安裝難度在Ubuntu 16.04 LTS

我想在ubuntu 16.04 LTS上安裝'rgdal'軟件包到R.如果我在R-studio中編碼如下

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下以下

$ sudo apt-get install libgdal1-dev libproj-dev 

它成功地安裝了開發files.Then我的R-Studio與嘗試重新安裝 「rgdal」相同的命令。它沒有再次工作。

然後我安裝自制軟件,並得到與

~$ 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>' 

現在,我我應該怎麼辦?任何輸入將不勝感激。

+0

的可能的複製[如何解決長期在Ubuntu Howbrew路徑問題(https://開頭計算器.com/questions/40317870/how-to-fix-howbrew-path-issue-permanent-in-Ubuntu) – LuFFy

+0

也許你可以嘗試用'apt'代替linuxbrew http://www.sarasafavi.com/installing-gdalogr -on-ubuntu.html 另外,你的R還挺舊的。您可能需要考慮更新它,因爲最新的CRAN版本取決於'R> 3.3.0'。 https://cran.r-project.org/web/packages/rgdal/index.html –

回答

7

以下是我使用了最新的R-CRAN PPA庫在Ubuntu 16.04安裝:

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

然後,install.packages("rgdal")應該管用。

如果你想在Ubuntu LTS版本的最新空間庫,你也可以使用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 
+0

這工作。謝謝你... – Quantes

+0

相同的問題,完美的工作,謝謝你! – puslet88

+0

真棒推薦! –