Closed Asif6511 closed 5 years ago
Hi,
This problem is caused when you compiled maskrcnn_benchmark using the different version of PyTorch.
Just rm -rf build
and compile the code again. This should fix your problem.
Once it is done. You can run the following script to test the compiled module is loaded successfully or not.
python
import torch
import maskrcnn_benchmark._C
Thanks @chengyangfu for the reply. The solution to this problem is exactly the one that was given by @chengyangfu . I'm closing this issue but let us know if you still face problems
@chengyangfu @fmassa Thanks for the quick reply. I compiled this using Pytorch 1.0.1 version. Should I not compile using that version?
An update! Followed your instructions and it works fine! Thank You!
can u tell me which version of PyTorch I should use to compile?
@LLH1818 I used Pytorch 1.0.1 and it compiled fine!
ImportError Traceback (most recent call last)
@13012476909 Have you fixed it?Meet the same error.
@chengyangfu I don't understand how simple rm -f can solve the problem. When I downloaded the folder, I followed Install.md instructions and compiled: python setup.py build develop. I don't understand how deleting build and doing the same thing again will solve the problem. However, I did it and still face the same problem as @Asif6511. I don't understand what I am supposed to do. Can someone help me please ?
The problem was caused by compiling and running the code in different versions of PyTorch.
Check the PyTorch in your system first and make sure you are using the "same" PyTorch for compiling and running the code. So the command rm -f
is only for deleting the old compiled binary.
@chengyangfu Thank you very much for answering. I am using Pytorch 1.0.1. I know that in install.md it says that this version should not work, however, many people like @Asif6511 have done the same and found out that it works. I unfortunately can't find the problem...
Hi @M-Alami , I also use PyTorch 1.0 or PyTorch.1.0.1. Both versions work for me. But I install PyTorch by compiling the source code instead of using the precompiled binary. In order to run the code, I would suggest you just updated the PyTorch to the suggested version. That would be an easier way. Besides, are you using the conda or Virtualenv to create a virtual python environment? If not, please try conda or Virtualenv, it would save a lot of problems.
Thanks @chengyangfu for all your answers. I finally managed to make it work. I used pytorch 1.2.0.dev20190620 and cuda '10.0.130'.
I rebuilt the apex and the maskrcnn-benchmark,and it worked.I am using pytorch1.2.0 ,cuda10.0.
Hi! Facing this import error on running the mask_r-cnn_demo! I followed the instruction on Install.md as well.
ImportError Traceback (most recent call last)