I want to install the rJDBC package in the R environment of my Amazon SageMaker AI notebook instance.
To install the rJDBC package in the R environment of your SageMaker AI notebook instance, complete the following steps:
Open the SageMaker AI console.
In the navigation pane, choose Notebook, and then choose Notebook instances.
Select the notebook instance where you want to install the rJDBC package.
Choose Open JupyterLab.
Confirm that the notebook can connect to the internet so that you can download the rJDBC package from the Anaconda repository. Note: To install the package without internet access, see Private package installation in Amazon SageMaker AI running in internet-free mode.
Open a new terminal and run the following commands in the following sequence:
source activate R
conda install -y -c r r-rjdbc
conda deactivate
Open a new Jupyter notebook with the R kernel.
Run the following command in a cell:
dyn.load('/home/ec2-user/anaconda3/envs/R/lib/jvm/lib/server/libjvm.so')
To confirm that you installed the rJDBC package, run the following command in the Jupyter notebook:
library(RJDBC)
The output must look similar to the following example:
Loading required package: DBI Loading required package: rJava
To make the rJDBC package persist even after you restart the notebook instance, create a custom persistent Conda installation on your notebook instance's volume.
Access notebook instances
External library and kernel installation
How do I install Python packages in a conda environment on a SageMaker AI notebook instance?
Andre_J
asked 6 years ago
User-9138361
asked 4 years ago
rePost-User-3241913
asked 3 years ago
AWS-User-7414915
asked 8 years ago
Hira Joshi
Vinny Saulys
published 2 years ago