Darkflow: No module named cy_yolo_findboxes

Created on 23 May 2017  路  23Comments  路  Source: thtrieu/darkflow

when I run test , like ./flow --model jason/yolo2_voc2007_2017.cfg --load jason/yolo-voc.weights --test sample_img/
shows:
Traceback (most recent call last): File "./flow", line 4, in <module> from darkflow.cli import cliHandler File "/home/jason/code/darkflow/darkflow/cli.py", line 3, in <module> from darkflow.net.build import TFNet File "/home/jason/code/darkflow/darkflow/net/build.py", line 7, in <module> from .framework import create_framework File "/home/jason/code/darkflow/darkflow/net/framework.py", line 1, in <module> from . import yolo File "/home/jason/code/darkflow/darkflow/net/yolo/__init__.py", line 2, in <module> from . import predict File "/home/jason/code/darkflow/darkflow/net/yolo/predict.py", line 6, in <module> from darkflow.cython_utils.cy_yolo_findboxes import yolo_box_constructor ImportError: No module named cy_yolo_findboxes

there has cy_yolo_findboxes.pyx file in cython_utils directory.
how to sovle? thanks

Most helpful comment

If you install using pip install . I don't think the Cython extensions will be built in the same folder - they will be build somewhere else. Try running pip uninstall darkflow then run python3 setup.py build_ext --inplace and try the ./flow command again.

All 23 comments

Have you built the Cython extensions using one of the three methods outlined here?

I only use 'pip install .'

do I need to executed 'python3 setup.py build_ext --inplace' ?

Can you try using flow instead of ./flow

the same problem .

and my cython_utils directory like this
---->cython_utils
---->cy_yolo2_findboxes.pyx
---->__init__.py
---->nms.pxd
---->cy_yolo_findboxes.pyx
---->__init__.pyc
---->nms.pyx
is OK?

If you install using pip install . I don't think the Cython extensions will be built in the same folder - they will be build somewhere else. Try running pip uninstall darkflow then run python3 setup.py build_ext --inplace and try the ./flow command again.

ok
I find that if using pip install ., Cython extensions will be built in the /usr/local/lib/python2.7/dist-packages/darkflow.

@myBestLove I'm having the same issue, using Python 3.5. I tried @abagshaw suggestion but didn't work for me. Can you share how did you solve it? This is a screenshot of my error:
screen shot 2017-06-02 at 7 28 21 pm

@ilopezfr Can you try using flow instead of ./flow and see if that changes anything?

@abagshaw I did my installation using python3 setup.py build_ext --inplace so it doesn't recognize the command flow.
Did you install it globally with pip install . ? Would that chance anything?
Thanks!

@ilopezfr It may be that just building the Cython extensions in place doesn't work with the import paths (I'll look into that). For now can you try doing pip install .

@abagshaw Thanks! It actually fixed it when installing it globally.

For what it's worth, I am using python 2.7 and was having the same issue. I initially used sudo pip install . to install and had the cy_yolo_findboxes error when using the provided python script to import the darkflow module(s). I uninstalled darkflow using "sudo pip uninstall darkflow", then reinstalled using:

python setup.py build_ext --inplace    
(note: not python3 as described  above).

I now can run the command line demo using:
./flow --model cfg/yolo.cfg --load bin/yolo.weights --demo camera --gpu 1.0

and I can use the python interface as well in python2.7:
from darkflow.net.build import TFNet
import cv2

I'm running ubuntu 16.04, python2.7, CUDA installed. Separate issue, but for whatever reason, the command line demo runs at <1fps.

EDIT: I hadn't activated my virtual environment with GPU-enabled TensorFlow. The demo now runs at 7fps.

Hey,

I had the same issue with the imports from cython code not using fully qualified names. The solution is simply not using "darkflow" as the name for the root folder in the project.

I am trying to run codes that I wrote on PyCharm, and I ran into same issue.
Any help will be appreciated
screen shot 2018-01-26 at 1 55 29 am

@ilopezfr same errors.... i am also faced using in ubuntu can you help me to overcome this problem with your experience...

cd darkflow/
python setup.py build_ext --inplace
pip install -e .

Works for me (ubuntu16.04, python3.5)

./flow didn't work for me, but python flow ... worked!

after doing all the steps listed,

  • in your conda environment [Either base (if you did not set a virtual environment), OR the virtual environment that you dedicated darkyolo for]
  • go the directory where dark-flow master is located
  • Run 'python3 setup.py build_ext --inplace' again
    OR
    'python setup.py build_ext --inplace' (Depending on your set up)

I was using python 3.5.6 in my anaconda virtual environment and after i built it again, it worked.
After it works
run 'python flow -h' to check after installation.

i got the same problem but instead ImportError: No module named cy_yolo_findboxes
i got ImportError: No module named cv2
what should i install?
i already do pip install opencv and from here too https://www.lfd.uci.edu/~gohlke/pythonlibs/

Hi GipsyKami. Are you using Conda or the regular python3 for this?

I am assuming you used conda.
There were some issues for me when I installed the packages to link to each other. Somehow for my system, conda installed packages and pip installed packages did not work together. My recommendation when working on yolo for python, is to install all packages on pip.
So, either remove all the conda packages on the conda environment, or just build a new conda environment and pip install the required packages.

As for opencv, it is slightly more complicated than pip install opencv
I followed this installation guide. You can look at it
OpenCV Installation

screenshot 170

the same problem .

and my cython_utils directory like this
---->cython_utils
---->cy_yolo2_findboxes.pyx
---->init.py
---->nms.pxd
---->cy_yolo_findboxes.pyx
---->init.pyc
---->nms.pyx
is OK?

@akashsahu410 Have you tried this?

./flow didn't work for me, but python flow ... worked!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ShawnDing1994 picture ShawnDing1994  路  4Comments

LeeroyHannigan picture LeeroyHannigan  路  4Comments

humanova picture humanova  路  4Comments

1NNcoder picture 1NNcoder  路  3Comments

wonny2001 picture wonny2001  路  4Comments