question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

tensorboardX 2.3 imports Pillow and PyTorch despite not depending on them

See original GitHub issue

Describe the bug tensorboardX only has NumPy and Protobuf listed as dependencies, but if you try to import it, it tries to import PIL and torch as well.

This is a regression from 2.2.

Minimal runnable code to reproduce the behavior

$ python3 -mvenv /tmp/venv
$ /tmp/venv/bin/pip install -U pip
[...]
Successfully installed pip-21.1.3
$ /tmp/venv/bin/pip install tensorboardX==2.3
[...]
Successfully installed numpy-1.19.5 protobuf-3.17.3 six-1.16.0 tensorboardX-2.3
$ /tmp/venv/bin/python -c 'import tensorboardX'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/venv/lib/python3.6/site-packages/tensorboardX/__init__.py", line 5, in <module>
    from .torchvis import TorchVis
  File "/tmp/venv/lib/python3.6/site-packages/tensorboardX/torchvis.py", line 11, in <module>
    from .writer import SummaryWriter
  File "/tmp/venv/lib/python3.6/site-packages/tensorboardX/writer.py", line 17, in <module>
    from .comet_utils import CometLogger
  File "/tmp/venv/lib/python3.6/site-packages/tensorboardX/comet_utils.py", line 4, in <module>
    from PIL import Image
ModuleNotFoundError: No module named 'PIL'

(If you install Pillow, the same error happens with import torch in the same module.)

Expected behavior The import should succeed. All functionality that doesn’t depend on Pillow or PyTorch should work.

Screenshots N/A

Environment What is the result of pip list|grep -E "torch|proto|tensor" If the version is too old, please try to update first.

protobuf      3.17.3
tensorboardX  2.3

Python environment I’m using Python 3.6.9 from the Ubuntu 18.04 repositories.

Additional context N/A

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:4
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
richardliawcommented, Jun 29, 2021

+1, this introduces a large dependency regression for our ecosystem too!

1reaction
ujravcommented, Jun 29, 2021

This has caused a problem/minor annoyance for my company’s project. We are now forced to install pytorch and allocate more ram on our containers despite not needing either for anything else.

Read more comments on GitHub >

github_iconTop Results From Across the Web

tensorboardX 2.3 imports Pillow and PyTorch despite not depending ...
Describe the bug tensorboardX only has NumPy and Protobuf listed as dependencies, but if you try to import it, it tries to import...
Read more >
Cannot install any version of torchvision newer than 0.2.2 with ...
Bug Issue #3207 has cropped up again for pytorch 1.9.0 Cannot install any version of torchvision newer than 0.2.2 with opencv for python...
Read more >
torch.utils.tensorboard — PyTorch 1.13 documentation
The SummaryWriter class provides a high-level API to create an event file in a given directory and add summaries and events to it....
Read more >
Deep Learning with PyTorch
Can you import torch? What version of PyTorch do you get? c. What is the result of torch.cuda.is_available()? Does it match your expectation...
Read more >
PyTorch Forecasting for Time Series Forecasting | Kaggle
Deep Learning may have taken the front seat in computer vision and language processing tasks but ,even though having outperformed the traditional methods...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found