pytorch-lightning: Cannot import pytorch-lightning-v0.5.3

Describe the bug

After updating to v0.5.3, import pytorch_lightning fails due to the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.7/site-packages/pytorch_lightning/__init__.py", line 28, in <module>
    from .trainer.trainer import Trainer
  File "/usr/local/lib/python3.7/site-packages/pytorch_lightning/trainer/trainer.py", line 16, in <module>
    from pytorch_lightning.trainer.callback_config_mixin import TrainerCallbackConfigMixin
  File "/usr/local/lib/python3.7/site-packages/pytorch_lightning/trainer/callback_config_mixin.py", line 4, in <module>
    from pytorch_lightning.logging import TestTubeLogger
ImportError: cannot import name 'TestTubeLogger' from 'pytorch_lightning.logging' (/usr/local/lib/python3.7/site-packages/pytorch_lightning/logging/__init__.py)

To Reproduce

Steps to reproduce the behavior:

$ docker run --rm -it python:3.7 /bin/bash 

//
// Install `pytorch_lightning` (succeeded)
//
root@93bfd08b5db7:/# pip install pytorch_lightning
Collecting pytorch_lightning
  Downloading https://files.pythonhosted.org/packages/2d/2e/ef5bedf1bb7f2f786d42f5af71ad5d7383416efec86098372d8016f5305d/pytorch-lightning-0.5.3.tar.gz (55kB)
...
Building wheels for collected packages: pytorch-lightning
  Building wheel for pytorch-lightning (setup.py) ... done
  Created wheel for pytorch-lightning: filename=pytorch_lightning-0.5.3-cp37-none-any.whl size=67557 sha256=80287a76e8fa15b4a64568fcd0c033688479f1bf7cb69dde8ba1d77da25453a6
  Stored in directory: /root/.cache/pip/wheels/0f/4e/df/486c6c64d8d2f4706c70255493e434bacbf3497c7f5d0ab040
Successfully built pytorch-lightning
Installing collected packages: numpy, scipy, scikit-learn, tqdm, chardet, certifi, urllib3, idna, requests, docutils, webencodings, six, bleach, Pygments, readme-renderer, pkginfo, requests-toolbelt, twine, torch, pillow, torchvision, pytz, python-dateutil, pandas, pytorch-lightning
Successfully installed Pygments-2.4.2 bleach-3.1.0 certifi-2019.9.11 chardet-3.0.4 docutils-0.15.2 idna-2.8 numpy-1.16.4 pandas-0.25.3 pillow-6.2.1 pkginfo-1.5.0.1 python-dateutil-2.8.1 pytorch-lightning-0.5.3 pytz-2019.3 readme-renderer-24.0 requests-2.22.0 requests-toolbelt-0.9.1 scikit-learn-0.20.2 scipy-1.3.1 six-1.13.0 torch-1.3.0 torchvision-0.4.1 tqdm-4.35.0 twine-1.13.0 urllib3-1.25.6 webencodings-0.5.1

//
// Import `pytorch_lightning` (failed)
//
root@93bfd08b5db7:/# python
Python 3.7.5 (default, Oct 19 2019, 00:03:48)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pytorch_lightning
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.7/site-packages/pytorch_lightning/__init__.py", line 28, in <module>
    from .trainer.trainer import Trainer
  File "/usr/local/lib/python3.7/site-packages/pytorch_lightning/trainer/trainer.py", line 16, in <module>
    from pytorch_lightning.trainer.callback_config_mixin import TrainerCallbackConfigMixin
  File "/usr/local/lib/python3.7/site-packages/pytorch_lightning/trainer/callback_config_mixin.py", line 4, in <module>
    from pytorch_lightning.logging import TestTubeLogger
ImportError: cannot import name 'TestTubeLogger' from 'pytorch_lightning.logging' (/usr/local/lib/python3.7/site-packages/pytorch_lightning/logging/__init__.py)

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 16 (11 by maintainers)

Most upvoted comments

I had the same error, too cannot import name 'TestTubeLogger' I tried pip install test-tube and it says

Requirement already satisfied: test-tube in /home/rpc/anaconda3/envs/hkt/lib/python3.6/site-packages (0.7.3)
Requirement already satisfied: future in /home/rpc/anaconda3/envs/hkt/lib/python3.6/site-packages (from test-tube) (0.18.2)
Requirement already satisfied: imageio>=2.3.0 in /home/rpc/anaconda3/envs/hkt/lib/python3.6/site-packages (from test-tube) (2.5.0)
Requirement already satisfied: pandas>=0.20.3 in /home/rpc/anaconda3/envs/hkt/lib/python3.6/site-packages (from test-tube) (0.24.2)
Requirement already satisfied: torch>=1.1.0 in /home/rpc/anaconda3/envs/hkt/lib/python3.6/site-packages (from test-tube) (1.3.1)
Requirement already satisfied: numpy>=1.13.3 in /home/rpc/.local/lib/python3.6/site-packages (from test-tube) (1.16.4)
Requirement already satisfied: tb-nightly==1.15.0a20190708 in /home/rpc/anaconda3/envs/hkt/lib/python3.6/site-packages (from test-tube) (1.15.0a20190708)
Requirement already satisfied: pytz>=2011k in /home/rpc/anaconda3/envs/hkt/lib/python3.6/site-packages (from pandas>=0.20.3->test-tube) (2018.9)
Requirement already satisfied: python-dateutil>=2.5.0 in /home/rpc/anaconda3/envs/hkt/lib/python3.6/site-packages (from pandas>=0.20.3->test-tube) (2.8.0)
Requirement already satisfied: six>=1.10.0 in /home/rpc/.local/lib/python3.6/site-packages (from tb-nightly==1.15.0a20190708->test-tube) (1.12.0)
Requirement already satisfied: protobuf>=3.6.0 in /home/rpc/anaconda3/envs/hkt/lib/python3.6/site-packages (from tb-nightly==1.15.0a20190708->test-tube) (3.8.0)
Requirement already satisfied: markdown>=2.6.8 in /home/rpc/anaconda3/envs/hkt/lib/python3.6/site-packages (from tb-nightly==1.15.0a20190708->test-tube) (3.1.1)
Requirement already satisfied: setuptools>=41.0.0 in /home/rpc/anaconda3/envs/hkt/lib/python3.6/site-packages (from tb-nightly==1.15.0a20190708->test-tube) (41.0.1)
Requirement already satisfied: absl-py>=0.4 in /home/rpc/anaconda3/envs/hkt/lib/python3.6/site-packages (from tb-nightly==1.15.0a20190708->test-tube) (0.7.1)
Requirement already satisfied: werkzeug>=0.11.15 in /home/rpc/anaconda3/envs/hkt/lib/python3.6/site-packages (from tb-nightly==1.15.0a20190708->test-tube) (0.14.1)
Requirement already satisfied: grpcio>=1.6.3 in /home/rpc/anaconda3/envs/hkt/lib/python3.6/site-packages (from tb-nightly==1.15.0a20190708->test-tube) (1.16.1)
Requirement already satisfied: wheel>=0.26; python_version >= "3" in /home/rpc/anaconda3/envs/hkt/lib/python3.6/site-packages (from tb-nightly==1.15.0a20190708->test-tube) (0.33.1)

but after that, I had exactly the same error again, How can I do?

I had the same error, too cannot import name ‘TestTubeLogger’

I have installed test-tube. how to solve it? Thanks

@sile you need to install test-tube from pypi

@Borda My problem was solved by installing test-tube. Thank you!

BTW, I think that it’s better to add test-tube to requirements.txt if the package is mandatory to import pytorch_lightning.