NVlabs / FoundationPose

[CVPR 2024 Highlight] FoundationPose: Unified 6D Pose Estimation and Tracking of Novel Objects
https://nvlabs.github.io/FoundationPose/
Other
1.31k stars 170 forks source link

Unable to import Torch (ModuleNotFoundError) when running build_all_conda.sh #182

Open yxzisavail opened 1 month ago

yxzisavail commented 1 month ago
Env: trying to set up w/ conda, tried with docker but failed. Ubuntu 20.04 with RTX. Output: (FPose1) ysz@ps-Z790-UD:~/FoundationPose$ sudo CMAKE_PREFIX_PATH=$CONDA_PREFIX/lib/python3.9/site-packages/pybind11/share/cmake/pybind11 bash build_all_conda.sh [sudo] ysz 的密码: -- The C compiler identification is GNU 9.4.0 -- The CXX compiler identification is GNU 9.4.0 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake (found version "1.71.0") found components: system program_options -- Found OpenMP_C: -fopenmp (found version "4.5") -- Found OpenMP_CXX: -fopenmp (found version "4.5") -- Found OpenMP: TRUE (found version "4.5")
-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.8.10", minimum required is "3.6") -- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython3.8.so -- Performing Test HAS_FLTO -- Performing Test HAS_FLTO - Success -- Found pybind11: /home/ysz/anaconda3/envs/FPose1/lib/python3.9/site-packages/pybind11/include (found version "2.12.0") -- Configuring done -- Generating done -- Build files have been written to: /home/ysz/FoundationPose/mycpp/build Scanning dependencies of target mycpp [ 66%] Building CXX object CMakeFiles/mycpp.dir/src/Utils.cpp.o [ 66%] Building CXX object CMakeFiles/mycpp.dir/src/app/pybind_api.cpp.o /home/ysz/FoundationPose/mycpp/src/app/pybind_api.cpp: In function ‘vectorMatrix4f cluster_poses(float, float, const vectorMatrix4f&, const vectorMatrix4f&)’: /home/ysz/FoundationPose/mycpp/src/app/pybind_api.cpp:26:38: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘std::vector<Eigen::Matrix<float, 4, 4>, Eigen::aligned_allocator<Eigen::Matrix<float, 4, 4> > >::size_type’ {aka ‘long unsigned int’} [-Wformat=] 26
printf("num original candidates = %d\n",poses_in.size()); ~^ ~~~
int std::vector<Eigen::Matrix<float, 4, 4>, Eigen::aligned_allocator<Eigen::Matrix<float, 4, 4> > >::size_type {aka long unsigned int}
%ld
/home/ysz/FoundationPose/mycpp/src/app/pybind_api.cpp:66:42: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘std::vector<Eigen::Matrix<float, 4, 4>, Eigen::aligned_allocator<Eigen::Matrix<float, 4, 4> > >::size_type’ {aka ‘long unsigned int’} [-Wformat=] 66 printf("num of pose after clustering: %d\n",poses_out.size()); ~^ ~~~~
int std::vector<Eigen::Matrix<float, 4, 4>, Eigen::aligned_allocator<Eigen::Matrix<float, 4, 4> > >::size_type {aka long unsigned int}
%ld

[100%] Linking CXX shared module mycpp.cpython-38-x86_64-linux-gnu.so [100%] Built target mycpp Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple Obtaining file:///home/ysz/FoundationPose/bundlesdf/mycuda Preparing metadata (setup.py) ... error error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> [6 lines of output] Traceback (most recent call last): File "", line 2, in File "", line 34, in File "/home/ysz/FoundationPose/bundlesdf/mycuda/setup.py", line 13, in from torch.utils.cpp_extension import BuildExtension, CUDAExtension ModuleNotFoundError: No module named 'torch' [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. error: metadata-generation-failed

× Encountered error while generating package metadata. ╰─> See above for output.

note: This is an issue with the package mentioned above, not pip. hint: See above for details.

[notice] A new release of pip is available: 24.0 -> 24.1.2 [notice] To update, run: python3 -m pip install --upgrade pip

#######################END OF OUTPUT################################ I am 100% sure that the virtual environment I am in (FPose1) has Pytorch, Torchvision and Torchaudio installed and that their versions match correctly with the CUDA I am currently using (CUDA 11.8). Output of $ conda list (FPose1) ysz@ps-Z790-UD:~/FoundationPose$ conda list

packages in environment at /home/ysz/anaconda3/envs/FPose1:

#

Name Version Build Channel

_libgcc_mutex 0.1 main
_openmp_mutex 5.1 1_gnu
addict 2.4.0 pypi_0 pypi aiohttp 3.9.5 pypi_0 pypi aiosignal 1.3.1 pypi_0 pypi albumentations 1.4.2 pypi_0 pypi antlr4-python3-runtime 4.9.3 pypi_0 pypi anyio 4.4.0 pypi_0 pypi appdirs 1.4.4 pypi_0 pypi argon2-cffi 23.1.0 pypi_0 pypi argon2-cffi-bindings 21.2.0 pypi_0 pypi arrow 1.3.0 pypi_0 pypi asttokens 2.4.1 pypi_0 pypi async-lru 2.0.4 pypi_0 pypi async-timeout 4.0.3 pypi_0 pypi attrs 23.2.0 pypi_0 pypi babel 2.15.0 pypi_0 pypi beautifulsoup4 4.12.3 pypi_0 pypi bleach 6.1.0 pypi_0 pypi blinker 1.8.2 pypi_0 pypi bokeh 3.4.0 pypi_0 pypi braceexpand 0.1.7 pypi_0 pypi brotli 1.1.0 pypi_0 pypi ca-certificates 2024.3.11 h06a4308_0
certifi 2024.7.4 pypi_0 pypi cffi 1.16.0 pypi_0 pypi charset-normalizer 3.3.2 pypi_0 pypi click 8.1.7 pypi_0 pypi cmake 3.30.0 pypi_0 pypi cmeel 0.53.3 pypi_0 pypi cmeel-assimp 5.3.1 pypi_0 pypi cmeel-boost 1.83.0 pypi_0 pypi cmeel-console-bridge 1.0.2.2 pypi_0 pypi cmeel-octomap 1.9.8.2 pypi_0 pypi cmeel-qhull 8.0.2.1 pypi_0 pypi cmeel-tinyxml 2.6.2.3 pypi_0 pypi cmeel-urdfdom 3.1.1.1 pypi_0 pypi colorama 0.4.6 pypi_0 pypi comm 0.2.2 pypi_0 pypi configargparse 1.7 pypi_0 pypi contourpy 1.2.1 pypi_0 pypi cycler 0.12.1 pypi_0 pypi dash 2.17.1 pypi_0 pypi dash-core-components 2.0.0 pypi_0 pypi dash-html-components 2.0.0 pypi_0 pypi dash-table 5.0.0 pypi_0 pypi dataclasses-json 0.6.7 pypi_0 pypi debugpy 1.8.2 pypi_0 pypi decorator 5.1.1 pypi_0 pypi defusedxml 0.7.1 pypi_0 pypi deprecated 1.2.14 pypi_0 pypi docker-pycreds 0.4.0 pypi_0 pypi eigenpy 3.5.1 pypi_0 pypi einops 0.7.0 pypi_0 pypi entrypoints 0.4 pypi_0 pypi et-xmlfile 1.1.0 pypi_0 pypi exceptiongroup 1.2.1 pypi_0 pypi executing 2.0.1 pypi_0 pypi fastjsonschema 2.20.0 pypi_0 pypi ffmpeg-python 0.2.0 pypi_0 pypi filelock 3.15.4 pypi_0 pypi flask 3.0.3 pypi_0 pypi fonttools 4.53.1 pypi_0 pypi fqdn 1.5.1 pypi_0 pypi freetype-py 2.4.0 pypi_0 pypi frozenlist 1.4.1 pypi_0 pypi fsspec 2024.6.1 pypi_0 pypi future 1.0.0 pypi_0 pypi fvcore 0.1.5.post20221221 pypi_0 pypi g4f 0.2.7.1 pypi_0 pypi gitdb 4.0.11 pypi_0 pypi gitpython 3.1.43 pypi_0 pypi gputil 1.4.0 pypi_0 pypi h11 0.14.0 pypi_0 pypi h5py 3.10.0 pypi_0 pypi hpp-fcl 2.4.4 pypi_0 pypi httpcore 1.0.5 pypi_0 pypi httpx 0.27.0 pypi_0 pypi huggingface-hub 0.23.4 pypi_0 pypi idna 3.7 pypi_0 pypi imageio 2.34.0 pypi_0 pypi imgaug 0.4.0 pypi_0 pypi importlib-metadata 8.0.0 pypi_0 pypi importlib-resources 6.4.0 pypi_0 pypi iopath 0.1.10 pypi_0 pypi ipycanvas 0.13.2 pypi_0 pypi ipyevents 2.0.2 pypi_0 pypi ipykernel 6.29.5 pypi_0 pypi ipython 8.18.1 pypi_0 pypi ipywidgets 8.1.2 pypi_0 pypi isoduration 20.11.0 pypi_0 pypi itsdangerous 2.2.0 pypi_0 pypi jedi 0.19.1 pypi_0 pypi jinja2 3.1.4 pypi_0 pypi joblib 1.3.2 pypi_0 pypi json5 0.9.25 pypi_0 pypi jsonpatch 1.33 pypi_0 pypi jsonpointer 3.0.0 pypi_0 pypi jsonschema 4.23.0 pypi_0 pypi jsonschema-specifications 2023.12.1 pypi_0 pypi jupyter-client 7.4.9 pypi_0 pypi jupyter-core 5.7.2 pypi_0 pypi jupyter-events 0.10.0 pypi_0 pypi jupyter-lsp 2.2.5 pypi_0 pypi jupyter-server 2.14.1 pypi_0 pypi jupyter-server-terminals 0.5.3 pypi_0 pypi jupyterlab 4.1.5 pypi_0 pypi jupyterlab-pygments 0.3.0 pypi_0 pypi jupyterlab-server 2.27.2 pypi_0 pypi jupyterlab-widgets 3.0.11 pypi_0 pypi kaolin 0.15.0 pypi_0 pypi kiwisolver 1.4.5 pypi_0 pypi kornia 0.7.2 pypi_0 pypi kornia-rs 0.1.4 pypi_0 pypi lazy-loader 0.4 pypi_0 pypi ld_impl_linux-64 2.38 h1181459_1
libffi 3.4.4 h6a678d5_1
libgcc-ng 11.2.0 h1234567_1
libgomp 11.2.0 h1234567_1
libstdcxx-ng 11.2.0 h1234567_1
lit 18.1.8 pypi_0 pypi llvmlite 0.42.0 pypi_0 pypi loguru 0.7.2 pypi_0 pypi markupsafe 2.1.5 pypi_0 pypi marshmallow 3.21.3 pypi_0 pypi matplotlib 3.9.1 pypi_0 pypi matplotlib-inline 0.1.7 pypi_0 pypi meshcat 0.3.2 pypi_0 pypi mistune 3.0.2 pypi_0 pypi mpmath 1.3.0 pypi_0 pypi multidict 6.0.5 pypi_0 pypi mypy-extensions 1.0.0 pypi_0 pypi nbclient 0.10.0 pypi_0 pypi nbconvert 7.16.4 pypi_0 pypi nbformat 5.10.4 pypi_0 pypi ncurses 6.4 h6a678d5_0
nest-asyncio 1.6.0 pypi_0 pypi networkx 3.2.1 pypi_0 pypi ninja 1.11.1.1 pypi_0 pypi nodejs 0.1.1 pypi_0 pypi notebook-shim 0.2.4 pypi_0 pypi numba 0.59.1 pypi_0 pypi numpy 1.26.4 pypi_0 pypi nvdiffrast 0.3.1 pypi_0 pypi objaverse 0.1.7 pypi_0 pypi omegaconf 2.3.0 pypi_0 pypi open3d 0.18.0 pypi_0 pypi opencv-contrib-python 4.9.0.80 pypi_0 pypi opencv-python 4.9.0.80 pypi_0 pypi opencv-python-headless 4.10.0.84 pypi_0 pypi openpyxl 3.1.2 pypi_0 pypi openssl 3.0.14 h5eee18b_0
optional-django 0.1.0 pypi_0 pypi overrides 7.7.0 pypi_0 pypi packaging 24.1 pypi_0 pypi panda3d 1.10.14 pypi_0 pypi pandas 2.2.2 pypi_0 pypi pandocfilters 1.5.1 pypi_0 pypi parso 0.8.4 pypi_0 pypi pexpect 4.9.0 pypi_0 pypi pillow 10.4.0 pypi_0 pypi pin 2.7.0 pypi_0 pypi pip 24.0 py39h06a4308_0
platformdirs 4.2.2 pypi_0 pypi plotly 5.20.0 pypi_0 pypi portalocker 2.10.0 pypi_0 pypi prometheus-client 0.20.0 pypi_0 pypi prompt-toolkit 3.0.47 pypi_0 pypi protobuf 4.25.3 pypi_0 pypi psutil 6.0.0 pypi_0 pypi ptyprocess 0.7.0 pypi_0 pypi pure-eval 0.2.2 pypi_0 pypi py-spy 0.3.14 pypi_0 pypi pyarrow 16.1.0 pypi_0 pypi pybind11 2.12.0 pypi_0 pypi pybullet 3.2.6 pypi_0 pypi pycocotools 2.0.7 pypi_0 pypi pycparser 2.22 pypi_0 pypi pycryptodome 3.20.0 pypi_0 pypi pyglet 1.5.28 pypi_0 pypi pygltflib 1.16.2 pypi_0 pypi pygments 2.18.0 pypi_0 pypi pyngrok 7.1.6 pypi_0 pypi pyopengl 3.1.0 pypi_0 pypi pyopengl-accelerate 3.1.7 pypi_0 pypi pyparsing 3.1.2 pypi_0 pypi pypng 0.20220715.0 pypi_0 pypi pyquaternion 0.9.9 pypi_0 pypi pyrender 0.1.45 pypi_0 pypi pysdf 0.1.9 pypi_0 pypi python 3.9.19 h955ad1f_1
python-dateutil 2.9.0.post0 pypi_0 pypi python-json-logger 2.0.7 pypi_0 pypi pytorch3d 0.7.3 pypi_0 pypi pytz 2024.1 pypi_0 pypi pyyaml 6.0.1 pypi_0 pypi pyzmq 24.0.1 pypi_0 pypi readline 8.2 h5eee18b_0
referencing 0.35.1 pypi_0 pypi requests 2.32.3 pypi_0 pypi retrying 1.3.4 pypi_0 pypi rfc3339-validator 0.1.4 pypi_0 pypi rfc3986-validator 0.1.1 pypi_0 pypi roma 1.4.4 pypi_0 pypi rpds-py 0.19.0 pypi_0 pypi rtree 1.2.0 pypi_0 pypi ruamel-yaml 0.18.6 pypi_0 pypi ruamel-yaml-clib 0.2.8 pypi_0 pypi safetensors 0.4.3 pypi_0 pypi scikit-image 0.22.0 pypi_0 pypi scikit-learn 1.4.1.post1 pypi_0 pypi scipy 1.12.0 pypi_0 pypi seaborn 0.13.2 pypi_0 pypi send2trash 1.8.3 pypi_0 pypi sentry-sdk 2.8.0 pypi_0 pypi setproctitle 1.3.3 pypi_0 pypi setuptools 69.5.1 py39h06a4308_0
shapely 2.0.4 pypi_0 pypi simplejson 3.19.2 pypi_0 pypi six 1.16.0 pypi_0 pypi smmap 5.0.1 pypi_0 pypi sniffio 1.3.1 pypi_0 pypi soupsieve 2.5 pypi_0 pypi sqlite 3.45.3 h5eee18b_0
stack-data 0.6.3 pypi_0 pypi sympy 1.13.0 pypi_0 pypi tabulate 0.9.0 pypi_0 pypi tenacity 8.5.0 pypi_0 pypi termcolor 2.4.0 pypi_0 pypi terminado 0.18.1 pypi_0 pypi threadpoolctl 3.5.0 pypi_0 pypi tifffile 2024.7.2 pypi_0 pypi timm 0.9.16 pypi_0 pypi tinycss2 1.3.0 pypi_0 pypi tk 8.6.14 h39e8969_0
tomli 2.0.1 pypi_0 pypi torch 2.0.0+cu118 pypi_0 pypi torchaudio 2.0.1+cu118 pypi_0 pypi torchnet 0.0.4 pypi_0 pypi torchvision 0.15.1+cu118 pypi_0 pypi tornado 6.4.1 pypi_0 pypi tqdm 4.66.4 pypi_0 pypi traitlets 5.14.3 pypi_0 pypi transformations 2024.6.1 pypi_0 pypi trimesh 4.2.2 pypi_0 pypi triton 2.0.0 pypi_0 pypi types-python-dateutil 2.9.0.20240316 pypi_0 pypi typing-extensions 4.12.2 pypi_0 pypi typing-inspect 0.9.0 pypi_0 pypi tzdata 2024.1 pypi_0 pypi u-msgpack-python 2.8.0 pypi_0 pypi ultralytics 8.0.120 pypi_0 pypi uri-template 1.3.0 pypi_0 pypi urllib3 2.2.2 pypi_0 pypi usd-core 23.5 pypi_0 pypi videoio 0.2.8 pypi_0 pypi visdom 0.2.4 pypi_0 pypi wandb 0.16.5 pypi_0 pypi warp-lang 1.0.2 pypi_0 pypi wcwidth 0.2.13 pypi_0 pypi webcolors 24.6.0 pypi_0 pypi webdataset 0.2.86 pypi_0 pypi webencodings 0.5.1 pypi_0 pypi websocket-client 1.8.0 pypi_0 pypi werkzeug 3.0.3 pypi_0 pypi wheel 0.43.0 py39h06a4308_0
widgetsnbextension 4.0.11 pypi_0 pypi wrapt 1.16.0 pypi_0 pypi xatlas 0.0.9 pypi_0 pypi xlsxwriter 3.2.0 pypi_0 pypi xyzservices 2024.6.0 pypi_0 pypi xz 5.4.6 h5eee18b_1
yacs 0.1.8 pypi_0 pypi yarl 1.9.4 pypi_0 pypi zipp 3.19.2 pypi_0 pypi zlib 1.2.13 h5eee18b_1
#####################END OF OUTPUT##########################

Output of $ nvcc -V: nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2022 NVIDIA Corporation Built on Wed_Sep_21_10:33:58_PDT_2022 Cuda compilation tools, release 11.8, V11.8.89 Build cuda_11.8.r11.8/compiler.31833905_0 #####################END OF OUTPUT########################

For reference, I also added the following PATH environment variable to my ~/.bashrc: export CUDA_HOME=/usr/local/cuda-11.8 and the following two variables exist in the first place (maybe some other user added them previously): export PATH=/usr/local/cuda-11.8/bin:$PATH export LD_LIBRARY_PATH=/usr/local/cuda-11.8/lib64:$LD_LIBRARY_PATH

THANKS A LOT TO EVERYONE WHO HELP ME SOLVE THIS ISSUE!!!!!

Ashima1012 commented 1 month ago

Hi, how did you fix this problem?

yxzisavail commented 1 month ago

Well unfortunately I did not as of right now.

Ashima1012 @.***> 于2024年7月18日周四 22:25写道:

Hi, how did you fix this problem?

— Reply to this email directly, view it on GitHub https://github.com/NVlabs/FoundationPose/issues/182#issuecomment-2236682404, or unsubscribe https://github.com/notifications/unsubscribe-auth/BGH7ERKLYWLKMYMD6TFR563ZM7F6FAVCNFSM6AAAAABKUM3ZTGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMZWGY4DENBQGQ . You are receiving this because you authored the thread.Message ID: @.***>

wenbowen123 commented 2 weeks ago

Hi, did you try docker?