ModuleNotFoundError: No module named 'dataclasses'

(Aritra Sen) #21

Thank you , i did try those steps , however running below command worked now for me :slight_smile:

conda install nb_conda

Thank you again @marcmuc and @aberres for continuous support to resolve the issues.

0 Likes

(Shreyas) #22

in my case link is pointing to ../../old/fastai but still i get this error “No module named dataclasses”

OS : Win 10
conda 4.5.11
Python 3.6.7

0 Likes

(Jonathan) #23

Hi

I successfully went through the Server Setup for AWS EC2, after starting an instance and running a notebook I get 'ModuleNotFoundError: No module named ‘dataclasses’ when running the following code.

from fastai.vision import *

Any help welcome

Thanks

Jonathan

1 Like

(Jonathan) #24

pip install dataclasses

worked for me!

1 Like

(Lindy) #25

conda install dataclasses also installed the right package for me. this allows me to run the import in python 3.6

2 Likes

(carson dahlberg) #26

ty, this helped

0 Likes

(Antoine) #27

What does the (relevant bit of the) setup script do? I see " dataclasses ; python_version<‘3.7’" on line 87, within the definition of dep_group. What does it do?

I have also found Jeremy’s remark to this question that python3.6 can be used with fastai v1 as long as dataclasses is installed (via pip). How can that be? Is dataclasses simply a new package that comes shipped with 3.7 but not with 3.6, and can simply be installed separately?

0 Likes

(Marc P. Rostock) #28

The setup script makes the availability of the module “dataclasses” mandatory for python versions lower than 3.7, but only for those, since it is included in python3.7 by default.

Python 3.7 has a number of improvements/additions vs. Python 3.6, but the only thing out of those that fastai uses is dataclasses. So 3.7 is required because fastai makes use of dataclasses. In Python it is customary that at least some additions to new python versions are also made available as so called “backports”. So if you want to make use of the dataclasses feature of the language, but for some reason cannot or do not want to upgrade your base python version (which happens often in production settings), you can use these backports to import the feature into an older version.

So, you can use python 3.6 but then you have to manually add the backport for dataclasses to the language, which you do by installing it via pip install dataclasses.

1 Like

#29

Hello,
I encountered the same error. Have you solved it? Thanks.

0 Likes