GPU4N装trochdrug以及使用方法

Github
Installation
服务器上的gcc版本太老了,会报如下错误,所以更新了gcc
gcc: 错误:unrecognized command line option ‘-std=c++14’
- conda create -n torchdrug python=3.7
- conda activate torchdrug
- #升级gcc版本
- conda install https://anaconda.org/brown-data-science/gcc/5.4.0/download/linux-64/gcc-5.4.0-0.tar.bz2
- #conda install -c conda-forge gcc
- gcc --version
- conda install torchdrug -c milagraph -c conda-forge -c pytorch -c pyg
- conda install -n torchdrug ipykernel --update-deps --force-reinstall
- pip install ipywidgets
【conda解决】安装Torchvision后使用PIL报错,ImportError: cannot import name 'PILLOW_VERSION' from 'PIL'
ImportError: cannot import name 'PILLOW_VERSION' from 'PIL' (/home/jiajie/anaconda3/envs/py35/lib/python3.7/site-packages/PIL/__init__.py)
1
原来用conda安装的话,默认pillow版本为7.0.0,此版本的pillow已经移除了’PILLOW_VERSION’,所以就会报错,要换成一个旧版本,如:改为安装pillow==6.1,输入:
- conda install pillow==6.1
就解决了。
如果用pip来安装的话,也是同样道理,先卸载再重新安装
- pip3 uninstall pillow
- pip3 install pillow==6.1
Bug
RuntimeError: Ninja is required to load C++ extensions
pip install ninja之后仍然没有解决,采用以下解决方案
之后出现了卡在/home/chpeng/anaconda3/envs/torchdrug_2/lib/python3.7/site-packages/torchdrug/utils/torch.py,也没有出现报错信息
原因可能前面编译的时候产生了很多垃圾,采用以下解决办法
- rm -r /home/chpeng/.cache/torch_extensions