Generative_Deep_Learning_2nd_Edition icon indicating copy to clipboard operation
Generative_Deep_Learning_2nd_Edition copied to clipboard

ModuleNotFoundError: No module named 'notebooks'

Open jetlee2018 opened this issue 1 year ago • 5 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!

jetlee2018 avatar Jan 15 '24 19:01 jetlee2018

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 :)

bess-cater avatar Jan 18 '24 03:01 bess-cater

Or you can just add

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

in the beginning of your notebook.

yoshisatose avatar Jan 26 '24 10:01 yoshisatose

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

import os os.chdir("yourdirectory")

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

thiagobluhm avatar Feb 07 '24 03:02 thiagobluhm