Solvedpytorch lightning Cannot import pytorch-lightning-v0.5.3

sile
154

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)
17 Answers

✔️Accepted Answer

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?

Related Issues:

39
pytorch lightning Model load_from_checkpoint
Here's a solution that doesn't require modifying your model (from #599). Describe the bug When loadi...
14
pytorch lightning How to use multiple metric monitors in ModelCheckpoint callback?
Do you plan to support it? It would be nice to be able to do the following: and something similar fo...
13
pytorch lightning How to log train and validation loss in the same figure ?
Got NotImplementedError: Got <class 'dict'> but numpy array torch tensor or caffe2 blob name are exp...
12
pytorch lightning Cyclic learning rate finder as a part of Trainer
I actually did a bit of research into this and implemented this at work It's actually very easy ...
11
pytorch lightning How to log by epoch for both training and validation on 1.0.0rc4 / 1.0.0rc5 / 1.0.0
To clarify a bit further What is your question? I have been trying out pytorch-lightning 1.0.0rc5 an...
11
pytorch lightning Cannot import pytorch-lightning-v0.5.3
I had the same error too cannot import name 'TestTubeLogger' I tried pip install test-tube and it sa...
8
pytorch lightning Log training metrics for each epoch
How about this: In __init__: self.training_losses = [] In training_step method: self.training_losses...
6
pytorch lightning Single node DDP: "Default process group is not initialized"
Can we re-open this issue? I am still having the Default process group is not initialized issue when...
3
pytorch lightning Hydra configs with multi GPU DDP training in Pytorch Lightning
@rakhimovv when you use ddp As far as I understand DDP backend runs my training script from beginnin...
3
pytorch lightning Model summarize displayed twice before training starts
on my windows machine single gpu happens too but the logs also appear twice including all warnings ¨...
3
pytorch lightning How to keep some LightningModule's parameters on cpu when using CUDA devices for training
I modified my code like this: It works! Thank you @rohitgr7 and @awaelchli! ❓ Questions and Help Wha...
3
pytorch lightning the self.log problem in validation_step()
The Issue is still present in version 1.0.1 as doc say we should use self.log in last version ...
3
pytorch lightning Does one need to reset Metrics during the end of epoch in Lightning 1.0.3
Depends on how you are using the metrics In general if the .compute()method is called the internal s...
3
pytorch lightning CUDA OOM when initializing DDP
With CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7,8,9 I get the usual OOM exception With CUDA_VISIBLE_DEVICE...
224
TagUI dyld: Library not loaded error on macOS (OpenSSL missing)
This worked for me: Welcome to TagUI GitHub page 🤖! TagUI is a free RPA tool by AI Singapore (to au...
125
TagUI macOS OpenSSL version issue - Homebrew moved it from v1.0 to v1.1 - initial fix
The solution seems to be running below commands in terminal There are 2 uninstall commands to make s...
35
mlflow Unable to see mlflow ui at http://127.0.0.1:5000 on macOS Sierra version 10.12.3
@stenpiren did you happen to run the mlflow ui from the root path of your cloned repo for example ...
35
mlflow RunId not found when executing "mlflow run" with remote tracking server
How are ya'll specifying the tracking URI? I'd recommend doing so by setting the MLFLOW_TRACKING_URI...
30
carla Invalid pixelmap or window parameter
@jbeck9 I actually got this working by switching to the latest Nvidia driver 470 and running Carla w...
30
mlflow Unable to see mlflow ui at http://127.0.0.1:5000 when mlflow is running in docker container
@datariders I had the same issue The problem here is gunicorn is binding to just 127.0.0.1 inside th...
21
spaCy Problem with spacy.load('en')
Try this... pip install spacy && python -m spacy download en This worked for me. ...
21
spaCy ValueError: 2539520 exceeds max_bin_len(1048576) when uses spacy.load()
Thanks for the report and sorry you've hit this problem It also just came up in our tests today and ...
18
mlflow error with “mlflow ui” at windows
Are there any plans to have Windows supported for the mlflow ui ? I am also experiencing a problem w...
13
cookiecutter data science Integration with dvc
@isms good questions! I've prepared a PR #159 to show how the first step would look like Would be gr...
12
spaCy 💫 Train parser and NER with regression objective, to make scores express expected parse quality
@Zhenshan-Jin I think I'm getting somewhere now This works: Only problem now is my models are traine...
12
milvus Support collection rename
Hi sorry for the late reply Here is my rough design Any suggestions or feedbacks are welcome ...
11
dvc Dataset storage improvements
I will give my impressions on your questions: There were many requests related to datasets storing w...
11
dvc [Feature Request?] dvc run ... without actually running?
We've been thinking about it a lot and decided to change dvc add/run/repro so they will only save ch...
10
photoprism Error 1045: Access denied for user 'photoprism'@'172.23.0.2'
I ran into the same problem and this thread helped me to fix it by: Stopping the running containers ...
7
carla Building on Windows 0.8.X
Install the pre-requisites (Visual Studio 2015 This issue have changed alot since it was opened ...
6
carla 0.9.6 docker container: xdg-user-dir not found
Hmm This issue does appear to exist at least for me When executing 0.9.6 docker with The following w...
6
carla rsync: change_dir "/home/ue4/carla//./Plugins" failed: No such file or directory (2)
@thillRobot My fix was to change line 166 in Package.sh in the Docker container to: copy_if_changed ...
6
spaCy 💫 Participating in CoNLL 2018 Universal Dependencies evaluation (Team spaCy?)
To everyone who wants to help out here's another issue to take on Update 06/06/2018 ...
5
openkore Disconnected from server.
I've got the solution! Simply remove the line 0362 0367 in tables/iRO/Restart/shuffle.txt on the end...
5
aiyprojects raspbian ImportError: No module named 'aiy'
I compared the check audio script with the one in voicekit branch and I added this line just before ...
4
spaCy How to get dependency tags/tree in a CoNLL-format?
Should have had this snippet up from the start --- thanks. How to get dependency tags/tree in a CoNL...
4
caffe2 Caffe Translator Error: Convolution Layer
OK so it seems like the issue I mentioned in the previous comment has to do with the Scale layer bei...
4
dvc Model parameter tracking
There are different tools already to do hyperparameter optimization: https://en.wikipedia.org/wiki/H...
4
dvc ARM architecture support
If anybody needs it Recently I have tried to install DVC on Nvidia Jetson TX2 without any success (I...
4
dvc Pushing artifacts via WebDAV results in a 411 Length Required response
Any info about the server? At the first glance seems like the server is not understanding the chunke...
4
dvc Not able to push data of dependencies to the remote
@Christoph-1 using the rules I suggested my_data.csv will be ignored by the first rule data/** ...
3
haystack Haystack with Albert is awesome! XLNet question
If you update FARM on latest master you should be able to increase the batch size a lot @Timoeller Y...
3
dvc Connecting to SSH remote with a custom port and a private key
Hi @gcoter ! Both patches are merged and released in 0.18.4 Here is a quick run-through: Please feel...
3
react native vision camera 🐛 Android unknown crash
Hey! I ran into the same issue when testing out the module in my own application Only one of my devi...
3
photoprism Login with Admin password results in invalid credentials
Hi @wasuint here is my personal docker compose file: Please note: Currently we should use preview ta...
3
snorkel LabelModel produces equal probability for labeled data
Hi @s2948044 @vtang13 @xsway thanks first of all for bringing this issue to light in such detail ...
17
dm_control import MuJoCo, ImportError: cannot import name 'constants'
Did you install making it editable? This gave me the same problem In other words ...
14
learning to learn structures don't have the same sequence type
It is because the input and output of the LSTMcell don't have the same type in tf.while_loop The pro...
14
sonnet _resampler.so: undefined symbol
I'm also getting this as per @thesilencelies Tried tensorflow 1.1.0 then 1.1.0-rc2 when that didn't ...
13
fairseq wav2vec 2.0 inference pipeline
I did it in Fairseq version 0.9.0 In fairseq-0.9.0 Wav2vec-2.0 is not supported So I took it from th...