use venv, Pytorch not found. Please install pytorch first.
i use venv, torch is installed,error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [26 lines of output]
Traceback (most recent call last):
File "<string>", line 52, in <module>
ModuleNotFoundError: No module named 'torch'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/featurize/work/myenv/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
main()
File "/home/featurize/work/myenv/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/featurize/work/myenv/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
return hook(config_settings)
^^^^^^^^^^^^^^^^^^^^^
File "/tmp/pip-build-env-xpxm1xdf/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 331, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=[])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/pip-build-env-xpxm1xdf/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 301, in _get_build_requires
self.run_setup()
File "/tmp/pip-build-env-xpxm1xdf/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 512, in run_setup
super().run_setup(setup_script=setup_script)
File "/tmp/pip-build-env-xpxm1xdf/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 317, in run_setup
exec(code, locals())
File "<string>", line 54, in <module>
ImportError: Pytorch not found. Please install pytorch first.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
i don't use venv,no this problem
I ran to the same problem, chatGPT answer:
Yeah, so torch is clearly installed in the same venv, but MinkowskiEngine fails because pip is building it in isolation by default.
When pip builds with PEP 517 isolation, it creates a temporary clean environment that only contains the declared build dependencies (from pyproject.toml) — PyTorch isn’t declared there, so the temporary environment doesn’t see it, and the build crashes at:
ImportError: Pytorch not found. Please install pytorch first.
Fix: build without isolation so it sees your installed torch
export MAX_JOBS=4 export BLAS=openblas pip install MinkowskiEngine==0.5.4 --no-deps -v --no-build-isolation
That tells pip to run the build using your current environment (with torch already installed).
Did you solve it ?
没有呀
@vdfngt 我人麻了,我需要跑这个,那我怎么弄,我G了
不使用venv
我用的conda,报同样的错误
你在跑什么模型吗
是的,一个通过点云预测物体最接抓取位姿的模型
Hi, I gave up on installing it as a python package through pip or conda, it is just impossible. If you want minkowski on modern Ubuntu and cuda 12, then make a fresh venv for it and follow these steps (they are my notes for my colleague how to build it from source):
pip install torch==2.4.0 torchvision==0.19.0 torchaudio==2.4.0 --index-url https://download.pytorch.org/whl/cu121
pip install --no-cache-dir --extra-index-url=https://pypi.nvidia.com cuml-cu12
git clone https://github.com/CiSong10/MinkowskiEngine.git
cd MinkowskiEngine/
git checkout cuda12-installation
python setup.py install --blas=openblas
I needed it for the Digiforests dataset, so I had a few more steps after that:
git clone https://github.com/PRBonn/digiforests.git
pip install open3d
{fix the package dep to open3d}: "open3d>=0.18",
pip install -e .
But I think Minkowski did not depend on these final steps.