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
Anonymous
Not applicable

Can't load environment resource to notebook

With the last update came environment resources; however, if I try to load one into my notebook, it fails. I click in the meatball menu of the file on "Open in notebook" and it gives me this code:

 

import matplotlib.pyplot as plt
import matplotlib.image as mpimg
# Load image
image = mpimg.imread(f"{notebookutils.nbResPath}/env/drake_tech_support.gif")
# Let the axes disappear
plt.axis('off')
# Plot image in the output
image_plot = plt.imshow(image)

 

This yields this error:

 

FileNotFoundError: [Errno 2] No such file or directory: '/env/drake_tech_support.gif'

 

"notebookutils.nbResPath" alone gives "/synfs/nb_resource", adding this manually into the file path doesn't change anything.

What is going on?

1 ACCEPTED SOLUTION
Hofpower
Frequent Visitor

Hi @Anonymous 

 

I tried to replicate your error but I was unable to. 

After creating a completely new environment with a .gif and attaching that to a new notebook I was able to load the image the exact same way as you did. 

Hofpower_0-1725002185108.png

 

Did you do anything else in the notebook before loading the .gif or did you change any other settings in your environment besides uploading the file?

 

If not I would advise you to try again and if the error still persists maybe contact MSFT support so they can check telemetry data on your session and environment.

 

BR

Martin

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @Anonymous,

Where are the file stored? Can you please share some more detail about these? For my test scenario, I upload a gif file to the Lakehouse files folder and environment and copy the file API path and relative path to use mpimg.imread path to read it and it works well.

import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import matplotlib.animation as animation

# Load the GIF file
gif_path = '/lakehouse/default/Files/Picture1.gif'

# Load the GIF file from environment
#gif_path = f"{notebookutils.nbResPath}/env/Test/Picture1.gif"

img = mpimg.imread(gif_path)

fig, ax = plt.subplots()
plt.axis("off")
im = ax.imshow(img)

plt.show(im)

If you failed to load resource, have you check if the used environment is include upload the files instead of the default environment?

Regards,

Xiaoxin Sheng

Hofpower
Frequent Visitor

Hi @Anonymous 

 

I tried to replicate your error but I was unable to. 

After creating a completely new environment with a .gif and attaching that to a new notebook I was able to load the image the exact same way as you did. 

Hofpower_0-1725002185108.png

 

Did you do anything else in the notebook before loading the .gif or did you change any other settings in your environment besides uploading the file?

 

If not I would advise you to try again and if the error still persists maybe contact MSFT support so they can check telemetry data on your session and environment.

 

BR

Martin

Anonymous
Not applicable

Yes, my environment also had the Int96RebaseModeInWrite set to CORRECTED (but I don't know how that would impact the resources). Anyway, I set up an all new workspace, environment and notebook and it worked, so whatever. Thanks!

Helpful resources

Announcements
May FBC25 Carousel

Fabric Monthly Update - May 2025

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

May 2025 Monthly Update

Fabric Community Update - May 2025

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