davidADSP/Generative_Deep_Learning_2nd_Edition

ModuleNotFoundError: No module named 'notebooks'

Opened this issue · 3 comments

I am running this on windows(not in docker). I got the following error:

  ---------------------------------------------------------------------------
  ModuleNotFoundError                       Traceback (most recent call last)
  Cell In[3], line 5
        2 import matplotlib.pyplot as plt
        4 from tensorflow.keras import layers, models, optimizers, utils, datasets
  ----> 5 from notebooks.utils import display
  
  ModuleNotFoundError: No module named 'notebooks'

when it runs "from notebooks.utils import display".

I tried to run "pip install notebooks", and I got:

ERROR: Could not find a version that satisfies the requirement notebooks (from versions: none)
ERROR: No matching distribution found for notebooks

searching google doesn't help. Please help here. Thanks!

Hi, jetlee2018!
I got this issue as well, but then it striked me - if you look closely on the structure of this repository, you'll see that 'notebooks' is just a folder in here (not a python package!) and utils.py is a python file inside it. So you can just copy this folder with the file to your working directory and the problem is solved :)

Or you can just add

import sys
sys.path.append('.\..\..\')

in the beginning of your notebook.

To me it's really better using "os" package:

import os
os.chdir("yourdirectory")

Remember that "yourdirectory" must be level folder, not file.