ELEKTRONN/elektronn3

Import error when running in SyConn environment

Closed this issue · 1 comments

When running this SyConn command:

python SyConn/examples/semseg_spine.py --kzip=~/1_example.k.zip

the console outputs this error message:

2019-08-15 14:04:40 login2 syconn[4260] INFO EGL rendering enabled.
2019-08-15 14:04:58 login2 syconn[4260] ERROR elektronn3 could not be imported (cannot import name 'DataLoaderIter'). Please see 'https://github.com/ELEKTRONN/elektronn3' for more information.
Traceback (most recent call last):
  File "/home/anaconda3/envs/pysy/lib/python3.6/site-packages/elektronn3/training/train_utils.py", line 18, in <module>
    from torch.utils.data.dataloader import _DataLoaderIter as DataLoaderIter
ImportError: cannot import name '_DataLoaderIter'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/SyConn/syconn/handler/prediction.py", line 1021, in get_semseg_spiness_model
    from elektronn3.models.base import InferenceModel
  File "/home/anaconda3/envs/pysy/lib/python3.6/site-packages/elektronn3/models/base.py", line 13, in <module>
    from elektronn3.training.train_utils import pretty_string_time
  File "/home/anaconda3/envs/pysy/lib/python3.6/site-packages/elektronn3/training/__init__.py", line 1, in <module>
    from .trainer import Trainer, Backup
  File "/home/anaconda3/envs/pysy/lib/python3.6/site-packages/elektronn3/training/trainer.py", line 31, in <module>
    from elektronn3.training.train_utils import pretty_string_time
  File "/home/anaconda3/envs/pysy/lib/python3.6/site-packages/elektronn3/training/train_utils.py", line 20, in <module>
    from torch.utils.data.dataloader import DataLoaderIter
ImportError: cannot import name 'DataLoaderIter'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "SyConn/examples/semseg_spine.py", line 31, in <module>
    m = get_semseg_spiness_model()
  File "/home/SyConn/syconn/handler/prediction.py", line 1026, in get_semseg_spiness_model
    raise ImportError(msg)
ImportError: elektronn3 could not be imported (cannot import name 'DataLoaderIter'). Please see 'https://github.com/ELEKTRONN/elektronn3' for more information.

Your advice on how to fix it would be appreciated... It seems related to the torch version -- please see attached for a list of packages installed (conda list).

Thanks!
packages_pysy.txt

Hi Aldo,

thanks for the detailed issue description. It seems that the torch API slightly changed with the new release (1.2.0), which was not yet tested in elektronn3. I adapted the requirements in the latest commit 1002d37 accordingly.

Downgrading torch to 1.1.0 or reinstalling syconn from scratch should solve the issue. Please let me know if that worked for you.