0

I am experiencing this error:

ERROR: Command errored out with exit status 1: /usr/local/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/root/detectron2/setup.py'"'"'; __file__='"'"'/root/detectron2/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps Check the logs for full command output.

when trying to install Dectron2 through Google Colab. I am trying to do so in the Colab notebook for Facebook's Robust CVD and have changed OpenCV contrib python from version 3.4.2.16 to 3.4.2.17 . This is the link to the GitHub repo: https://github.com/facebookresearch/robust_cvd Any ideas on how to fix this?

FoxLynx64
  • 1
  • 2

1 Answers1

0

Even though you have not provided details of how you get the error, I have tried installing Detectron2 on Colab as follows and it works:

# install dependencies: 
!pip install pyyaml==5.1
# check pytorch installation: 
import torch, torchvision
print(torch.__version__, torch.cuda.is_available())

# clone the repo in order to access pre-defined configs in PointRend project
!git clone --branch v0.6 https://github.com/facebookresearch/detectron2.git detectron2_repo
# install detectron2 from source
!pip install -e detectron2_repo
# See https://detectron2.readthedocs.io/tutorials/install.html for other installation options

You may need to restart your runtime prior to this, to let your installation take effect
# Some basic setup:
# Setup detectron2 logger
import detectron2
from detectron2.utils.logger import setup_logger
setup_logger()

# import some common libraries
import numpy as np
import cv2
import torch
from google.colab.patches import cv2_imshow

And then you can proceed with your code.

Aamir Shah
  • 31
  • 7
  • I am using the colab notebook, running all the commands under “Prepare the environment” and only made one change to the opencv version since 3.4.2.16 is unavailable. Other than that you should be able to reproduce it using the colab notebook in the repository. – FoxLynx64 Jan 27 '22 at 00:59
  • I have tried your code in the colab notebook provided in the GitHub repository and get the following error: – FoxLynx64 Jan 27 '22 at 04:18
  • ERROR: Command errored out with exit status 1: /usr/local/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/content/cvd2/detectron2_repo/setup.py'"'"'; __file__='"'"'/content/cvd2/detectron2_repo/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps Check the logs for full command output. – FoxLynx64 Jan 27 '22 at 04:19
  • --------------------------------------------------------------------------- ModuleNotFoundError Traceback (most recent call last) in () 15 # Setup detectron2 logger 16 import detectron2 ---> 17 from detectron2.utils.logger import setup_logger 18 setup_logger() 19 ModuleNotFoundError: No module named 'detectron2.utils' – FoxLynx64 Jan 27 '22 at 04:20
  • --------------------------------------------------------------------------- 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. --------------------------------------------------------------------------- – FoxLynx64 Jan 27 '22 at 04:21
  • This is the link to the Colab Notebook I am talking about since you can't seem to open it from GitHub: – FoxLynx64 Jan 27 '22 at 04:24
  • https://colab.research.google.com/drive/1YOLXsb4JUOD1wt5TXB2ln78koocm-bu8?usp=sharing – FoxLynx64 Jan 27 '22 at 04:24
  • I also opened a new Colab Notebook, ran your code, and got the same error. It seems that for some reason your Colab Notebooks are running differently from mine. – FoxLynx64 Jan 27 '22 at 04:25
  • Okay, I managed to get it to install by saying pip install rather than import as it wanted me to in the error message. I then installed all the other dependencies your code left out using the exact same commands that were in the original colab notebook. Everything appeared to be good until I tried to run the app and I got this error: – FoxLynx64 Jan 27 '22 at 04:59
  • ModuleNotFoundError: No module named 'lib_python' – FoxLynx64 Jan 27 '22 at 04:59
  • Have you tried this? https://stackoverflow.com/questions/59984526/getting-command-errored-out-with-exit-status-1-python-setup-py-egg-info-while – Aamir Shah Jan 27 '22 at 05:00
  • I tried to look up any modules named lib_python and none of them worked. This is clearly a part of some package that I have failed to install, but I copied all the code exactly and ran it so it must not be in the original code. I have no idea where to find it. – FoxLynx64 Jan 27 '22 at 05:03
  • Just had a look. Unfortunately, there is no requirements.txt file in the repo. Any other suggestions? – FoxLynx64 Jan 27 '22 at 06:39