FCOS windows 下的环境配置

足足搞了两三个星期从win 到linux再到win,必须要记录下过程给小伙伴们填坑。

首先我自己的环境配置

作者给的环境要求

conda create --name FCOS
conda activate FCOS

# this installs the right pip and dependencies for the fresh python
conda install ipython

# FCOS and coco api dependencies
pip install ninja yacs cython matplotlib tqdm

# follow PyTorch installation in https://pytorch.org/get-started/locally/

# we give the instructions for CUDA 10.2
# 这里如果没有安装cudatoolkit需要去英伟达官网下载,只用conda里面这个cudatoolkit会在后面编译报错
conda install pytorch torchvision cudatoolkit=10.2 -c pytorch

#这个我没管
export INSTALL_DIR=$PWD

# install pycocotools. Please make sure you have installed cython.
cd $INSTALL_DIR
# 这个是linux下面下载包的命令,可以直接到GitHub上面下载包,然后用终端进入这个文件,执行python setup.py build_ext install就好
git clone https://github.com/cocodataset/cocoapi.git
cd cocoapi/PythonAPI
python setup.py build_ext install

# install PyTorch Detection
cd $INSTALL_DIR
git clone https://github.com/tianzhi0549/FCOS.git
cd FCOS

# the following will install the lib with
# symbolic links, so that you can modify
# the files if you want and won't need to
# re-build it
# 关键就是这里,它会各种报错,估计是版本问题,但是作者没有给具体的版本,所以只能见招拆招。
具体的有
1 首先你必须下载vs2017C++的编译工具,我试过用wingw不行。
2 error: command ‘C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v10.1\\bin\\nvcc.exe‘ failed
python setup.py build develop --no-deps 这个报错需要修改AT_CHECK,具体的位置见作者的修改
https://github.com/tianzhi0549/FCOS/pull/361/commits/bab0a51ce4e79815d48867d2ea8a3d0d0edbbd2a
3 subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.
这个问题我是按照一个博客把setup由原来
cmdclass={"build_ext": torch.utils.cpp_extension.BuildExtension}  改为

cmdclass={"build_ext": torch.utils.cpp_extension.BuildExtension}.with_options(use_ninja=False)

 4 torch._six.PY3 not found https://github.com/tianzhi0549/FCOS/pull/359/commits/f06023f9d4e7e16aa0d947fd8a3f5d30074bf35d
5 RuntimeError: Not compiled with GPU support。这个问题出现是set up编译有问题,我之前没有安装cudatoolkits 这个需要和cuda版本匹配

6 cannot import name ‘_download_url_to_file‘ from ‘torch.hub‘ 这个我直接把它注释了,也没有报错,在maskRCNN哪里有类似的问题
 Error after fresh install: Cannot import '_download_url_to_file' from 'torch.utils.model_zoo' · Issue #674 · facebookresearch/maskrcnn-benchmark · GitHub
还有其他看不懂的报错也忘记了...
unset INSTALL_DIR

 主要是要根据作者的install文件来安装,我一开始就是直接用的python3.9。CU113我以为能兼容,结果在编译“  python setup.py build develop --no-deps”这个的时候一直各种报错,然后按照网上找了下发现很少WIN配成功的。大部分是linux所以我折腾虚拟机配linux环境发现其不能用gpu,网上有说能有说不能,但是没有具体的操作过程。于是又来win继续按照作者给的安装。总之不容易啊


                
  • 25
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值