question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Iterator error after pip install

See original GitHub issue

Hello,

Thanks so much for an awesome package!😃

I recently re-pip installed plbolts on a google colab notebook. My code worked before. I’m trying to train a DQN.

On importing the DQN (from pl_bolts.models.rl import DQN), I get the following error:

/usr/local/lib/python3.7/dist-packages/torch/utils/data/_typing.py in _dp_init_subclass(sub_cls, *args, **kwargs)
    369                      return_hint.__origin__ == collections.abc.Iterator)):
    370                 raise TypeError("Expected 'Iterator' as the return annotation for `__iter__` of {}"
--> 371                                 ", but found {}".format(sub_cls.__name__, _type_repr(hints['return'])))
    372             data_type = return_hint.__args__[0]
    373             if not issubtype(data_type, sub_cls.type.param):

TypeError: Expected 'Iterator' as the return annotation for `__iter__` of ExperienceSourceDataset, but found typing.Iterable

Help would be appreciated!

Thank you:-)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
gurlinacommented, Jul 5, 2021

I found that installing the latest version from the Master branch fixes the import problem (no guarantees, though, that it wouldn’t break something else…):

pip install git+https://github.com/PytorchLightning/lightning-bolts.git@master --upgrade

0reactions
mariakesacommented, Jul 5, 2021

Yep, I was also working in Colab. The funny thing is that some time before the code worked.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ImportError after successful pip installation [duplicate]
I have successfully installed a library with pip install <library-name> . But when I try to import it, python raises ImportError: No module ......
Read more >
trying to import iterator from collections with python 3.10 for az ml
Describe the bug Get the following error when trying to submit a training script to the remote computer cluster via az ml cannot...
Read more >
Built-in Functions — Python 3.11.1 documentation
Return an asynchronous iterator for an asynchronous iterable. Equivalent to calling x.__aiter__() . Note: Unlike iter() , aiter() ...
Read more >
Iterators in Python - GeeksforGeeks
Iterator in Python is an object that is used to iterate over iterable objects like lists, tuples, dicts, and sets. The iterator object...
Read more >
Python Iterators - W3Schools
Python Iterators. An iterator is an object that contains a countable number of values. An iterator is an object that can be iterated...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found