{{htmlmetatags>metatag-robots=(index, follow) metatag-keywords=(anygrasp, 安装部署, MinkowskiEngine, PyTorch安装, gcc9, sklearn报错, Python版本兼容性, numpy版本错误, pointnet2导入错误) metatag-description=(获取详细的指南,了解如何成功安装和部署AnyGrasp,包括解决MinkowskiEngine、PyTorch版本选择、gcc9编译问题以及常见错误如sklearn、numpy版本错误和pointnet2导入错误的解决方案。) metatag-media-og:image=(:wiki:anygrasp-install-guide.jpg) metatag-og:description=(探索如何克服安装AnyGrasp时遇到的各类障碍,从选择合适的Python和PyTorch版本到解决gcc9编译错误及处理依赖库如sklearn、numpy和pointnet2的问题。) metatag-og:any=(确保您的系统配置满足AnyGrasp的运行要求,并学习如何通过正确的环境设置和依赖管理来避免常见的安装错误。) }} ====== anygrasp的安装部署 ====== 首先,必须安装conda,推荐使用 python10版本。 激活conda环境,然后安装 minkowskiengine [[机器人:minkowskiengine:minkowskiengine安装|minkowskiengine安装]] 根据自己的实际情况安装torch,我这里是4090显卡 conda install openblas-devel -c anaconda pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 -f https://download.pytorch.org/whl/torch_stable.html 后续会用到gcc编译,必须gcc9,不然会有gcc报错,参考 安装 minkowskiengine [[机器人:minkowskiengine:minkowskiengine安装|minkowskiengine安装]] /usr/include/c++/11/bits/std_function.h:435:145: error: parameter packs not expanded with ‘...’: 435 | function(_Functor&& __f) | ^ ... error: command '/usr/bin/nvcc' failed with exit code 1 如果你的网络不佳,这里有加速国内镜像: https://gitee.com/ctbots/mirror-anygrasp_sdk 按照readme安装即可,这里总结一些常见错误: ===== 没有提前申请证书 ===== 需要根据https://gitee.com/ctbots/mirror-anygrasp_sdk 的 readme里的说明,有license相关的内容,科学上网,然后填写表格; 会收到 - 激活码 - 数据集,分别是checkpoint_detection.tar【290MB】 和 checkpoint_tracking.tar【24MB】 ===== pip install 出现sklearn报错 ===== Collecting sklearn (from graspnetAPI->-r requirements.txt (line 5)) Downloading https://pypi.tuna.tsinghua.edu.cn/packages/46/1c/395a83ee7b2d2ad7a05b453872053d41449564477c81dc356f720b16eac4/sklearn-0.0.post12.tar.gz (2.6 kB) Preparing metadata (setup.py) ... error error: subprocess-exited-with-error × python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> [15 lines of output] The 'sklearn' PyPI package is deprecated, use 'scikit-learn' rather than 'sklearn' for pip commands. Here is how to fix this error in the main use cases: - use 'pip install scikit-learn' rather than 'pip install sklearn' - replace 'sklearn' by 'scikit-learn' in your pip requirements files (requirements.txt, setup.py, setup.cfg, Pipfile, etc ...) - if the 'sklearn' package is used by one of your dependencies, it would be great if you take some time to track which package uses 'sklearn' instead of 'scikit-learn' and report it to their issue tracker - as a last resort, set the environment variable SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL=True to avoid this error More information is available at https://github.com/scikit-learn/sklearn-pypi-package [end of output] 解决方式,设置环境变量:export SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL=True ===== gsnet报错 提示python版本3.6之类的和当前python版本不兼容 ===== Traceback (most recent call last): File "/home/ctbots/code/mirror-anygrasp_sdk/grasp_detection/demo.py", line 8, in from gsnet import AnyGrasp ImportError: /home/ctbots/code/mirror-anygrasp_sdk/grasp_detection/gsnet.so: undefined symbol: _PyGC_generation0 或者 干脆不显示详细内容,直接显示 python3.6 之类的报错。 解决方式:注意,必须复制2个so到 工作目录,而且版本必须和当前的python对应。 分别是 gsnet.so 和 lib_cxx.so 分别在 grasp_detection/gsnet_versions/ 目录 和 license_registration/lib_cxx_versions/ 目录; 同时记得把 license 文件夹拷贝到工作目录。 ===== 提示numpy版本错误 ===== pip install "opencv-python<4.11" "numpy==1.23.4" "scipy<1.15.3" ===== pointnet2 提示导入错误 ===== ModuleNotFoundError: No module named 'pointnet2' 解决方案【一定要在当前的conda内,而且是gcc9】: cd pointnet2 python setup.py install ===== 找不到 libcrypto.so.1.1 ===== 从ubuntu的deb包中搜索 libssl1.1_1.1.1f-1ubuntu2.23_amd64.deb, 解压压缩包,把 压缩包里 /usr/lib/x86_64-linux-gnu 的 libcrypto.so.1.1 复制到项目根目录 官方的 https://launchpad.net 如果不科学上网可能无法访问, 可以使用镜像加速 https://748996.xyz/launchpad.net/ubuntu 然后 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:项目的绝对路径