Installing RPostgres Library in Jupyter Notebook on Google Cloud Platform

221 Views Asked by At

I am trying to install the RPostgres library in R but I am using JupyterLab on Google Cloud Platform. I have found several suggestions on github.com/r-dbi/RPostgres, but none of them include information when working with Google Cloud Notebooks.

I continue to receive the error that RPostgres had "non-zero exit status" even after trying to install the package from the source code after placing it into the correct folder on JupyterLab:

install.packages("MyPath/RPostgres_1.3.3.tar.gz", repos=NULL, type='source')

I receive the same error message RPostgres had "non-zero exit status". Thanks.

1

There are 1 best solutions below

0
On BEST ANSWER

To fix this, you first need to install "libpq-dev" as this is a prerequisite as per SO answer. Follow the steps below to apply this in a Google Cloud Notebook.

  • Open a terminal in your JupyterLab and execute sudo apt-get install libpq-dev

    enter image description here

  • Open a R notebook, install Rpostgres using install.packages("RPostgres")

    enter image description here

  • Run library() and check if it was installed properly

    enter image description here

Please take note that the machine I used for testing is created in AI Platform -> Notebooks -> R instance.