-
-
Notifications
You must be signed in to change notification settings - Fork 16.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: NotImplementedError: cannot instantiate 'PosixPath' on your system on Windows platform #12785
base: master
Are you sure you want to change the base?
Fix: NotImplementedError: cannot instantiate 'PosixPath' on your system on Windows platform #12785
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👋 Hello @abdulhakkeempa, thank you for submitting a YOLOv5 🚀 PR! To allow your work to be integrated as seamlessly as possible, we advise you to:
- ✅ Verify your PR is up-to-date with
ultralytics/yolov5
master
branch. If your PR is behind you can update your code by clicking the 'Update branch' button or by runninggit pull
andgit merge master
locally. - ✅ Verify all YOLOv5 Continuous Integration (CI) checks are passing.
- ✅ Reduce changes to the absolute minimum required for your bug fix or feature addition. "It is not daily increase but daily decrease, hack away the unessential. The closer to the source, the less wastage there is." — Bruce Lee
@abdulhakkeempa thank you for your contribution and for highlighting the issue with Windows compatibility in the YOLOv5 detection script. Your effort to improve the project is greatly appreciated! 🌟 However, before we can proceed with integrating your changes, we need to review them thoroughly to ensure they align with the project's standards and do not introduce any unintended side effects. Compatibility fixes are crucial, and your approach seems promising. We'll look into the best way to incorporate this fix in a manner that maintains compatibility across all platforms. In the meantime, could you please ensure that your changes are documented clearly, including any tests you've conducted to verify the fix? This will greatly aid in the review process. Thanks again for your contribution and for supporting the YOLOv5 community! Your efforts help make YOLOv5 better for everyone. 🚀 |
Hey @glenn-jocher, I have successfully run |
Hello @abdulhakkeempa, it's great to hear that you've successfully run For testing compatibility, especially with changes that involve platform-specific behavior like file path handling, here are a few suggestions:
Documenting these tests and their outcomes will not only support the review process but also provide valuable information for future contributors who might encounter similar issues. Thank you for your dedication to improving YOLOv5. Your efforts are truly appreciated by the community! 🌟 |
@abdulhakkeempa we have Windows CI here that runs correctly on master branch, so we are unable to reproduce any Windows issues: |
@glenn-jocher AFAIK this issue with By Unix platform, I mean Linux, Mac, Google Colab, etc. |
Hello @sohang3112, Thanks for the clarification! 😊 Our current Windows CI does not specifically test for cross-platform model training and inference scenarios like Unix-to-Windows or vice versa. It is a great point and something we'll consider improving in our testing suite to ensure compatibility across all platforms. In the meantime, your workaround with import sys, pathlib
if sys.platform == "win32":
pathlib.PosixPath = pathlib.WindowsPath Keep those insights and contributions coming, they help make YOLOv5 better for everyone! 🚀 |
I have read the CLA Document and I sign the CLA 2 out of 3 committers have signed the CLA. |
@abdulhakkeempa Please sign the CLA (Contributor License Agreement) |
When the inference code was run on the Windows platform, it raised an error: NotImplementedError: cannot instantiate 'PosixPath' on your system. This issue has been fixed by adding three lines of code to detect.py. After testing, it was found to work fine. Closes #10240.
Changes made
I have read the CLA Document and I hereby sign the CLA
🛠️ PR Summary
Made with ❤️ by Ultralytics Actions
🌟 Summary
Improved Windows compatibility in YOLOv5's detect.py script 🔍💻
📊 Key Changes
pathlib
module.🎯 Purpose & Impact