Maximum PyTorch versions?

Question about the following in environment.yml:

- pytorch>=1.2.0,<1.4.0
- torchvision<=0.4.2

Are there known incompatabilities with the newest pytorch libraries, or is that done defensively?

The usual system I have access to already has newer pytorch versions than that (and while a fresh Anaconda install is possible, it’s less desirable because it has less access to GPUs).

If there are known issues issues, I’ll look into them. If there’s nothing known, I’ll see how the tests look


There is a known issue, see here:

A walk with fastai2 - Study Group and Online Lectures Megathread (There could be more, this was the most common one we found)

You can recreate it by calling show_batch() on any DataLoader:

    AttributeError Traceback (most recent call last)
in ()
----> 1 dbunch.show_batch(max_n=9, figsize=(6,7))

6 frames
/usr/local/lib/python3.6/dist-packages/fastcore/ in getattr(self, k)
221 attr = getattr(self,self._default,None)
222 if attr is not None: return getattr(attr, k)
–> 223 raise AttributeError(k)
224 def dir(self): return custom_dir(self, self._dir() if self._xtra is None else self._dir())
225 # def getstate(self): return self.dict

AttributeError: _IterableDataset_len_called
1 Like

Gotcha, thanks for this. Looking through the other thread, it seems like the issue was with torchvision. Was pytorch's version constrained to match torchvision or is there another bug?

Yes, it was constrained because a lot changed in 1.4 IIRC. They needed to match. At one point PyTorch 1.4 worked, just installing that version of torchvision wanted 1.3.1

As a side note: we will fix the issue with PyTorch 1.4 but once the book is finished.


Gotcha. Thanks all for clarifying.