Fastai: ModuleNotFoundError: No module named 'dataclasses'

Created on 9 Oct 2018  Â·  5Comments  Â·  Source: fastai/fastai

Describe the bug

When doing:
from fastai.vision import *
I get: ModuleNotFoundError: No module named 'dataclasses'

I took the from fastai.vision import * from the examples/vision.py.

To Reproduce

Just a single python line with from fastai.vision import * does it...

Expected behavior

I expected to import the fastai library...

Screenshots

Additional context

Full stack:

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-4-b6baa6fb66e3> in <module>
      3 import random
      4 from fastai import *          # Quick accesss to most common functionality
----> 5 from fastai.vision import *   # Quick accesss to computer vision functionality
      6 from fastai.docs import *     # Access to example data provided with fastai

~/sources/fastai/vision/__init__.py in <module>
----> 1 from .learner import *
      2 from .data import *
      3 from .image import *
      4 from .transform import *
      5 from .models import *

~/sources/fastai/vision/learner.py in <module>
      1 "`Learner` support for computer vision"
----> 2 from ..torch_core import *
      3 from ..basic_train import *
      4 from ..data import *
      5 from ..layers import *

~/sources/fastai/torch_core.py in <module>
      1 "Utility functions to help deal with tensors"
----> 2 from .imports.torch import *
      3 from .core import *
      4 
      5 AffineMatrix = Tensor

~/sources/fastai/imports/__init__.py in <module>
----> 1 from .core import *
      2 from .torch import *

~/sources/fastai/imports/core.py in <module>
     10 from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor
     11 from copy import copy, deepcopy
---> 12 from dataclasses import dataclass, field
     13 from enum import Enum, IntEnum
     14 from fastprogress import master_bar, progress_bar

ModuleNotFoundError: No module named 'dataclasses'

Most helpful comment

@mraggi you could try doing pip install dataclasses

All 5 comments

It sounds like you have an incomplete install. dataclasses is installed automatically either via pip or conda dependencies. (unless it's python3.7 where it's built-in)

Make sure you follow the exact instructions at https://github.com/fastai/fastai/blob/master/README.md#installation

If the issue persists fastai v1 installation issues should be reported here instead. Thank you.

@mraggi you could try doing pip install dataclasses

Yes, and we had a bug in the build which appeared when the wheel was built with py3.7, which is fixed now and will be made into a new release shortly.

Thanks!

But I solved the issue long ago: I just wasn't installing the proper way. I
was used to doing just "git pull" (the way to do it before 1.0) and didn't
realize everything changed with fast.ai 1.0.

On Thu, Dec 6, 2018 at 3:52 AM Dang Nguyen Anh Khoa <
[email protected]> wrote:

@mraggi https://github.com/mraggi you could try doing pip install
dataclasses

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/fastai/fastai/issues/867#issuecomment-444813597, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AIAeboaiwSXlxTS60FTY7XqDZdrWlF16ks5u2OjfgaJpZM4XN1a5
.

python3.7的新特性

Was this page helpful?
0 / 5 - 0 ratings