facebookresearch / pytorchvideo

A deep learning library for video understanding research.

Home Page:https://pytorchvideo.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ImportError: cannot import name 'cached_property' from 'functools' in 'video_detection_inference_tutorial '

Pinocchio2018 opened this issue · comments

I try to run the tutorial code. I met this error below

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-4-5f0d07be2d03> in <module>
      7 import detectron2
      8 from detectron2.config import get_cfg
----> 9 from detectron2 import model_zoo
     10 from detectron2.engine import DefaultPredictor
     11 

~/software/anaconda3/envs/pytorchvideo/lib/python3.7/site-packages/detectron2/model_zoo/__init__.py in <module>
      6 """
      7 
----> 8 from .model_zoo import get, get_config_file, get_checkpoint_url, get_config
      9 
     10 __all__ = ["get_checkpoint_url", "get", "get_config_file", "get_config"]

~/software/anaconda3/envs/pytorchvideo/lib/python3.7/site-packages/detectron2/model_zoo/model_zoo.py in <module>
      7 from detectron2.checkpoint import DetectionCheckpointer
      8 from detectron2.config import CfgNode, LazyConfig, get_cfg, instantiate
----> 9 from detectron2.modeling import build_model
     10 
     11 

~/software/anaconda3/envs/pytorchvideo/lib/python3.7/site-packages/detectron2/modeling/__init__.py in <module>
     18     SwinTransformer,
     19 )
---> 20 from .meta_arch import (
     21     META_ARCH_REGISTRY,
     22     SEM_SEG_HEADS_REGISTRY,

~/software/anaconda3/envs/pytorchvideo/lib/python3.7/site-packages/detectron2/modeling/meta_arch/__init__.py in <module>
      4 from .build import META_ARCH_REGISTRY, build_model  # isort:skip
      5 
----> 6 from .panoptic_fpn import PanopticFPN
      7 
      8 # import all the meta_arch, so they will be registered

~/software/anaconda3/envs/pytorchvideo/lib/python3.7/site-packages/detectron2/modeling/meta_arch/panoptic_fpn.py in <module>
     12 from ..postprocessing import detector_postprocess, sem_seg_postprocess
     13 from .build import META_ARCH_REGISTRY
---> 14 from .rcnn import GeneralizedRCNN
     15 from .semantic_seg import build_sem_seg_head
     16 

~/software/anaconda3/envs/pytorchvideo/lib/python3.7/site-packages/detectron2/modeling/meta_arch/rcnn.py in <module>
     10 from detectron2.layers import move_device_like
     11 from detectron2.structures import ImageList, Instances
---> 12 from detectron2.utils.events import get_event_storage
     13 from detectron2.utils.logger import log_first_n
     14 

~/software/anaconda3/envs/pytorchvideo/lib/python3.7/site-packages/detectron2/utils/events.py in <module>
      7 from collections import defaultdict
      8 from contextlib import contextmanager
----> 9 from functools import cached_property
     10 from typing import Optional
     11 import torch

ImportError: cannot import name 'cached_property' from 'functools' (/home/siyu/software/anaconda3/envs/pytorchvideo/lib/python3.7/functools.py)

Is this error due to the newiest version of detectron2 required higher verision of Python?
image