Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to fix "ImportError: cannot import name 'dataclass'"? #1

Open
htliu6 opened this issue Apr 26, 2022 · 5 comments
Open

How to fix "ImportError: cannot import name 'dataclass'"? #1

htliu6 opened this issue Apr 26, 2022 · 5 comments

Comments

@htliu6
Copy link

htliu6 commented Apr 26, 2022

Excuse me, I encountered following issues when setting up edge node. Have you ever notice this problem? Thanks!

$ python3 edge_main.py -f ~/cutout1.mp4 -i 50
Traceback (most recent call last):
  File "edge_main.py", line 14, in <module>
    from local.decision_engine import DecisionEngine
  File "/home/htliu/SmartEye/local/decision_engine.py", line 4, in <module>
    from model_manager.model_cache import get_fastest_model, get_most_precise_model
  File "/home/htliu/SmartEye/model_manager/model_cache.py", line 3, in <module>
    import torch
  File "/home/htliu/.local/lib/python3.6/site-packages/torch/__init__.py", line 627, in <module>
    import torch.utils.data
  File "/home/htliu/.local/lib/python3.6/site-packages/torch/utils/data/__init__.py", line 6, in <module>
    from .dataloader import DataLoader, _DatasetKind, get_worker_info
  File "/home/htliu/.local/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 21, in <module>
    from . import _utils
  File "/home/htliu/.local/lib/python3.6/site-packages/torch/utils/data/_utils/__init__.py", line 45, in <module>
    from . import worker, signal_handling, pin_memory, collate, fetch
  File "/home/htliu/.local/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py", line 10, in <module>
    from dataclasses import dataclass
ImportError: cannot import name 'dataclass'
@ZhiyanWXZ
Copy link
Collaborator

ZhiyanWXZ commented Apr 26, 2022 via email

@htliu6
Copy link
Author

htliu6 commented Apr 26, 2022

Thanks for your kindly reply! I install pytorch using the following command line
pip install torch==1.8.0+cpu torchvision==0.9.0+cpu torchaudio==0.8.0 -f https://download.pytorch.org/whl/torch_stable.html
from https://pytorch.org/get-started/previous-versions/#linux-and-windows-11, and everything gets OK when installation finished.

I wonder whether this matters if I have no GPU with my VM.

@ZhiyanWXZ
Copy link
Collaborator

ZhiyanWXZ commented Apr 26, 2022 via email

@htliu6
Copy link
Author

htliu6 commented Apr 27, 2022

Thanks for your reply! BTW, I wonder which version of opencv-python you adopted when running this repo. Thanks!

@ZhiyanWXZ
Copy link
Collaborator

ZhiyanWXZ commented Oct 11, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants