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

ImportError: cannot import name 'is_fx_tracing' from 'torch.fx._symbolic_trace' #4487

Open
Hamad-SS opened this issue Aug 18, 2022 · 17 comments

Comments

@Hamad-SS
Copy link

Hamad-SS commented Aug 18, 2022

Error while running the Official Detectron2 Demo:
yesterday I ran it and it was working fine. Today, it is giving me error. Run code cell # 3 from the top. Where importing libraries. It gives error after the comment
# import some common detectron2 utilities
Link to the Cell:
https://colab.research.google.com/drive/16jcaJoc6bCFAQ96jDe2HwtXj7BMD_-m5#scrollTo=ZyAvNCJMmvFF
It gives error on running the following line
from detectron2 import model_zoo
but if you comment above line, it gives same error on next line i.e.,
from detectron2.engine import DefaultPredictor

Error is
ImportError: cannot import name 'is_fx_tracing' from 'torch.fx._symbolic_trace' (/usr/local/lib/python3.7/dist-packages/torch/fx/_symbolic_trace.py)

it is easily reproduceable as it is given by default notebook. Opened a fresh one from the link given on following page
https://github.com/facebookresearch/detectron2
Still the same error.
Someone maybe pushed something in last 24 hours that made it give this error.

@Hamad-SS Hamad-SS changed the title Please read & provide the following ImportError: cannot import name 'is_fx_tracing' from 'torch.fx._symbolic_trace' Aug 18, 2022
@jongwook-Han
Copy link

I'm having the same issue :(

@Deam0on
Copy link

Deam0on commented Aug 18, 2022

Same issue. Any solution?

@truong-xuan-linh
Copy link

Same issue :((

@pietro-nardelli
Copy link

Same issue, yesterday it worked with no errors.

@frozen-mind
Copy link

same error on colab...
hope someone can solve this problem ASAP...

@truong-xuan-linh
Copy link

truong-xuan-linh commented Aug 18, 2022

!!!
You can temporary fix this issue on colab by:

  1. Open poolers.py source code
    image

  2. Comment line 10, 223->237
    image
    image

  3. Restart runtime
    image

  4. Then run code ( but not run "!python -m pip install 'git+https://github.com/facebookresearch/detectron2.git'
    " again ).

Its work for me, but i think it just temporary solution.

@Deam0on
Copy link

Deam0on commented Aug 18, 2022

Thank you

@leoliu37
Copy link

This is the problem of detecron2 version, I solve it by installing suitable version in https://github.com/facebookresearch/detectron2/releases

@juanluisrosaramos
Copy link

Same problem here, I tried very different combinations of torch, none of them works

@frozen-mind
Copy link

@leoliu37 could you please tell me which version did you installed exactly?

@Hamad-SS
Copy link
Author

@truong-xuan-linh hmm... dirty solution.
But I'll take it! It works!

@mahachaaben99
Copy link

heey guys unfortunately im not having exactly the same error as you
image

@mahachaaben99
Copy link

anyone can help with it ? i tried commenting the code lines in poolers.py but the issue was not fixed

@juanluisrosaramos
Copy link

@maziqueen79 I had the same error problem with this installation

!pip uninstall torch -y
!pip uninstall torchvision -y
!pip install torch==1.10.1+cu111 torchvision==0.11.2+cu111 -f https://download.pytorch.org/whl/torch_stable.html
!python -m pip install 'git+https://github.com/facebookresearch/detectron2.git'

And commenting the lines of poolers.py works for me and I'm training a maskrcnn model without problems
Thanks

@BastianBopp
Copy link

It seems like this issue was introduced with the latest commit (36a65a0).

Specifying the previous commit hash from august 4th to install detectron2 fixed this issue for me.
pip install git+https://github.com/facebookresearch/detectron2.git@5aeb252b194b93dc2879b4ac34bc51a31b5aee13

@mahachaaben99
Copy link

Thank you all !

@patrickvonplaten
Copy link

This is also affected other libraries such as Transformers - see: huggingface/transformers@1f3c228

Could we fix this on master?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests