Resolving package or namespace loading error

Learn how to resolve package or namespace loading errors in a Databricks notebook.

Written by Adam Pavlacka

Last published at: May 20th, 2022

This article explains how to resolve a package or namespace loading error.

Problem

When you install and load some libraries in a notebook cell, like:

%r

library(BreakoutDetection)

You may get a package or namespace error:

Loading required package: BreakoutDetection:

Error : package or namespace load failed for ‘BreakoutDetection’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
namespace ‘rlang’ 0.3.1 is already loaded, but >= 0.3.4 is required

Cause

While a notebook is attached to a cluster, the R namespace cannot be refreshed. When an R package depends on a newer package version, the required package is downloaded but not loaded. When you load the package, you can observe this error.

Solution

To resolve this error, install the required package as a cluster-installed library (AWS | Azure | GCP).

Was this article helpful?