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

ImportError: cannot import name task_evaluation #20

Closed
zhangjinsong3 opened this issue Jan 24, 2018 · 19 comments
Closed

ImportError: cannot import name task_evaluation #20

zhangjinsong3 opened this issue Jan 24, 2018 · 19 comments

Comments

@zhangjinsong3
Copy link

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.

@jungalwala
Copy link

I have the same issue.

@ir413
Copy link
Contributor

ir413 commented Jan 26, 2018

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: ?

@XYAskWhy
Copy link

XYAskWhy commented Jan 27, 2018

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.

@Labyrins
Copy link

Labyrins commented Jan 28, 2018

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.

@XYAskWhy
Copy link

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

@Labyrins
Copy link

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

@zhangjinsong3
Copy link
Author

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.

@withyou1771
Copy link

I have the same issue.

@assafmus
Copy link

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.

@ir413
Copy link
Contributor

ir413 commented Jan 29, 2018

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__)"

@jungalwala
Copy link

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

@zhangjinsong3
Copy link
Author

zhangjinsong3 commented Jan 30, 2018

@ir413 the output of running:

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

@zhangjinsong3
Copy link
Author

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

@Labyrins
Copy link

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

@XYAskWhy
Copy link

XYAskWhy commented Jan 30, 2018

@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
Copy link
Contributor

There is a "datasets" submodule in slim: https://github.com/tensorflow/models/tree/master/research/slim/datasets.

@XYAskWhy
Copy link

@ppwwyyxx exactly

@ir413
Copy link
Contributor

ir413 commented Jan 30, 2018

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.

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

No branches or pull requests

10 participants