I am trying to import Rotated Mask R-CNN libraries into google colab but seem unable to do so, likely due to incompatibility issues with other libraries.
If we try the default install the following errors occur:
#Install rotated_maskRCNN
!pip install git+https://github.com/mrlooi/rotated_maskrcnn
Collecting git+https://github.com/mrlooi/rotated_maskrcnn
Cloning https://github.com/mrlooi/rotated_maskrcnn to /tmp/pip-req-build-tciz12ki
Running command git clone -q https://github.com/mrlooi/rotated_maskrcnn /tmp/pip-req-build-tciz12ki
Building wheels for collected packages: maskrcnn-benchmark
Building wheel for maskrcnn-benchmark (setup.py) ... error
ERROR: Failed building wheel for maskrcnn-benchmark
Running setup.py clean for maskrcnn-benchmark
Failed to build maskrcnn-benchmark
Installing collected packages: maskrcnn-benchmark
Running setup.py install for maskrcnn-benchmark ... error
ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-tciz12ki/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-tciz12ki/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-onk26ne6/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.
When we simply execute the following two lines of code in Google Colab the following error appears:
!git clone https://github.com/mrlooi/rotated_maskrcnn.git
!python "/content/rotated_maskrcnn/setup.py" build develop
2 errors detected in the compilation of "/content/rotated_maskrcnn/maskrcnn_benchmark/csrc/cuda/deform_pool_cuda.cu".
error: command '/usr/local/cuda/bin/nvcc' failed with exit status 1
But during the install, many more errors occurred. According to the install.MD we need the following:
# follow PyTorch installation in https://pytorch.org/get-started/locally/
# we give the instructions for CUDA 9.0
conda install -c pytorch pytorch-nightly torchvision cudatoolkit=9.0
Which seems complicated to achieve. I have ran the following code to uninstall existing cuda's and install cuda 9.0 which does seem to work, although CUDA 10.2 and 11.0 remain in usr/local/
#Uninstall the current CUDA version
!apt-get --purge remove cuda nvidia* libnvidia-*
!dpkg -l | grep cuda- | awk '{print $2}' | xargs -n1 dpkg --purge
!apt-get remove cuda-*
!apt autoremove
!apt-get update
#Install CUDA 9.0
!wget https://developer.nvidia.com/compute/cuda/9.0/Prod/local_installers/cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64-deb
!dpkg -i cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64-deb
!apt-key add /var/cuda-repo-9-0-local/7fa2af80.pub
!apt-get update
!apt-get install cuda=9.0.176-1
#We need CUDA 9 for maskRCNN to work
!cat /usr/local/cuda/version.txt
CUDA Version 9.0.176
Still the same error messages are maintaining and I am unsure where everything is going haywire. I have also tried to setup an anaconda environment in the Colab environment, but this defeats the purpose of using google Colab, and also didn't get this to work correctly.