2017-02-17 185 views
28

我只是浪費一整天試圖找出如何安裝udunits2包能夠安裝單位包能夠安裝ggforce和GGRAPH包。安裝udunits2包R3.3

我試圖在Ubuntu 16.04安裝它,R> = 3.3,因爲ggforce爲r 3.3下建造的。

我跟着這些指示在這裏: https://github.com/edzer/units/issues/1

雖然我libudunits-2.0和udunits我的機器上安裝(如命令和apt-get安裝udunits2沒有找到udunits2包),以及路徑libudunits-2和udunits我的$ PATH位置,在R'當我嘗試安裝udunits2,單位或ggforce我收到一個錯誤,指出,

--* installing *source* package ‘udunits2’ ... 
** package ‘udunits2’ successfully unpacked and MD5 sums checked 
checking for gcc... gcc 
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 we are using the GNU C compiler... yes 
checking whether gcc accepts -g... yes 
checking for gcc option to accept ISO C89... none needed 
checking for XML_ParserCreate in -lexpat... yes 
checking how to run the C preprocessor... gcc -E 
checking for grep that handles long lines and -e... /bin/grep 
checking for egrep... /bin/grep -E 
checking for ANSI C header files... yes 
checking for sys/types.h... yes 
checking for sys/stat.h... yes 
checking for stdlib.h... yes 
checking for string.h... yes 
checking for memory.h... yes 
checking for strings.h... yes 
checking for inttypes.h... yes 
checking for stdint.h... yes 
checking for unistd.h... yes 
checking udunits2.h usability... no 
checking udunits2.h presence... no 
checking for udunits2.h... no 
checking for ut_read_xml in -ludunits2... no 
-----Error: libudunits2.a not found----- 
    If the udunits2 library is installed in a non-standard location, 
    use --configure-args='--with-udunits2-lib=/usr/local/lib' for 
    example, 
    or --configure-args='--with-udunits2-include=/usr/include/udunits2' 
    replacing paths with appropriate values for your installation. 
    You can alternatively use the UDUNITS2_INCLUDE and UDUNITS2_LIB 
    environment variables. 
    If udunits2 is not installed, please install it. 
    It is required for this package. 
    ERROR: configuration failed for package ‘udunits2’ 
* removing ‘/home/fjay/R/x86_64-pc-linux-gnu-library/3.3/udunits2’ 
* restoring previous ‘/home/fjay/R/x86_64-pc-linux-gnu-library 
/3.3/udunits2’ 

The downloaded source packages are in 
    ‘/tmp/Rtmp0syxnJ/downloaded_packages’ 
Warning message: 
In install.packages("udunits2", lib = "/home/fjay/R/x86_64-pc-linux- 
gnu-library/3.3") : 
installation of package ‘udunits2’ had non-zero exit status 
> 

所以,嗯,它是尋找udunits2.h和libudunits2.a files .... 所以,我從CRAN下載了udunits2,解壓縮了它並且pu在我的R庫中。 然後,如果我把庫(udunits2,lib.loc =「我的庫目錄」),我得到一個錯誤,說它沒有安裝。所以,當我安裝.package('udunits2',repo = NULL,libconfig.args ='--with-udunits2-lib =/home/fjay/R/x86_64-pc-linux-gnu-library/3.3')或install.packages('units',....)或者install.packages('ggforce',...)它仍然在尋找這些文件......並且在檢查udunits2包後,這些文件不在的udunits2文件夾。

如果有人知道如何安裝此udunits2包,請幫助我!

回答

55

我有同樣的問題。繼從here你有第一次的答案安裝-dev版本的udunits

sudo apt-get install libudunits2-dev 

隨後的udunits2ggforce安裝不用任何錯誤。

+1

在CentOS7,它應該是'須藤yum的安裝udunits2-devel'。 – Phil

+0

當這個_awesome_答案救了我時,我正在走向與OP相同的路線(「我只是浪費了整整一天......」)。 – Gabriel

6

我已經安裝了udunits2包在R上的Linux平臺(紅帽)沒有互聯網connnection上。

我也有這個問題。

首先,我在(/usr/include/udunits2)的Linux示例中安裝了udunits2(而不是R包udunits2)。

其次,運行此命令的工作: install.packages("udunits2_0.13.tar.gz",configure.args='--with-udunits2-include=/usr/include/udunits2')

我希望這方面的經驗可以幫助你。

+0

第二個命令可能應該讀'install.packages( 「udunits2」,configure.args = ' - 與-udunits2-包括=的/ usr /包括/ udunits2')'無udunits版本(udunits2_0.13.tar.gz不可用於最新版本的R)。這在Fedora 26上適用於我。 – giocomai