cancel
Showing results for 
Search instead for 
Did you mean: 
Get Started Discussions
Start your journey with Databricks by joining discussions on getting started guides, tutorials, and introductory topics. Connect with beginners and experts alike to kickstart your Databricks experience.
cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot import editable installed module in notebook

newenglander
New Contributor II

Hi,

I have the following directory structure:

- mypkg/
  - setup.py
  - mypkg/
    - __init__.py
    - module.py
- scripts/
  - main # notebook
  

From the `main` notebok I have a cell that runs:

%pip install -e /path/to/mypkg

This command appears to successfully install the package. And in a subsequent cell I can run:

!python -m mypkg.module

and it executes successfully.

However, when I try in a notebook cell to simply run:

import mypkg.module

the execution fails with the message: 

ModuleNotFoundError: No module named 'mypkg'

I've tried executing the import both before and after running `%restart_python` and it fails either way.

Please advise.

Thank you

0 REPLIES 0

Join Us as a Local Community Builder!

Passionate about hosting events and connecting people? Help us grow a vibrant local community—sign up today to get started!

Sign Up Now