Megvii-BaseDetection / Megvii-BaseDetection/YOLOX
ImportError:attempted relative import with no known parent package
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 10.6k
- Forks
- 2.5k
- PR merge metrics
- No merged PRs in 30d
Description
Traceback (most recent call last):
File "/home/white/PycharmProjects/YOLOX-main/yolox/models/yolox.py", line 7, in
from .yolo_head import YOLOXHead
ImportError: attempted relative import with no known parent package
I think it's due to .yolo_head,so I changed it to from yolox.models.yolo_head import YOLOXHead,but when I do that, I got a NEW bug
ModuleNotFoundError: No module named 'yolox.models'; 'yolox' is not a package
why???by the way,I use Pycharm
我一开始以为是因为用了相对引用.yolo_head,虽然不知道为什么.yolo_head不行,我尝试把他改成项目路径以后,还是报错了,所以这两个错误到底是为什么呢?我用的IDE是pycharm,难道和这个有关系吗
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 with yolox/models/yolox.py and inspect how PyCharm launches it, comparing package execution with running the file directly. Reproduce the reported relative-import error and the alternative module-not-found error, then confirm the supported launch configuration and that the import works without the second failure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100