Skip to content
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

[Bug]: ModuleNotFoundError: No module named 'fvcore.common' #24

Open
Free-ToT opened this issue Jul 19, 2024 · 7 comments
Open

[Bug]: ModuleNotFoundError: No module named 'fvcore.common' #24

Free-ToT opened this issue Jul 19, 2024 · 7 comments
Labels
bug Something isn't working

Comments

@Free-ToT
Copy link

Bug

配置好环境后报错ModuleNotFoundError: No module named 'fvcore.common'
misc.py文件报错在'init_.py'中找不到引用'common':16未解析的引用'PathManager' :16未解析的引用'pygments' :113未解析的引用'Terminal256Formatter' :113未解析的引用'pygments':114未解析的引用'Python3Lexer':114未解析的引用'YamlLexer' :114

环境信息

环境按照官方引导配置在RTX4060 Windows系统上

补充信息

No response

@Free-ToT Free-ToT added the bug Something isn't working label Jul 19, 2024
@xiuqhou
Copy link
Owner

xiuqhou commented Jul 19, 2024

有原始输出的报错信息吗?可能是fvcore版本不对,用下面命令升级版本试试:

pip install -U 'git+https://github.com/facebookresearch/fvcore'

@Free-ToT
Copy link
Author

Traceback (most recent call last):
File "E:\Salience-DETR\main.py", line 16, in
from util.collate_fn import collate_fn
File "E:\Salience-DETR\util\collate_fn.py", line 5, in
from util.misc import to_device
File "E:\Salience-DETR\util\misc.py", line 16, in
from fvcore.common.file_io import PathManager
ModuleNotFoundError: No module named 'fvcore.common'

@xiuqhou
Copy link
Owner

xiuqhou commented Jul 19, 2024

升级fvcore版本后问题还存在吗?我是用的fvcore版本是0.1.5.post20221221版本,如果还不行可以试试我用的版本:

pip install fvcore==0.1.5.post20221221

@xiuqhou xiuqhou changed the title [Bug]: [Bug]: ModuleNotFoundError: No module named 'fvcore.common' Jul 19, 2024
@Free-ToT
Copy link
Author

还是不行,用你的版本也不行,我下来再找找原因吧 谢谢

@xiuqhou
Copy link
Owner

xiuqhou commented Jul 19, 2024

我单独把fvcore.common相关的部分摘出来了,你可以用下面的代码替换util.logger.py前10行的import部分,应该能解决这个问题。

import atexit
import functools
import logging
import os
import re
import sys

from accelerate.logging import get_logger
from iopath.common.file_io import HTTPURLHandler, OneDrivePathHandler
from iopath.common.file_io import PathManager as PathManagerBase
from termcolor import colored

PathManager = PathManagerBase()
PathManager.register_handler(HTTPURLHandler())
PathManager.register_handler(OneDrivePathHandler())

xiuqhou added a commit that referenced this issue Jul 20, 2024
@Free-ToT
Copy link
Author

Free-ToT commented Jul 22, 2024

按照你的方法修改后,还是原来的问题,util.misc.py中import部分报错
Traceback (most recent call last):
File "E:\Salience-DETR\main.py", line 16, in
from util.collate_fn import collate_fn
File "E:\Salience-DETR\util\collate_fn.py", line 5, in
from util.misc import to_device
File "E:\Salience-DETR\util\misc.py", line 16, in
from fvcore.common.file_io import PathManager
ModuleNotFoundError: No module named 'fvcore.common'

xiuqhou added a commit that referenced this issue Jul 22, 2024
@xiuqhou
Copy link
Owner

xiuqhou commented Jul 22, 2024

代码中有两处用到了fvcore.common,现在我都改过来了,请用最新版仓库代码试一试。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants