March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
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?
Solved! Go to Solution.
Hi @snraedsoeia
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.
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
Hi @snraedsoeia,
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
Hi @snraedsoeia
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.
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
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!
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
8 | |
1 | |
1 | |
1 | |
1 |
User | Count |
---|---|
13 | |
4 | |
3 | |
3 | |
2 |