Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tensorboardX 2.3 imports Pillow and PyTorch despite not depending on them #631

Closed
IRDonch opened this issue Jun 29, 2021 · 5 comments
Closed

Comments

@IRDonch
Copy link

IRDonch commented Jun 29, 2021

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

@ujrav
Copy link

ujrav commented 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.

@richardliaw
Copy link

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

@lanpa
Copy link
Owner

lanpa commented Jun 30, 2021

Oh, I should have noticed this! Will fix soon.

@lanpa
Copy link
Owner

lanpa commented Jun 30, 2021

Just removed the dependency and updated to v2.4, please have a test.

@IRDonch
Copy link
Author

IRDonch commented Jun 30, 2021

It is indeed fixed in 2.4. Thanks.

@IRDonch IRDonch closed this as completed Jun 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants