Solved: AttributeError: module 'types' has no attribute 'MethodWrapperType'

Edit from Jeremy: The information below is now obsolete, because fastai v2 has been modified to work with python 3.6.


Ran into this issue in nb 01_core and figured if anybody else does, this may help.

Problem:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-111-838e064ec70f> in <module>
     18             setattr(TensorBase, fn, get_f(fn))
     19 
---> 20 _patch_tb()

<ipython-input-111-838e064ec70f> in _patch_tb()
     15         if fn in skips: continue
     16         f = getattr(t, fn)
---> 17         if isinstance(f, (types.MethodWrapperType, types.BuiltinFunctionType, types.BuiltinMethodType, types.MethodType, types.FunctionType)):
     18             setattr(TensorBase, fn, get_f(fn))
     19 

AttributeError: module 'types' has no attribute 'MethodWrapperType'


Solution:
Upgrade Python to 3.7+

3 Likes

This may seem quite noobish but how would we go about installing python 3.7 in colab? I’m trying to set up example code for using the library and setting yourself up for in colab right now and can’t get past this issue. I have tried !sudo apt-get install python3.7 which installs python 3.7, but it seems to still want to use python 3.6… Thoughts?

Edit: Fixed the issue. I will post a colab example shortly
Bad new for colab users. Google Colab does not support Python 3.7. I will research other free options for jupyter notebooks

This is now resolved and all works on py 3.6.

2 Likes