cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Detectron2 install

Westinghouse
New Contributor II

I have been struggling to install Detectron 2. I think it is an issue with Cuda. Any adivise?

install

!pip install -q "detectron2@git+https://github.com/facebookresearch/detectron2.git@e2ce8dc#egg=detectron2"

Error:

qm8vsdal/detectron2_85faeed5ce7945dbad35d6c918b88b44/detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated_cuda.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options '-fPIC' -O3 -DCUDA_HAS_FP16=1 -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_gcc\" -DPYBIND11_STDLIB=\"_libstdcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1011\" -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_70,code=compute_70 -gencode=arch=compute_70,code=sm_70 -std=c++17

In file included from /tmp/pip-install-qm8vsdal/detectron2_85faeed5ce7945dbad35d6c918b88b44/detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated_cuda.cu:3:

/local_disk0/.ephemeral_nfs/envs/pythonEnv-e16d1c93-889b-4c84-bb01-f482f62b47b7/lib/python3.9/site-packages/torch/include/ATen/cuda/CUDAContext.h:6:10: fatal error: cusparse.h: No such file or directory

6 | #include <cusparse.h>

| ^~~~~~~~~~~~

compilation terminated.

error: command '/usr/local/cuda/bin/nvcc' failed with exit code 1

----------------------------------------

ERROR: Command errored out with exit status 1: /local_disk0/.ephemeral_nfs/envs/pythonEnv-e16d1c93-889b-4c84-bb01-f482f62b47b7/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-qm8vsdal/detectron2_85faeed5ce7945dbad35d6c918b88b44/setup.py'"'"'; __file__='"'"'/tmp/pip-install-qm8vsdal/detectron2_85faeed5ce7945dbad35d6c918b88b44/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'"'"'))' install --record /tmp/pip-record-1rmjnwqw/install-record.txt --single-version-externally-managed --compile --install-headers /local_disk0/.ephemeral_nfs/envs/pythonEnv-e16d1c93-889b-4c84-bb01-f482f62b47b7/include/site/python3.9/detectron2 Check the logs for full command output.

WARNING: You are using pip version 21.2.4; however, version 23.1.2 is available.

You should consider upgrading via the '/local_disk0/.ephemeral_nfs/envs/pythonEnv-e16d1c93-889b-4c84-bb01-f482f62b47b7/bin/python -m pip install --upgrade pip' comman

7 REPLIES 7

Debayan
Databricks Employee
Databricks Employee

Hi, The issue can be with dependency package installation, which is CUDA here (most probably).

Also, could you please get the logs for full command output?

Also, please tag @Debayanโ€‹ with your next response which will notify me, Thank you!

@Debayan Mukherjeeโ€‹ Unfortunately your links did not help. Kind of scratching my head at this point.

Anonymous
Not applicable

@Joshua Robergeโ€‹ :

The error message suggests that the installation of Detectron2 failed due to a missing file (cusparse.h) related to CUDA. To resolve this issue, you can try the following steps:

  1. Check CUDA Installation: Ensure that CUDA is properly installed on your system. You can verify the installation by running nvcc --version in your terminal and checking if it returns the CUDA version.
  2. Check CUDA Compatibility: Make sure the CUDA version installed on your system is compatible with the version of Detectron2 you are trying to install. Refer to the Detectron2 documentation or repository for information on the required CUDA version.
  3. Install CUDA Toolkit: If CUDA is not installed or an incompatible version is present, you may need to install the appropriate version of the CUDA Toolkit. You can download the CUDA Toolkit from the NVIDIA website and follow the installation instructions specific to your operating system.
  4. Update PyTorch: Ensure that you have the latest version of PyTorch installed.
!pip install torch --upgrade

Finally, Retry Detectron2 Installation: After verifying the CUDA installation and updating PyTorch, attempt to reinstall Detectron2 using the pip command you provided:

Vartika
Databricks Employee
Databricks Employee

Hi @Joshua Robergeโ€‹,

We haven't heard from you since the last response from @Debayan Mukherjeeโ€‹โ€‹, and I was checking back to see if you were able to resolve your issue and would you be happy to share the solution, as it can be helpful to others. 

Also, Please don't forget to click on the "Select As Best" button whenever the information provided helps resolve your question.

Unfortunately his solution did not work out. Are there any other suggestions? I'm still getting build issues

Debayan
Databricks Employee
Databricks Employee

I think the issue is with the 3rd party package Detectron 2. Do you have issues installing other packages?

Anonymous
Not applicable

Hi @Joshua Robergeโ€‹

Sorry for the inconvenience!

Kindly review the solution offered by @Suteja Kanuri.

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโ€™t want to miss the chance to attend and share knowledge.

If there isnโ€™t a group near you, start one and help create a community that brings people together.

Request a New Group