简体   繁体   English

无法在 Databricks R Notebook 上使用某些包

[英]Unable to use some packages on Databricks R Notebook

I tried a lot to solve my problems through the previous questions of stackoverflow, and using other sites, but I failed.我通过之前的stackoverflow问题以及使用其他网站尝试了很多解决我的问题,但我失败了。 Thus, my problems are as follows:因此,我的问题如下:

I am trying to install the ggmap package:我正在尝试安装ggmap package:

install.packages("ggmap", lib="/databricks/spark/R/lib")

but I get this error:但我收到此错误:

rjcommon.h:11:10: fatal error:jpeglib.h: No such file or directory

Maybe useful info:也许有用的信息:

x64 Windows 10

R version 4.1.1 (2021-08-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.3 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0

[1]"/local_disk0/.ephemeral_nfs/envs/rEnv-adfa3b9f-34f8-4494-af74-4cf4c85bece3"
[2] "/databricks/spark/R/lib"                                                   
[3] "/local_disk0/.ephemeral_nfs/cluster_libraries/r"                           
[4] "/usr/local/lib/R/site-library"                                             
[5] "/usr/lib/R/site-library"                                                   
[6] "/usr/lib/R/library" 

I was also trying to install the GADMTools package:我还尝试安装GADMTools package:

install.packages("GADMTools", lib="/databricks/spark/R/lib")

and the errors were as follows:错误如下:

Configuration failed because libudunits2.so was not found and
configure: error: gdal-config not found or not executable

The ggmap package I tried to install it through terminal: ggmap package 我尝试通过终端安装它:

PS C:\Users\olthpor\scoop\buckets\main>sudo apt-get install libjpeg-dev

and the result was:结果是:

Start-process: This command cannot be run due to the error: The system cannot find the file 
specified.
At C:\Users\olthpor\Documents\Scripts\sudo.ps1:1 char:103
+...ngth -gt 1){start-process arg[0]-ArgumentList args[1...args.Lengt...
+ CategoryInfo         : InvalidOperation:(:)[Start-process], InvalidOperationException
+ FullyQualifiedErrorId: InvalidOperationException, 
Microsoft.PowerShell.Commands.StartProcessCommand

I'm irrelevant to use Linux commands on Windows.我与在 Windows 上使用 Linux 命令无关。

The problem is that some system packages aren't installed that are required for compilation of your R packages.问题是没有安装编译 R 包所需的某些系统包。 Like, libjpeg-dev for ggmap , etc.比如,用于ggmap libjpeg-dev等。

You can solve problem as following:您可以解决以下问题:

  • on Community edition or if you're using Single Node cluster, then it could be enough to do (you need to find which Ubuntu packages are required for your libraries):在社区版上,或者如果您使用的是单节点集群,那么这样做就足够了(您需要找到您的库需要哪些 Ubuntu 包):
%sh
apt-get update
apt-get -y install libjpeg-dev
  • if you use multi-node cluster, then you need to use cluster init script that will install dependencies on all nodes of the cluster (as library needs to be compiled on each node as well).如果您使用多节点集群,那么您需要使用集群初始化脚本,该脚本将在集群的所有节点上安装依赖项(因为库也需要在每个节点上编译)。 Content of the script is similar to the command above, just need to add so-called shebang:脚本内容与上面的命令类似,只需要添加所谓的shebang即可:
#!/bin/bash

apt-get update
apt-get -y install libjpeg-dev

install this script as described in documentation, and restart the cluster.按照文档中的说明安装此脚本,然后重新启动集群。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM