Skip to content

ImportError: cannot import name 'TestTubeLogger' from 'pytorch_lightning.loggers' #13958

@cpfy

Description

@cpfy

🐛 Bug

I'm trying to import TestTubeLogger with from pytorch_lightning.loggers import TestTubeLogger

But got ImportError: cannot import name 'TestTubeLogger' from 'pytorch_lightning.loggers' as in title.

To Reproduce

I can reproduce the bug in Colab link.

First installed pytorch_lightning and test_tube (mentioned as dependency in Issue #469) by running following commands.

pip install git+https://github.com/Lightning-AI/lightning
pip install test_tube==0.7.5

and then test

from pytorch_lightning.loggers import TestTubeLogger

but got ImportError again

Traceback (most recent call last)
[<ipython-input-2-dc8641882742>] in <module>()
----> 1 from pytorch_lightning.loggers import TestTubeLogger

ImportError: cannot import name 'TestTubeLogger' from 'pytorch_lightning.loggers' (/usr/local/lib/python3.7/dist-packages/pytorch_lightning/loggers/__init__.py)

Expected behavior

I would expect correct import of TestTubelogger. In version pytorch_lightning==1.4.8 I can import it correctly but got error with the same code above in the newest version after upgrade the package from git clone (1.7.0rc1).

Environment

  • PyTorch Lightning Version (e.g., 1.5.0): 1.7.0rc1
  • PyTorch Version (e.g., 1.10): 1.12.0
  • Python version (e.g., 3.9): 3.7
  • OS (e.g., Linux): Linux
  • How you installed PyTorch (conda, pip, source): Colab automatically installed

Additional context

In version pytorch_lightning==1.4.8, I can find following code in pytorch_lightning/loggers/__init__.py

if _TESTTUBE_AVAILABLE:
    __all__.append("TestTubeLogger")

But is it removed in the newest version? That may cause the ImportError above.

I'm very confused about it. Anybody can help me here? Thanks.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions