yolov5 icon indicating copy to clipboard operation
yolov5 copied to clipboard

How to set up the code environment of yolov5 with a 5070ti graphics card (cuda12.8) ?

Open VansamaOffical opened this issue 8 months ago β€’ 2 comments

Search before asking

  • [x] I have searched the YOLOv5 issues and discussions and found no similar questions.

Question

5070ti has to use cuda12.8 and pytorch from this link: pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu128 After installing and setting, pytorch is available( torch.cuda.is_available()==true ). However, there is a problem when I run detect.py: from utils.downloads import attempt_download ModuleNotFoundError: No module named 'utils' But "utils" has been provided already. What goes wrong? Maybe requirements.txt needs changing with new cuda environment? Please give me instructions.

Additional

No response

VansamaOffical avatar Apr 20 '25 15:04 VansamaOffical

πŸ‘‹ Hello @VansamaOffical, thank you for reaching out and for your interest in YOLOv5 πŸš€! This is an automated response to help get you started. An Ultralytics engineer will review your issue and assist you further soon.

For setup instructions and troubleshooting, please visit our ⭐️ Tutorials, including Custom Data Training and Model Training Tips.

If this is a πŸ› Bug Report, please provide a minimum reproducible example (MRE) that demonstrates the issue. This helps us debug more efficiently.

If you’re setting up with a custom CUDA/PyTorch environment, ensure you have installed all dependencies from requirements.txt. To get started:

git clone https://github.com/ultralytics/yolov5  # clone
cd yolov5
pip install -r requirements.txt  # install

Additionally, please double-check that you are running scripts from the project root directory so relative imports (like from utils.downloads import attempt_download) work as expected.

Verified Environments

YOLOv5 can be run in any of the following verified environments (all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):

Status

YOLOv5 CI

If this badge is green, all YOLOv5 GitHub Actions Continuous Integration (CI) tests are passing. CI tests verify correct operation of training, validation, inference, export, and benchmarks on macOS, Windows, and Ubuntu.

If you continue experiencing issues, please provide:

  • The exact command you are running
  • A minimum reproducible example
  • Any relevant logs or stack traces

This will help us assist you more effectively! Thank you for your patience and for using YOLOv5 😊

UltralyticsAssistant avatar Apr 20 '25 15:04 UltralyticsAssistant

Hi @VansamaOffical,

This error typically occurs when running the script from the wrong directory. Make sure you're running detect.py from the root directory of the YOLOv5 repository. If you're using a terminal, navigate to the YOLOv5 directory first with cd path/to/yolov5 before executing.

If that doesn't solve it, try installing YOLOv5 as a package with:

git clone https://github.com/ultralytics/yolov5
cd yolov5
pip install -e .

The latest YOLOv5 should be compatible with newer CUDA versions through PyTorch, though you might need to update other dependencies. If problems persist, you might consider using CUDA 11.8 as it's more widely tested with YOLOv5.

Let me know if this resolves your issue.

pderrenger avatar Apr 20 '25 18:04 pderrenger

πŸ‘‹ Hello there! We wanted to give you a friendly reminder that this issue has not had any recent activity and may be closed soon, but don't worry - you can always reopen it if needed. If you still have any questions or concerns, please feel free to let us know how we can help.

For additional resources and information, please see the links below:

  • Docs: https://docs.ultralytics.com
  • HUB: https://hub.ultralytics.com
  • Community: https://community.ultralytics.com

Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed!

Thank you for your contributions to YOLO πŸš€ and Vision AI ⭐

github-actions[bot] avatar Oct 10 '25 00:10 github-actions[bot]