Skip to content
This repository has been archived by the owner on Nov 21, 2023. It is now read-only.

ImportError: No module named core.config #475

Closed
saivineethkumar opened this issue Jun 6, 2018 · 11 comments
Closed

ImportError: No module named core.config #475

saivineethkumar opened this issue Jun 6, 2018 · 11 comments

Comments

@saivineethkumar
Copy link

Hello

when I run the inference command

"sudo python tools/infer_simple.py --cfg configs/12_2017_baselines/e2e_mask_rcnn_R-101-FPN_2x.yaml --output-dir demo/output --image-ext jpg --wts \https://s3-us-west-2.amazonaws.com/detectron/35861858/12_2017_baselines/e2e_mask_rcnn_R-101-FPN_2x.yaml.02_32_51.SgT4y1cO/output/train/coco_2014_train:coco_2014_valminusminival/generalized_rcnn/model_final.pkl \demo"

I am getting the following error:

Traceback (most recent call last):
File "tools/infer_simple.py", line 40, in
from detectron.core.config import assert_and_infer_cfg
ImportError: No module named core.config

I can see the file config.py in the subfolder core which is in detectron dir, still I am getting the error.
And there are init.py files in both detectron dir and core dir
I am unable to understand where the problem is, can anyone help me with this
thankyou

@ir413
Copy link
Contributor

ir413 commented Jun 6, 2018

Hi @saivineethkumar, have you followed the installation instructions and run make to set up the python modules? Also, please use python2 when running the infer_simple tool (in case your python is not symlinked to python2).

@saivineethkumar
Copy link
Author

saivineethkumar commented Jun 6, 2018

thanks for the reply @ir413
I could not find lib dir in the Detectron dir, do you have any idea about that?

@gadcam
Copy link
Contributor

gadcam commented Jun 6, 2018

@saivineethkumar Did you set the PYTHONPATH environment variable so the Python interpreter could find the detectron directory ?

@saivineethkumar
Copy link
Author

saivineethkumar commented Jun 7, 2018

Hi @gadcam
yeah, I added the detectron dir path to PYTHONPATH and still the error shows up.
but when i tried to run the command import detectron.core.config in python shell, it works but when i run the infer_simple.py this error shows up.
Is there anything else that I can try to fix this?

@gadcam
Copy link
Contributor

gadcam commented Jun 7, 2018

@saivineethkumar
Do you set it to $DETECTRON_DIR/detectron or only to $DETECTRON_DIR ? Only the first one should work.

@ir413
Copy link
Contributor

ir413 commented Jun 7, 2018

Thanks for the suggestion @gadcam . Setting the PYTHONPATH should not be required for setting up Detectron python modules. Following the installation instructions and running make should be sufficient.

@saivineethkumar: Could you please describe the exact steps you have taken? (i.e. provide the information requested in the issue template).

I could not find lib dir in the Detectron dir, do you have any idea about that?

Could you please clarify what do you mean by this?

@gadcam
Copy link
Contributor

gadcam commented Jun 7, 2018

@ir413 When you have to build it without root privileges setting the PYTHONPATH var could be mandatory, as far as I experimented at least.
But I digress and you are right : we need more information

@ir413
Copy link
Contributor

ir413 commented Jun 7, 2018

@gadcam Permissions can be an issue when trying to install Detectron python modules into global site-packages (which can be done by running make install). This is one of the the reasons we made make default to the development mode (see make dev) which should not have these issues.

@saivineethkumar
Copy link
Author

thanks @ir413 @gadcam
I added this line to my python script before importing the modules and now it is working fine
sys.path.insert(0,'path to DETECTRON_DIR')
but I dont understand why when I add the same thing to PYTHONPATH , it was showing error but now it works fine, do you guys know why is that so?

@ir413
Copy link
Contributor

ir413 commented Jun 11, 2018

sys.path.insert is not a good way to address this issue. As mentioned above, we recommend following the installation instructions instead. Closing this now since no further information has been provided.

@gittigxuy
Copy link

@saivineethkumar ,you should make clean detectron build folder,and re-make this.it could be fine for me

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

No branches or pull requests

4 participants