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.
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__): <text>: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')'