Weizhen Fang
Weizhen Fang

Reputation: 51

ImportError about Detectron2

I was trying to do semantic segmentation using Detectron2, but some tricky errors occurred when I ran my program. It seems there might be some problems in my environment.

Does anyone know how to fix it?

ImportError: cannot import name 'is_fx_tracing' from 'torch.fx._symbolic_trace' (/home/eric/anaconda3/envs/detectron_env/lib/python3.9/site-packages/torch/fx/_symbolic_trace.py)

Upvotes: 5

Views: 12226

Answers (2)

Mohan Ponduri
Mohan Ponduri

Reputation: 59

This seems to be an issue with the latest commit of detectron2, you can use the previous commit of detectron2 while installing to avoid this error.

pip install 'git+https://github.com/facebookresearch/detectron2.git@5aeb252b194b93dc2879b4ac34bc51a31b5aee13'

The issue is resolved in the latest commit of detectron2

Upvotes: 5

ashah
ashah

Reputation: 269

@Mohan Ponduri's solution worked for me. Thanks. Seems to be the problem with new Detectron2 installation. Also I was able to use detectron2 on conda environment, just in case any one wants to know

Upvotes: 2

Related Questions