Import error from importing model_zoo
See original GitHub issueI am working in CoLab, below is the code used to install and import libraries install dependencies
!pip install pyyaml==5.1
!pip install torch==1.8
!pip install wandb
import torch, torchvision
print(torch.__version__, torch.cuda.is_available())
!gcc --version
!git clone https://github.com/facebookresearch/detectron2
!pip install pycocotools wandb gputil psutil humanize
!pip install azure-storage-blob==2.1.0
# memory footprint support libraries/code
!ln -sf /opt/bin/nvidia-smi /usr/bin/nvidia-smi
# opencv is pre-installed on colab
# install detectron2: (Colab has CUDA 10.1 + torch 1.7)
# See https://detectron2.readthedocs.io/tutorials/install.html for instructions
assert torch.__version__.startswith("1.8")
!pip install detectron2 -f https://dl.fbaipublicfiles.com/detectron2/wheels/cu111/torch1.8/index.html
# exit(0) # After installation, you need to "restart runtime" in Colab. This line can also restart runtime>
#Code below is imports used
import os
import uuid
import sys
from pathlib import Path
from azure.storage.blob import BlockBlobService, PublicAccess
from sklearn.model_selection import train_test_split
import matplotlib.pyplot as plt
import numpy as np
import cv2
from google.colab.patches import cv2_imshow
import random
import wandb
import json
from pycocotools.coco import COCO
import psutil
import humanize
import os
import GPUtil as GPU
import detectron2
from detectron2.utils.logger import setup_logger
setup_logger()
from collections import defaultdict
# import some common detectron2 utilities
from detectron2 import model_zoo
from detectron2.data.datasets import register_coco_instances
from detectron2.engine import DefaultPredictor
from detectron2.config import get_cfg
from detectron2.utils.visualizer import Visualizer
from detectron2.data import MetadataCatalog, DatasetCatalog
from detectron2 import model_zoo
When using the above line I get an import error:
ImportError Traceback (most recent call last)
<ipython-input-2-0396cd12a8c0> in <module>()
27 from collections import defaultdict
28 # import some common detectron2 utilities
---> 29 from detectron2 import model_zoo
30 from detectron2.data.datasets import register_coco_instances
31 from detectron2.engine import DefaultPredictor
4 frames
/usr/local/lib/python3.7/dist-packages/detectron2/layers/deform_conv.py in <module>()
9 from torchvision.ops import deform_conv2d
10
---> 11 from detectron2 import _C
12
13 from .wrappers import _NewEmptyTensorOp
ImportError: libtorch_cuda_cu.so: cannot open shared object file: No such file or directory
My code was working a few days ago and I am not sure if there was a version change and I might need to adjust something to incorporate this.
Any advice would be greatly appreciated.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5
Top Results From Across the Web
ValueError from detectron2 import model_zoo - Stack Overflow
The code that raise the error is: import cv2 import torch, torchvision import detectron2 from detectron2.utils.logger import setup_logger ...
Read more >Errors importing models from ONNX Model Zoo - Questions
Hi, I am trying to import some pre-trained ONNX models from here https://github.com/onnx/models. I have met some issues, and I was wondering if...
Read more >TDA4VM: Error while importing Yolov3 from onnx model zoo ...
Part Number: TDA4VM Hi all, I want to import Yolov3 model from ONNX models for performance evaluation, using the Edge AI Cloud ....
Read more >Import Model — OpenVINO™ documentation — Version(latest)
This document focuses on importing a model from the Open Model Zoo. If you want to learn about importing original model, see the...
Read more >model-zoo - PyPI
model-zoo 0.4.1 ... ModelZoo. A Scaffold to help you build Deep-learning Model much more ... from model_zoo import Model import tensorflow as tf...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I solved this on Colab. You have to check your CUDA version and PyTorch version matches to detectron2 ones.
If not, change it.
Then restart your runtime, and retry installing detectron2.
I am getting the same error. Steps to reproduce:
Error:
CC @ppwwyyxx