Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: No module named 'edgetpu' #42

Closed
zubairahmed-ai opened this issue Aug 20, 2019 · 19 comments
Closed

ImportError: No module named 'edgetpu' #42

zubairahmed-ai opened this issue Aug 20, 2019 · 19 comments
Labels
Getting Started Related to following Google's tutorials good first issue Good for newcomers

Comments

@zubairahmed-ai
Copy link

What I ran

python3 demo/classify_image.py --model ~/edgetpu_models/mobilenet_v2_1.0_224_quant_edgetpu.tflite --label ~/edgetpu_models/imagenet_labels.txt --image test_data/parrot.jpg

What the docs said should happen

I should see the results of the parrot classification
macaw
Score : 0.99609375

What actually happened

File "demo/classify_image.py", line 3, in
from edgetpu.classification.engine import ClassificationEngine
ImportError: No module named 'edgetpu'

@zubairahmed-ai
Copy link
Author

This is due to the init.py not doing its job

As a workaround I had to remove edgetpu from all the import statements

import edgetpu.classification.engine

becomes

import classification.engine

and so on, anyone knows how to fix this?

@JeanCarm
Copy link

Hi. Did you figure out the problem? I'm having the exat problem. Can you help me please?

@PjotrG
Copy link

PjotrG commented Nov 2, 2019

Getting exact the same comment, any idea????

@JeanCarm
Copy link

JeanCarm commented Nov 2, 2019

Hey man, I reinstalled the edgetpu library and it worked for me. https://coral.withgoogle.com/docs/edgetpu/api-intro/
Let me know if it works and also what type of project are you working on?
@PjotrG

@PjotrG
Copy link

PjotrG commented Nov 2, 2019 via email

@PjotrG
Copy link

PjotrG commented Nov 3, 2019 via email

@zubairahmed-ai
Copy link
Author

@PjotrG

Did you try my workaround?

@PjotrG
Copy link

PjotrG commented Nov 4, 2019

@zubairahmed-ai
Traceback (most recent call last):
File "/home/pi/Myprojects/Edgetpu/edgetpu-master/examples/classify_capture.py", line 20, in
from classification.engine import ClassificationEngine
ImportError: No module named classification.engine
yes..like this? failed as well ???????

@PjotrG
Copy link

PjotrG commented Nov 5, 2019

@zubairahmed-ai
started everything new with image backup, looks much better but new error showed up, something to do with "loading requirements"???
File "classify_image.py", line 18, in
from edgetpu.utils import dataset_utils
ImportError: cannot import name 'dataset_utils'

@zubairahmed-ai
Copy link
Author

Yes like that, you have to go in each sub-file that the main script is calling and change it there. Tedious but once done it worked for me.

@PjotrG
Copy link

PjotrG commented Nov 16, 2019

@zubairahmed-ai @JeanCarm
Got it all (examples object detection/image classification, teachable machine) working again after installing everything new, looking forward now for learning more and own projects, thank you both for encouragement and help! which projects are you working on? Peter

@zubairahmed-ai
Copy link
Author

@PjotrG I am not working on anything right now, what about you?
I'm looking forward to using it after reading some use cases from Adrian's upcoming book

@PjotrG
Copy link

PjotrG commented Nov 25, 2019

@zubairahmed-ai I just installed the detect.py (https://github.com/google-coral/examples-camera/tree/master/gstreameron) with minor modifications on my robot arm (OWI 535): the gripper holds the camera and the arm follows a defined object detected (somehow similar to https://github.com/google-coral/project-banana-robo/blob/master/detect_standalone.py) it went "surprinsingly" well.
I now want to extend it to a self driving car model but ran into another installation problem google-coral/examples-camera#19....
Theoretically-wise I got insights from http://neuralnetworksanddeeplearning.com/index.html ... easy to read but not so easy content. I rebuilt the code on Windows.

@jonasl
Copy link

jonasl commented Nov 27, 2019

The python module edgetpu is in the python3-edgetpu package.
sudo apt-get install python3-edgetpu

@PizzaMargherita21
Copy link

Hi guys! I had the same issue and solved it by Installing the Edge TPU library as follows

sudo apt-get update
sudo apt-get install python3-edgetpu

Link: https://coral.ai/docs/edgetpu/api-intro

@cgillions
Copy link

I'm able to import edgetpu outside of a virtual environment, but inside, I get this error.
I create the virtual environment using python3 -m venv env after running apt-get install python3-edgetpu but to no avail. Any suggestions?

@aeropia
Copy link

aeropia commented Feb 11, 2020

I'm having the same issue in RPi 4B (no virtual env).
Unistall and reinstall does not remove the problem.
Any solution yet?

  • Update the workaround I have found:
    I have added following statement in my .profile and now the edgetpu modules can be imported.

export PYTHONPATH=$PYTHONPATH:/usr/lib/python3/dist-packages:/usr/local/python3.7/dist-packages

@jingw222
Copy link

Hey,
Installing the Debian package python3-edgetpu works fine but only under global system environment. However how can I import and use edgetpu in my virtual environment? Is there a pypi release available for the package?

@Namburger
Copy link

Hi guys I'll one up @aeropia. To me this is very standard python issues especially if you have multiple python version install + some odd virtual environment. Check out my answer here robmarkcole/coral-pi-rest-server#56 (comment)

@Namburger Namburger added DevBoard Related to the dev board Getting Started Related to following Google's tutorials good first issue Good for newcomers and removed DevBoard Related to the dev board labels May 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Getting Started Related to following Google's tutorials good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

9 participants