Modulenotfounderror: No Module Named 'Pytorch3D' - Simplified Disco Diffusion

I was running this Google Colab today everything was working fine but eventually I starting getting these errors in the Set Up Environment. I can't find a fix. Any help would be appreciated let me know if I need to provide more info.

Here's a link to the colab:

πŸ“ Google Drive already mounted.
βœ… Disco Diffusion root path will be "/content/gdrive/MyDrive/disco-diffusion-1"
Google Colab detected.
πŸ“„ Pulling updates from GitHub...

M   download_models.sh
M   examples/docker/disco-file.sh
M   examples/docker/disco.sh
M   examples/docker/interactive.sh
M   examples/docker/unittest.sh
M   examples/linux/configfile.sh
M   examples/linux/simple.sh
Your branch is up to date with 'origin/main'.

Already up to date.

πŸ“¦ Upgrading pyyaml...
πŸ“¦ Installing pip requirements...
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-11-4fe875dbbe21> in <module>()
     70 # Import DD helper modules
     71 sys.path.append(PROJECT_DIR)
---> 72 import dd, dd_args
     73 
     74 # Unsure about these:

1 frames
/content/gdrive/MyDrive/disco-diffusion-1/disco_xform_utils.py in <module>()
      3 
      4 # import pytorch3dlite.pytorch3dlite as p3d
----> 5 from pytorch3d import renderer
      6 from midas import utils as midas_utils
      7 from PIL import Image

ModuleNotFoundError: No module named 'pytorch3d'

---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the
"Open Examples" button below.
--------------------------------------------------------------------------- 

2 Answers

I've opened an issue with the author of the repo (here).

In the meantime, open the "Set Up Environment" cell and update the section under "if is_colab" like so:

#Upgrade pyyaml if in Colab
if is_colab:
    print(f'πŸ“¦ checking out specific commit...')
    for cmd in ['git clean -df', f'git reset --hard 3fc1dddb043f7f814db49fe951b4abb7eebd22fd', f'git log -1']:
      gitresults = subprocess.run(f'{cmd}'.split(' '), stdout=subprocess.PIPE).stdout.decode("utf-8")
      print(f'{gitresults}')
    print(f'πŸ“¦ Upgrading pyyaml...')
    subprocess.run(f'pip install --upgrade pyyaml --quiet'.split(' '), stdout=subprocess.PIPE).stdout.decode("utf-8")
    print(f'πŸ“¦ Installing pip requirements...')
    subprocess.run(f'pip install -r colab-requirements.txt --quiet'.split(' '), stdout=subprocess.PIPE).stdout.decode("utf-8")

what this does is it reverts the last commit which appears to have broken things.

Just re-run the cell (and the ones after)... it works for me.

It's fixed now. Thanks for reporting it!

Your Answer

By clicking β€œPost Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Chloe Bennett

Chloe Bennett

Culture, Media & Entertainment Columnist

Chloe Bennett explores the intersection of pop culture, streaming entertainment, digital trends, and contemporary lifestyle. Her weekly commentary reaches thousands of culture enthusiasts.

Share this article
Twitter Facebook Pinterest