Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreWe've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
I'm attempting to create a user defined function as a proof of concept. I've selected the library I want from the dropdown (python-pptx) but still receive an error when I try to import and use it as if it is not recoginizing the full name. Suggestions to fix or a work-around I can use for now?
Solved! Go to Solution.
Hi @clbfkp
This is a fairly common behavior in Fabric and it’s related to how Library Management vs the active notebook session works.
Even if you add the library from the menu, it doesn’t get injected automatically into the current session, which is why you’re seeing import errors or incorrect module resolution.
Try this:
1.Quick solution (for PoC / testing)
Thenyou should be able to import it with:
from pptx import Presentation
2.Proper solution (recommended)
For a stable setup:
3. How to verify installation
You can check it using pip show python-pptx.
If it doesn’t appear, it means it’s not installed in the current session, even if it shows in the UI.
Take a look and try this.
If it still fails, let me know the exact error you’re getting.
If this helps solve your problem, I’d appreciate it if you could mark it as the accepted solution and give it a like
Thanks!
This is a user defined function, not a standard notebook. Reading some of the Microsoft documentation, it looks like I am unable to pip install libraries and must go through the library manager.
Hi @clbfkp
Hope everything’s going smoothly on your end. I wanted to check if the issue got sorted. if you have any other issues please reach community.
Hey @clbfkp,
The error occurs because the package name and the module name for this library are different. This is common in Python.
# You install it as:
pip install python-pptx
--------------------------------
# But you import it in code as:
import pptx, or
from pptx import PresentationThe "python-" prefix in the PyPI is just a naming convention used by the author. It simply tells that it is a Python library. Module name inside the package is "pptx", which is what Python looks for when you write an import statement.
Same pattern is seen in other popular libraries, for example, python-dotenv is imported as dotenv, pillow is imported as PIL, scikit-learn as sklearn.
Hope this helps!
Hi @clbfkp
Thank you for reaching out to the Microsoft Fabric Forum Community.
@Aparnaa_MS @arabalca Thanks for the inputs.
I hope the information provided by users was helpful. If you still have questions, please don't hesitate to reach out to the community.
Hi @clbfkp
If my comment helped solve your question, it would be great if you could mark it as the accepted solution. It helps others with the same issue and it also motivates me to keep contributing.
Thanks a lot. I really appreciate it
Hi @clbfkp ,
Echoing what @arabalca mentioned — installing the library directly within a Fabric Notebook using `%pip install python-pptx` is a valid and quick approach, especially for POC scenarios where you just need to unblock yourself fast.
A couple of additional things from my own testing:
- Double-check the publish status before running your function. Even after adding the library via Library Management, make sure the publish has fully completed and a success confirmation is shown — it's easy to assume it went through when it actually didn't.
- Try a different version of python-pptx: Try specifying a stable older version of python-pptx instead of the latest, as newer versions sometimes have platform-specific dependencies that may not be compatible with the Fabric runtime environment
I tested this myself — after switching to an alternate version and publishing, the code ran successfully even though a warning was still displayed in the editor.
Hope this contributes to solving your error.
Thanks!
Hi @clbfkp
This is a fairly common behavior in Fabric and it’s related to how Library Management vs the active notebook session works.
Even if you add the library from the menu, it doesn’t get injected automatically into the current session, which is why you’re seeing import errors or incorrect module resolution.
Try this:
1.Quick solution (for PoC / testing)
Thenyou should be able to import it with:
from pptx import Presentation
2.Proper solution (recommended)
For a stable setup:
3. How to verify installation
You can check it using pip show python-pptx.
If it doesn’t appear, it means it’s not installed in the current session, even if it shows in the UI.
Take a look and try this.
If it still fails, let me know the exact error you’re getting.
If this helps solve your problem, I’d appreciate it if you could mark it as the accepted solution and give it a like
Thanks!
This is a user defined function, not a standard notebook. Reading some of the Microsoft documentation, it looks like I am unable to pip install libraries and must go through the library manager.
Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 13 | |
| 8 | |
| 7 | |
| 5 | |
| 3 |