jukebox icon indicating copy to clipboard operation
jukebox copied to clipboard

sample.py throws ModuleNotFoundError

Open agilebean opened this issue 4 years ago • 9 comments

Hi, this might be easy to fix, I am just missing a detail in the configuration. After installation without errors, the example code for sampling doesn't run.

python jukebox/sample.py --model=5b_lyrics --name=sample_5b --levels=3 --sample_length_in_seconds=20 --total_sample_length_in_seconds=180 --sr=44100 --n_samples=6 --hop_fraction=0.5,0.5,0.125

throws error:

Traceback (most recent call last):
  File "./sample.py", line 1, in <module>
    import jukebox
ModuleNotFoundError: No module named 'jukebox'

I understand that sample.py is in the jukebox folder, so I need to execute python jukebox/sample.py one level above - but then of course, jukebox cannot be imported. But how is jukebox supposed to be found as module? Doesn't sample.py have to be outside of the jukebox folder?

agilebean avatar May 08 '20 05:05 agilebean

have you run the pip install steps? Also are you sure the correct conda environment is activated? It will revert to base if you re-open the console after closing

peterlazzarino avatar May 08 '20 21:05 peterlazzarino

@peterlazzarino yes i did all that. in the line import jukebox, is jukebox referring to the folder jukebox or to a module that is installed during the pip install steps?

agilebean avatar May 11 '20 08:05 agilebean

Use miniconda - https://docs.conda.io/en/latest/miniconda.html

johndpope avatar May 11 '20 10:05 johndpope

I am having the similar problem:

Traceback (most recent call last): File "jukebox/sample.py", line 5, in from jukebox.hparams import Hyperparams ModuleNotFoundError: No module named 'jukebox'

Has anyone already solve this?

JohnXenakis2 avatar May 17 '20 01:05 JohnXenakis2

Did you remember to use the command pip install -e . as the last step of the installation? I was having this same issue until I realized that I just forgot to do that last step.

TimOgden avatar May 24 '20 06:05 TimOgden

Did you remember to use the command pip install -e . as the last step of the installation? I was having this same issue until I realized that I just forgot to do that last step.

@TimOgden thanks, that solved the problem - module jukebox is found now.

Unfortunately, I get a new error message now:

python jukebox/sample.py --model=5b_lyrics --name=sample_5b --levels=3 --sample_length_in_seconds=20 \
> --total_sample_length_in_seconds=180 --sr=44100 --n_samples=6 --hop_fraction=0.5,0.5,0.125

Caught error during NCCL init (attempt 0 of 5): Distributed package doesn't have NCCL built in

does this also an installation issue? the nvidia page is not helpful...

agilebean avatar Jun 06 '20 13:06 agilebean

@TimOgden I've tried this, but it doesn't help.

I added this to sample.py and it went through, but I don't want to write this stuff.

import sys  
sys.path.append('{absolute path}/jukebox')

and, I got another error.

ModuleNotFoundError: No module named 'mpi4py'

Why can't we import jukebox when they're right in front of us?

When it's this hard to execute, I'm getting tired of it.

febfour avatar Jul 25 '20 07:07 febfour

I changed A to B and it started to pass.

A : python jukebox/sample.py B : python3 jukebox/sample.py

but, I got an error.

Caught error during NCCL init (attempt 0 of 5): Distributed package doesn't have NCCL built in

febfour avatar Jul 25 '20 08:07 febfour

Did you remember to use the command pip install -e . as the last step of the installation? I was having this same issue until I realized that I just forgot to do that last step.

This is the right answer!

hdnh2006 avatar Nov 05 '22 15:11 hdnh2006