Megvii-BaseDetection / Megvii-BaseDetection/YOLOX
Pip install doesn't recognize torch
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 10.6k
- Forks
- 2.5k
- PR merge metrics
- No merged PRs in 30d
Description
In my current setup, when installing yolox, the installation process exits with an error:
pip install -v -e .
AssertionError: torch is required for pre-compiling ops, please install it first.
However, torch is installed in my environment, as returned by pip list:
torch 2.0.1+cu117
torchvision 0.15.2+cu117
I am working with the most recent version:
https://github.com/Megvii-BaseDetection/YOLOX/commit/d872c71bf63e1906ef7b7bb5a9d7a529c7a59e6a
My python version is:
python --version
Python 3.10.15
The full error message is:
Using pip 24.2 from /home/appuser/.local/venv/lib/python3.10/site-packages/pip (python 3.10)
Obtaining file:///develop/YOLOX
Running command pip subprocess to install build dependencies
Using pip 24.2 from /home/appuser/.local/venv/lib/python3.10/site-packages/pip (python 3.10)
Collecting setuptools>=40.8.0
Obtaining dependency information for setuptools>=40.8.0 from https://files.pythonhosted.org/packages/55/21/47d163f615df1d30c094f6c8bbb353619274edccf0327b185cc2493c2c33/setuptools-75.6.0-py3-none-any.whl.metadata
Using cached setuptools-75.6.0-py3-none-any.whl.metadata (6.7 kB)
Using cached setuptools-75.6.0-py3-none-any.whl (1.2 MB)
Installing collected packages: setuptools
Successfully installed setuptools-75.6.0
Installing build dependencies ... done
Running command Checking if build backend supports build_editable
Checking if build backend supports build_editable ... done
Running command Getting requirements to build editable
[WARNING] Unable to import torch, pre-compiling ops will be disabled.
Traceback (most recent call last):
File "/home/appuser/.local/venv/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
main()
File "/home/appuser/.local/venv/lib/python3.10/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/appuser/.local/venv/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 132, in get_requires_for_build_editable
return hook(config_settings)
File "/tmp/pip-build-env-_ks8t9e7/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 483, in get_requires_for_build_editable
return self.get_requires_for_build_wheel(config_settings)
File "/tmp/pip-build-env-_ks8t9e7/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 334, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=[])
File "/tmp/pip-build-env-_ks8t9e7/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 304, in _get_build_requires
self.run_setup()
File "/tmp/pip-build-env-_ks8t9e7/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 522, in run_setup
super().run_setup(setup_script=setup_script)
File "/tmp/pip-build-env-_ks8t9e7/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 320, in run_setup
exec(code, locals())
File "<string>", line 77, in <module>
File "<string>", line 50, in get_ext_modules
AssertionError: torch is required for pre-compiling ops, please install it first.
error: subprocess-exited-with-error
× Getting requirements to build editable did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
full command: /home/appuser/.local/venv/bin/python3 /home/appuser/.local/venv/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py get_requires_for_build_editable /tmp/tmpn2i8m2cc
cwd: /develop/YOLOX
Getting requirements to build editable ... error
[notice] A new release of pip is available: 24.2 -> 24.3.1
[notice] To update, run: pip install --upgrade pip
error: subprocess-exited-with-error
× Getting requirements to build editable did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing pip install -v -e . with Python 3.10.15, torch 2.0.1+cu117, and torchvision 0.15.2+cu117, then inspect the editable-install build configuration and its isolated environment. Done means the YOLOX editable installation completes without incorrectly reporting that torch is unavailable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, pytorch
- Domain
- build-system, machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100