question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Detectron2 libraries not installing (Colab Tutorial also not working)

See original GitHub issue

Instructions To Reproduce the 🐛 Bug:

Code:

# Some basic setup:
!pip install pyyaml==5.1

import torch
TORCH_VERSION = ".".join(torch.__version__.split(".")[:2])
CUDA_VERSION = torch.__version__.split("+")[-1]
#print("torch: ", TORCH_VERSION, "; cuda: ", CUDA_VERSION)
!pip install detectron2 -f https://dl.fbaipublicfiles.com/detectron2/wheels/$CUDA_VERSION/torch$TORCH_VERSION/index.html

# Setup detectron2 logger
import detectron2
from detectron2.utils.logger import setup_logger
setup_logger()

# import some common libraries
import numpy as np
import os, json, cv2, random
from google.colab.patches import cv2_imshow

# import some common detectron2 utilities
from detectron2 import model_zoo
from detectron2.engine import DefaultPredictor
from detectron2.config import get_cfg
from detectron2.utils.visualizer import Visualizer
from detectron2.data import MetadataCatalog, DatasetCatalog>

Logs:


ImportError Traceback (most recent call last) <ipython-input-3-9283645e3740> in <module>() 11 12 # import some common detectron2 utilities —> 13 from detectron2 import model_zoo 14 from detectron2.engine import DefaultPredictor 15 from detectron2.config import get_cfg

4 frames /usr/local/lib/python3.7/dist-packages/detectron2/layers/deform_conv.py in <module>() 8 from torch.nn.modules.utils import _pair 9 —> 10 from detectron2 import _C 11 12 from .wrappers import _NewEmptyTensorOp

ImportError: /usr/local/lib/python3.7/dist-packages/detectron2/_C.cpython-37m-x86_64-linux-gnu.so: undefined symbol: _ZN6caffe28TypeMeta21_typeMetaDataInstanceISt7complexIdEEEPKNS_6detail12TypeMetaDataEv


NOTE: If your import is failing due to a missing package, you can manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the “Open Examples” button below.>

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5

github_iconTop GitHub Comments

15reactions
RomRoccommented, Apr 27, 2022

Me too I have problem installing D2 in Colab from yesterday, I guess they changed Pytorch version in Colab. I solved by reinstalling the compatible version of Pytorch:

!pip uninstall torch -y
!pip uninstall torchvision -y
!pip install torch==1.10.1+cu111 torchvision==0.11.2+cu111 -f https://download.pytorch.org/whl/torch_stable.html
0reactions
ppwwyyxxcommented, May 19, 2022

The colab tutorial now uses a different pytorch version and works correctly

Read more comments on GitHub >

github_iconTop Results From Across the Web

Installation — detectron2 0.6 documentation
This usually happens when detectron2 or torchvision is not compiled with the version of PyTorch you're running. If the error comes from a...
Read more >
Detectron2 Setup.py Error In Colab Notebook For Robust CVD
I am using the colab notebook, running all the commands under “Prepare the environment” and only made one change to the opencv version...
Read more >
Object Detection, Instance Segmentation on Google Colab
Detectron2 tutorial using Colab. Learn how to setup Detectron2 on Google colab with GPU support and run object detection and instance ...
Read more >
Detectron2+LTT.ipynb - Colaboratory - Google Colab
This is the official colab tutorial for Learn then Test. We will go over how to imbue the Detectron2 instance segmentation model with...
Read more >
Training and Evaluating FiftyOne Datasets with Detectron2
This walkthrough is based off of the official Detectron2 tutorial, ... !python -m pip install pyyaml==5.1 # Detectron2 has not released pre-built binaries ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found