- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
mssparkutils inside python package
Hi,
I've started to build a set of helper functions for my fabric notebooks to do things like refreshes and getting attachments from emails. Mostly just wrappers round msal and requests.
Code runs fine direct in a notebook. I've then wrapped it in a wheel file and imported which again works. However when executing the imported code, the notebook says mssparkutils isn't recognised. Any ideas hiw I reference it correctly?
Code is in:
https://github.com/ArchwayTrust/Fabric-PythonHelper
thanks
Ben
Ben Dobbs
LinkedIn | Twitter | Blog
Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @bcdobbs
Thanks for explaining the issue.
Please install dummy notebookutils in local environment. This will solve your issue.
pip install dummy-notebookutils
For more information please refer to this link: dummy-notebookutils
Hope this helps. Please let me know if you have any further questions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've gone back and built a very simple example.
Inside a notebook I can run:
def run_me_local():
help(mssparkutils)
run_me_local()
and it happily returns the help description for mssparkutils.
If I wrap the same thing in a python wheel package and import it into an environment:
My question is how do I build a wheel file that "knows" about mssparkutils? In my local environment mssparkutils doesn't exist which I suspect is problem.
Full code used to produce the wheel:
my_code.py:
def run_me():
help(mssparkutils)
setup.py (guessing I need mssparkutils in the install_requires but it then says it doesn't exist:
from setuptools import setup, find_packages
setup(
name='wheel_test',
version='0.1',
packages=find_packages(),
install_requires=[
],
author='Ben Dobbs',
author_email='email@email.com',
description='Wheel Testing',
long_description=open('README.md').read(),
long_description_content_type='text/markdown',
)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @bcdobbs
Thanks for explaining the issue.
Please install dummy notebookutils in local environment. This will solve your issue.
pip install dummy-notebookutils
For more information please refer to this link: dummy-notebookutils
Hope this helps. Please let me know if you have any further questions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks I literally just found it works ok if I add
from notebookutils import mssparkutils
The dummy-notebookutils stops it complaining locally though so thank you for that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @bcdobbs
Glad that your query got resolved. Please continue using Fabric Community for any help regarding your queries.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @bcdobbs
Thanks for using Fabric Community.
Have you run the code in Fabric Notebook? Did you install some other whl which includes notebookutils package?
How did you execute the imported code? Can you please provide me some screenshots along with the error message?
This would help me in understanding the issue better.
Thanks.
![avatar user](/skins/images/607AED9E38B349A976B8C960DDECDCE1/responsive_peak/images/icon_anonymous_message.png)
Helpful resources
Subject | Author | Posted | |
---|---|---|---|
05-15-2024 08:33 AM | |||
05-15-2024 08:42 AM | |||
11-20-2023 02:46 AM | |||
12-24-2024 02:50 AM | |||
12-30-2024 07:41 PM |
User | Count |
---|---|
44 | |
5 | |
2 | |
1 | |
1 |
User | Count |
---|---|
62 | |
9 | |
7 | |
6 | |
5 |