1

I am trying to run cells in a Databricks notebook with the R commands to install the packages 'raster', 'rgdal', and 'ncdf4'. Whenever I run it, I get the following error, although when I install the packages locally in RStudio, everything works fine.

enter image description here

error message: Error in library("ncdf4") : there is no package called ‘ncdf4’ Some( Error in library("ncdf4"): there is no package called ‘ncdf4’ )

I found the specific Linux library for the package ncdf4, however, when I tried running the init script

#!/bin/bash
apt-get update
apt-get -y install libnetcdf-dev

I got the following syntax error after following the instructions in your answer

Error in parse(text = DATABRICKS_CURRENT_TEMP_CMD__) : 
<text>:3:9: unexpected symbol
2: #!/bin/bash
3: apt-get update
       ^
Some(<code style = 'font-size:10p'> Error in parse(text = 
DATABRICKS_CURRENT_TEMP_CMD__): &lt;text&gt;:3:9: unexpected symbol 
</code>)

I also received an error when implementing the single node solution

%sh
apt-get update
apt-get -y install libnetcdf-dev

which looked like

Hit:1 http://security.ubuntu.com/ubuntu focal-security InRelease
Hit:2 https://repos.azul.com/zulu/deb stable InRelease
Hit:3 http://archive.ubuntu.com/ubuntu focal InRelease
Hit:4 http://archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:5 http://archive.ubuntu.com/ubuntu focal-backports InRelease
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
libnetcdf-dev is already the newest version (1:4.7.3-1).
0 upgraded, 0 newly installed, 0 to remove and 48 not upgraded.
/bin/bash: -c: line 3: syntax error near unexpected token `'ncdf4''
/bin/bash: -c: line 3: `install.packages('ncdf4')'
M_Potter
  • 11
  • 3
  • This package depends on the specific Linux libraries that aren't installed by default. Follow instructions in this answer: https://stackoverflow.com/questions/70725299/unable-to-use-some-packages-on-databricks-r-notebook/70728873#70728873 – Alex Ott Jun 11 '22 at 09:15
  • Does this answer your question? [Unable to use some packages on Databricks R Notebook](https://stackoverflow.com/questions/70725299/unable-to-use-some-packages-on-databricks-r-notebook) – Alex Ott Jun 11 '22 at 09:15
  • Hi, welcome to SO. In the order to enhance the chances of getting useful answers, it is a good practice to (I) include the code you have tried already; (ii) include all code, and error messages, in the text (formated as code or citation), not as an image. The error you pasted as text is for the part you run `library()`, for the package which was unable to install. The previous lines of the error message are more important to get the answers you need. – hamagust Jun 11 '22 at 20:34
  • It pointed me in the right direction I think, but I have a syntax error with both of my current solutions – M_Potter Jun 13 '22 at 14:54

0 Answers0