Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us at FabCon Vienna from September 15-18, 2025, for the ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM. Get registered

Reply
cahenning
Microsoft Employee
Microsoft Employee

Custom Libraries in Fabric Notebook Environment

I'm trying to use some custom libraries in a notebook by uploading JAR files to my notebook environment in the "Custom libraries" section. I've verified that the jars are attached with the "spark.sparkContext.listJars.foreach(println)" command, but the namespaces still aren't recognized in my notebook in the import statement.

 

I've used this same set of libraries in a Synapse Analytics notebook by assigning them as workspace packages. That notebook in synapse and my Fabric notebook are using the same spark and scala versions.

 

Does anyone have any pointers about why the custom library import might be failing?

1 REPLY 1
burakkaragoz
Community Champion
Community Champion

Hi @cahenning ,

 

I get where you’re coming from, this can be confusing. Even if you see the JAR files listed with sparkContext.listJars, sometimes Fabric Notebooks have a few quirks with actually making those classes available for import in the notebook session.

A couple things I’d check:

  • Make sure the JARs are uploaded to the right scope (some environments want them at workspace level, some at notebook level, and sometimes per-session).
  • Try restarting the notebook kernel after uploading the JARs, just to be sure the new libraries are loaded fresh.
  • Double check the JAR isn’t missing dependencies – sometimes a JAR works in Synapse because of environment differences, but Fabric might not have those extra libraries by default.
  • Also, confirm the class path in your import matches exactly what’s inside the JAR (it’s easy to miss a package path or typo).

If you’ve tried all that, sometimes it’s just a limitation in how Fabric handles class loading for custom libraries. You could try submitting the JAR via a %run or %dep magic command, if Fabric supports those (I’ve seen this help in some Spark setups).

If my response resolved your query, kindly mark it as the Accepted Solution to assist others. Additionally, I would be grateful for a 'Kudos' if you found my response helpful.

Helpful resources

Announcements
May FBC25 Carousel

Fabric Monthly Update - May 2025

Check out the May 2025 Fabric update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.