Detectron: ImportError: cannot import name task_evaluation

Created on 24 Jan 2018  ·  18Comments  ·  Source: facebookresearch/Detectron

Traceback (most recent call last):
File "tools/infer_simple.py", line 42, in
import core.test_engine as infer_engine
File "/home/user523/zjs/detectron/lib/core/test_engine.py", line 36, in
from datasets import task_evaluation
ImportError: cannot import name task_evaluation

I have added detectron/lib to pythonpath,but it still can not work.

cannot repro

Most helpful comment

I had the same issue. I've solved the problem by removing tensorflow from the python path.
I assume this might also be the case for some of you who are having this problem.

All 18 comments

I have the same issue.

Hi @zhangjinsong3 and @jungalwala, we're unable to reproduce this issue on our side.

Could you please both provide us with more information, which might help us identify the issue?

In particular:

  • Operating system: ?
  • Python version: ?
  • Python environment: ? (if applicable)
  • setuptools version: ?
  • Cython version: ?
  • Anything else that seems relevant: ?

Hi @ir413 , I have the same issue as well. Ubuntu16.04, Python2.7.12, setuptools 38.4.0, Cython 0.27.3. It seems really odd, because Pycharm doesn't give any warning or raise any error.

I am in the same trouble.
The problem is that...
even though I have set detectron/lib in PATHONPATH and check it fine by echo $PYTHONPATH,
py files in detectron/lib do not be imported.

@Labyrins , maybe you just forgot to do “cd $DETECTRON/lib && make” in the INSTALL.md.

@XYAskWhy Nope. I already did that and does not work.. thanks for your comment.

Hi @ir413 ,my computer is Ubuntu 16.04 ,python 2.7 , setuptools 38.4.0, Cython 0.23.4, opencv-python 3.4.0.12..thanks for your comment.

I have the same issue.

I had the same issue. I've solved the problem by removing tensorflow from the python path.
I assume this might also be the case for some of you who are having this problem.

Hi @XYAskWhy and @zhangjinsong3, thank you for the details. We are not able to reproduce this issue using the system/package versions you posted above.

Could you please provide information about the exact installation steps you took (w/ commands) and the command you are running when seeing this error? Please also include the complete output of running make under $DETECTRON/lib.

Additionally, please include the output of the following two commands:

python2 -c "from distutils import sysconfig; print(sysconfig.get_python_lib())"
python2 -c "from distutils import sysconfig; print(sysconfig.get_python_inc())"

Edit:
Thanks @assafmus for the suggestion. Please also include the output of running:

python2 -c "import datasets; print(datasets.__file__)"

@assafmus That was the cause of my issue, too!

@ir413 the output of running:

2018-01-30 08-51-56
assafmus`s method works.

@assafmus It works for me too,although I don't know why.Thanks very much!

@assafmus Thank you so much for your tip! Now, it works!

@assafmus It works well for me, many thanks. For the record, @ir413 , I removed models/research and models/research/slim from the python path, which are required by TensorFlow's Object Detection API. Does this mean Google and Facebook even compete in the PYTHONPATH? Just kidding, hope this issue could be solved soon.
Edit:
--Thanks to @ppwwyyxx below, the reason is datasets module has a namesake in slim.

@ppwwyyxx exactly

Thanks all. datasets is likely a common module name, which could lead to import conflicts as in the case of tensorflow some of you encountered. We will add a note about this to the troubleshooting section and look into addressing this further.

Was this page helpful?
0 / 5 - 0 ratings