问题描述
我正在尝试将 Rotated Mask R-CNN 库导入 google colab,但似乎无法这样做,可能是由于与其他库的不兼容问题。
#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.
当我们在 Google Colab 中简单地执行以下两行代码时,会出现以下错误:
!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
但是在安装过程中,出现了更多错误。根据 install.MD 我们需要以下内容:
# 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
这似乎很难实现。 我已经运行了以下代码来卸载现有的 cuda 并安装 cuda 9.0,这似乎确实有效,尽管 CUDA 10.2 和 11.0 仍保留在 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
仍然保留着相同的错误消息,我不确定一切都在哪里出问题了。我也尝试在 Colab 环境中设置 anaconda 环境,但这违背了使用 google Colab 的目的,也没有让它正常工作。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)