1、項目要求torchsparse @ git+https://github.com/mit-han-lab/torchsparse.git@v1.4.0
2、torch==1.8.1+cu111
nvcc--version:11.1
這個版本的cuda匹配的gcc、g++經常是7.5。設置為7.5.
(這個gcc、g++版本修改不一定,可以先進行后面的,不行再回來改。修改優先權參考更改gcc默認版本(gcc版本降級/升級)_gcc version 4.2.1-sjlj怎么更改-CSDN博客可)
3、但還是報錯:
沒有那個文件或目錄
? ? ? ?#include <google/dense_hash_map>
? ? ? ? ? ? ? ? ^~~~~~~~~~~~~~~~~~~~~~~
? ? ? compilation terminated.
4、看torchsparse項目的readme文件:
## Installation
TorchSparse depends on the [Google Sparse Hash](https://github.com/sparsehash/sparsehash) library.
* On Ubuntu, it can be installed by
```bash
sudo apt-get install libsparsehash-dev
```
5、可是直接sudo apt-get install libsparsehash-dev安裝不行,我的ubuntu22.10,沒有專門針對這個版本的安裝包,
有一個通用的:(可能是高版本兼容低版本)https://ubuntu.pkgs.org/22.04/ubuntu-universe-amd64/libsparsehash-dev_2.0.3-2_all.deb.html
手動下載后進入那個文件夾:
sudo dpkg -i libsparsehash-dev_2.0.3-2_all.deb
正在選中未選擇的軟件包 libsparsehash-dev。
(正在讀取數據庫 ... 系統當前共安裝有 313111 個文件和目錄。)
準備解壓 libsparsehash-dev_2.0.3-2_all.deb ?...
正在解壓 libsparsehash-dev (2.0.3-2) ...
正在設置 libsparsehash-dev (2.0.3-2) ...
?然后dpkg -l | grep libsparsehash-dev
ii ?libsparsehash-dev ? ? ? ? ? ? ? ? ? ? ? ? ?2.0.3-2 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?all ? ? ? ? ?Google's extremely memory-efficient C++ hash_map implementation
有了。
6、再次執行:pip install --no-cache-dir ?./torchsparse-1.4.0
Processing ./torchsparse-1.4.0
? Preparing metadata (setup.py) ... done
Building wheels for collected packages: torchsparse
? Building wheel for torchsparse (setup.py) ... done
? Created wheel for torchsparse: filename=torchsparse-1.4.0-cp38-cp38-linux_x86_64.whl size=7148323 sha256=00b0f2b02360b4cfbe73d4d5a6846b57e324f532ce9c92eead7c5aa87a2ecf16
? Stored in directory: /tmp/pip-ephem-wheel-cache-xam63_h5/wheels/e0/80/b5/8ea7e34d5ffc1d1873f7d0f64ca5e602e03db70625587e74e8
Successfully built torchsparse
Installing collected packages: torchsparse
Successfully installed torchsparse-1.4.0
成功了,項目不再提示沒這個包了。