Tacotron2: ModuleNotFoundError: No module named 'PIL'

Created on 12 Jun 2018  路  2Comments  路  Source: NVIDIA/tacotron2

Hi, When I run command "/usr/bin/python train.py --output_directory=works --log_directory=works/log --hparams=batch_size=4" , I get a error "ModuleNotFoundError: No module named 'PIL'". Full log is as follows:
FP16 Run: False
Dynamic Loss Scaling: True
Distributed Run: False
cuDNN Enabled: True
cuDNN Benchmark: False
/qwork1/hlw74/ttswork/tacotron2/layers.py:35: UserWarning: nn.init.xavier_uniform is now deprecated in favor of nn.init.xavier_uniform_.
self.conv.weight, gain=torch.nn.init.calculate_gain(w_init_gain))
/qwork1/hlw74/ttswork/tacotron2/layers.py:15: UserWarning: nn.init.xavier_uniform is now deprecated in favor of nn.init.xavier_uniform_.
gain=torch.nn.init.calculate_gain(w_init_gain))
Epoch: 0
train.py:219: UserWarning: invalid index of a 0-dim tensor. This will be an error in PyTorch 0.5. Use tensor.item() to convert a 0-dim tensor to a Python number
if hparams.distributed_run else loss.data[0]
train.py:227: UserWarning: torch.nn.utils.clip_grad_norm is now deprecated in favor of torch.nn.utils.clip_grad_norm_.
model.parameters(), hparams.grad_clip_thresh)
Train loss 0 50.199665 Grad Norm 23.629131 3.03s/it
train.py:144: UserWarning: invalid index of a 0-dim tensor. This will be an error in PyTorch 0.5. Use tensor.item() to convert a 0-dim tensor to a Python number
if distributed_run else loss.data[0]
Validation loss 0: 39.167839
Traceback (most recent call last):
File "train.py", line 291, in
args.warm_start, args.n_gpus, args.rank, args.group_name, hparams)
File "train.py", line 250, in train
reduced_val_loss, model, y, y_pred, iteration)
File "/qwork1/hlw74/ttswork/tacotron2/logger.py", line 34, in log_validation
iteration)
File "/usr/local/python3/lib/python3.6/site-packages/tensorboardX/writer.py", line 338, in add_image
self.file_writer.add_summary(image(tag, img_tensor), global_step)
File "/usr/local/python3/lib/python3.6/site-packages/tensorboardX/summary.py", line 158, in image
image = make_image(tensor)
File "/usr/local/python3/lib/python3.6/site-packages/tensorboardX/summary.py", line 164, in make_image
from PIL import Image
ModuleNotFoundError: No module named 'PIL'
* Error in `/usr/bin/python': double free or corruption (!prev): 0x00000000025cf470 *
Aborted (core dumped)

Most helpful comment

It says you don't have the PIL (pillow) python library installed.
Have you tried these commands ?
sudo pip3 install pillow
or
sudo apt-get install python3-PIL

All 2 comments

It says you don't have the PIL (pillow) python library installed.
Have you tried these commands ?
sudo pip3 install pillow
or
sudo apt-get install python3-PIL

@yliess86 , thank you! It's working!

Was this page helpful?
0 / 5 - 0 ratings