davidADSP / Generative_Deep_Learning_2nd_Edition

The official code repository for the second edition of the O'Reilly book Generative Deep Learning: Teaching Machines to Paint, Write, Compose and Play.
https://www.oreilly.com/library/view/generative-deep-learning/9781098134174/
Apache License 2.0
1.11k stars 418 forks source link

ModuleNotFoundError: No module named 'notebooks' #28

Open jetlee2018 opened 9 months ago

jetlee2018 commented 9 months ago

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!

bess-cater commented 9 months ago

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

yoshisatose commented 9 months ago

Or you can just add

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

in the beginning of your notebook.

thiagobluhm commented 9 months ago

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

import os os.chdir("yourdirectory")

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