First of all: I know there are a lot of questions about this, however none of the ones I ffound are solving my problem.
Setup
I have the following folder structure:
WorkingDirectory(WD)
|---------- data
| |
| |-- __init__.py (empty)
| |-- dataset.py (with import: from software.utils import *)
| |-- test.ipynb (with import: from dataset import *)
|
|-------software
| |
| |-- __init__.py (empty)
| |-- utils.py (with import: from software.utils import *)
|
|-- main.py (with imports from software and data)
And the following pythonm versions:
- python -V gives 3.7.10
- ipython -V gives 7.22.0
Problem
If I run python main.py
I do not get any errors, but if I try to execute from dataset import *
in the test.ipynb
-file I get the error:
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-4-a20c81312677> in <module>
----> 1 from dataset import *
~/WD/data/dataset.py in <module>
15
16
---> 17 from software.utils import *
ModuleNotFoundError: No module named 'software'
So in general the import from dataset.py
is working, but the "sub-import" from software.utils.py
is not working. I am not sure if this is a ipython problem, because it is working with python (it is working if I execute main.py
)?