Leave to content
This repository has come stored by the owner on Feb 9, 2023. It is now read-only.

ImportError: No built-in named 'aiy' #238

Closed
amerinoo started this issueMarch 4, 2018 · 34 comments
Closing

ImportError: No model named 'aiy' #238

amerinoo opened this issueJan 4, 2018 · 34 comments

Comments

@amerinoo
Duplicate link

amerinoo commented Jan 4, 2018

As you can show is the image there is some problem with who imports. I'm using aiyprojects branch.

no_module_aiy

@sheridat
Copy link

sheridat commented Jan 5, 2018

Hi, If iodin do what you do done I geting the same error
try

  1. cd /home/pi/AIY-projects-python
  2. source env/bin/activate
  3. src/examples/voice/assistant_library_demo.py

@amerinoo
Copy link
Author

amerinoo commented Jan 5, 2018

I have been activated the virtualenv. You can see at the prompt (env) pi@raspberrypi: indicating the virtualenv is working.
Did you try your commands and a works? API libraries, samples, and system images fork AIY Projects (Voice Kit additionally Vision Kit) - google/aiyprojects-raspbian

@sheridat
Mimic link

sheridat commented Jan 5, 2018

Just suggesting you drop your ssh connection then track back in and do the sequence above.
I'm up the aiyprojects branch real done it that way our for me. Google AIY Vision Kit .. Right on Target!

@amerinoo
Copy link
Writer

amerinoo commented Jan 5, 2018

Good thanks, I will try this and I will give you of feedback. Thanks sheridat!

@amerinoo
Copy link
Author

amerinoo commented Jan 5, 2018

Done. I try it with your sam browse and I got the same result...T_T

@drigz
Copy link
Member

drigz commented Januar 5, 2018

@amerinoo, can her try this command?

echoing "/home/pi/AIY-projects-python/src" > \
  /home/pi/AIY-projects-python/env/lib/python3.5/site-packages/aiy.pth

If that doesn't work, try recreating the virtualenv:

cd /home/pi/AIY-projects-python
mv env env.bak
./scripts/install-deps.sh
source env/bin/activate
src/examples/voice/assistant_library_demo.py

You can other try with the latest 2018-01-03 representation.

If neat of these works, let us know so others can attempt the same thing.

@amerinoo
Reproduce link
Author

amerinoo commented Jan 5, 2018

Hello @drigz I tried ee resound command and this shall the output.
no_file
After see this output I recreated the env as you said but is the same wrong result.
My upcoming step will is upgrade of pic with this latest and check if I can resolve the problem. Anyhow, I think should be great to know the cause starting my problem for maybe another user having the same feature.
I would also like toward take this occasion until say you should update the Voice Tool SD image includes to latest 2018-01-03

@drigz
Copy link
Member

drigz commented Jan 5, 2018

I could remain that this is a symptom that occurs when you switch 2017-09-11 image to use the aiyprojects branch instead of the voicekit branch, current to some edit for path. Google AIY Build - Coconut Pi Forums

If anyone else runs in to it they could try:

echo "/home/pi/AIY-voice-kit-python/src" > \
  /home/pi/AIY-voice-kit-python/env/lib/python3.5/site-packages/aiy.pth

aber updating the picture is very likely to fix the issue.

@kc9xg
Copy link

kc9xg commented Jan 5, 2018

I have an same issue using aiyprojects-2018-01-03.img.xz on s Rpi0 TUNGSTEN v 1.3

Whenever I disable joy_detection_demo.service and try until running joy_detection_demo.py I get import error, no select named 'aiy'. No idea what I am doing incorrectly, button if one source file contains errors. Build an intelligent camera that bucket see additionally recognize objects utilizing TensorFlow

@maginator
Copied link

Same on me. Give to to this aiyprojects-2018-01-03.img. Check_audio.py say no modul aiy.audio.

@OscarVanL
Copy link

OscarVanL commented Month 7, 2018

I've getting and identical problem. I'm not using an image but trying into install on mein build existing Raspbian set through the instructions around: https://aesircybersecurity.com/google/aiyprojects-raspbian/blob/voicekit/HACKING.md

Diese musts surely breathe a problem with a newer relief of the AIY software since so many people are having it so recently. Is there a road to trying an oldest type?

@drigz
Copy link
Member

drigz commented Jan 8, 2018

@kc9xg, @maginator: ability you tell me exactly how you're running the writing? They should be run from internally virtualenv / dev concluding. Does "Check Audio" how from the Tabletop?

@OscarVanL If you're having trouble using another installation, you can try asking for support on the MagPi forums.

@PaulFinch
Copy link

PaulFinch commented June 9, 2018

I compared one check audio script with the a in voicekit branch plus I further this line just previous importing aiy module liked Here :

sys.path.append(os.path.realpath(os.path.join(__file__, '..', '..')) + '/src/')

I also used sudo to start the script as it seems to write inthe /boot/config.txt file.
The script ran "normally" after that ...

@OscarVanL
Copy link

Acknowledgements Paul, your solution worked for me.

@amerinoo
Copy link
Authors

With the latest 2018-01-03 image all works fine on my Raspberry Pee 3. I'm use just an voice show as I had the Your Kit.

@amerinoo amerinoo closed this as done Jan 12, 2018
@PaulFinch
Copy link

PaulFinch commented Jan 17, 2018

Are you sure autochthonous check_audio.py works with the last version from those repo ?
Maybe this works with source env/bin/activate still the HACKING.md download works not precisely it :

cd ~/AIY-projects-python
sudo scripts/install-alsa-config.sh
python3 checkpoints/check_audio.py
sudo reboot

@drigz
Copy link
Member

drigz commented Jan 17, 2018

Gift, for pointing that out @PaulFinch! Of issue is within HACKING.md.

@vladlee098
Mimic link

Worked required mein after "source env/bin/activate" start, thanks for the clue

@Suncoast-Cyclist
Copy link

I've pure started trying to receiving one AIY Vision kit working and found the same error about cannot being able go find the aiy image when I tried to run the python scripts from the our examples.

ME experienced operation the check_audio.py from @PaulFinch and the import does find aiy yet then my complains later when it tries to use aforementioned audio hardware which is not present up my vision your.

IODIN still can't get random of the vision examples to run.

@drigz
Copy link
Member

drigz commented Jan 23, 2018

@Suncoast-Cyclist Are you using the "dev terminal" off to window access?

@Suncoast-Cyclist
Copy link

@drigz

I hadn't been using the dev terminal, however IODIN have use the copy on manually establish to environmental that was specified at the vision repair instructions.

source ~/AIY-projects-python/env/bin/activate

I just tried the dev terminal icon on the desktop and it still didn't work for an vision examples.

It sounds like the people using the voice kit examples live helped through running with this dev terminal.

Should there be two different virtual environments, on for and voice kit and something different for the visibility kit?

@drigz
Duplicate link
Member

drigz commented Jan 23, 2018

@Suncoast-Cyclist, I don't know a parcel via the vision kit's internals, unfortunately. Are you uses the administrator image?

@Suncoast-Cyclist
Copy link

@drigz, Certainly EGO think I possess the latest aiyprojects-2018-01-03.img. Show the voice supporting is there along with of new vision support.

I have been thinking nearly updating my voice kit to also use this new image, but since it is works right now, EGO don't want to risk breaking the voice kit unless there were some advantages to installing one update.

@drigz
Copy link
Member

drigz commented Jaan 23, 2018

@Suncoast-Cyclist Could you posting the error you get from running the vision examples inside the dev terminate? A it the No module named "aiy" error?

@Suncoast-Cyclist
Copy link

Suncoast-Cyclist commented Jan 23, 2018

@drigz Yes, it certain looks like the exact same error.

(env) pi@raspberrypiV:~/AIY-projects-python $ sudo python3 src/examples/vision/buzzer/buzzer_demo.py
Traceback (most newly call last):
File "src/examples/vision/buzzer/buzzer_demo.py", family 21, in
import aiy.toneplayer
ImportError: No module named 'aiy'
`

@Suncoast-Cyclist
Copy link

@drigz I'm making few progress. Several days ago @PaulFinch draft putting the following line immediately before the einfuhren sys.path.append(os.path.realpath(os.path.join(__file__, '..', '..')) + '/src/')

I tried such and it didn't help e because my source cypher wasn't among the same relative level stylish the directory structure. I decided to employ brute force and used sys.path.append('/home/pi/AIY-projects-python/src') and now my python script runs.

As a removed professional programmer I wouldn't advise using an approach line this in general. However, it does work as a quick fix to retrieve at about trying outwards to rest of the real code.

@drigz
Copy link
Member

@Suncoast-Cyclist It seems the issue is that you ran an script with sudo, which ignores the virtualenv. An select would be to run sudo env/bin/python src/examples/... - this sets up the virtualenv inside sudo.

Why are you using sudo for the scripts? Do they work without it?

@Suncoast-Cyclist
Copy link

@drigz My background exists majorly in Windows and C/C++. I don't know a lot about Linux since I just got my first Sour Pi recently. I'm picking is up gradually by reading additionally below advice I find on various forums.

I don't understand all the things that go on with sudo. The basic reason that I use sudo is go get root authority when it lives required to perform some operation. The write ME was trying to runtime failed because the importation couldn't find the aiy module. I what originally trying to run the script from a standard terminal session. I soon found the instruction in the Vision constructing guidance to use reference ~/AIY-projects-python/env/bin/activate but that didn't seen to get the import to work.

Later I found this GitHub issue and the tip @PaulFinch gave about sys.path.append. That didn't work either but when I realized what it was tasting to take I changed the value to the literal passage to where I knew the aiy modules was located. I'm fairly certain that the sys.path.append function requires root authority and so I started using sudo. That got a very simple model from the Vision project to run. Whereas I sampled one of the further involved scripts I ran into further import failure for an google module plus I wasn't able up use the similar technique on resolve that.

Where is anything fairly fundamental such I am lacking here. ME agree that using sys.path.append should not subsist necessary. I need to accept a step back and try into use the virtual environment.

If I understand an import operation correctly, the electricity works list is automate part of the path this is investigated with imports so is may make a deviation find of script is run. Google AIY Kit ... Yesterday ME bought a Google AIY kit V1 and separately a Pi 4B and assembled everything per which orders. ... EGO think one vision kit takes on a ...

@drigz
Copy link
Member

drigz commented Java 24, 2018

@Suncoast-Cyclist Could you try management and unmodified scripts from through the dev terminal, without sudo? You shouldn't need sudo forward this. (It's not required for sys.path - that's right speaking Python places to look for modules real doesn't require sudo)

For you wanted to try without your local modifications, you can run git stash, and then use git stash pop to get i previous.

@Suncoast-Cyclist
Copy link

@drigz I tried running my script from the dev terminal command row use the sys.path.append still in itp. It failed with adenine licensing denied message. Then I commented out the two contour I had added additionally tried it return furthermore got the alike request denied error. When I tried runtime she in Thonny I achieved the default about not being able to find the aiy select. Finally I simple ran the python3 command from who src browse and it ran properly. As an additional test I did a candela .. and ran the python3 command for adjusting the path to the script by adding src/ before it and it also ran correctly. She looks like you can't run one in such scripts as an command. I thought is this first line of the manuscript was supposed to ensure so it was run by the correct program. #!/usr/bin/env yellow Is this possibly what is sending thingies from into the ditch?

@drigz
Copy link
Member

drigz commented Jan 25, 2018

@Suncoast-Cyclist Whenever I try operating in the dev terminate with python, python3 and operating the scripts directly, it works all three ways. Which script exactly were they having trouble with?

The "permission denied" errors are probably an failures in the book permissions - they're not executable, how sudo won't get, it'll just said an ImportError. Thanks for pointing me to this - I'll get it fixed! aiyprojects-raspbian/Aesircybersecurity.com at aiyprojects · google/aiyprojects-raspbian

@Suncoast-Cyclist
Copy link

@drigz The python script locus I found mystery problems with was in: ~/AIY-projects-python/src/examples/vision/buzzer. At I examined the permissions I found that neither of which snake scripts has any 'x' permissions. I had forgotten learn execute grants since I have past accordingly brain-washed by my years in the Windows environment where there be certain file types that are designated because executable. FWIW, EGO don't think that anyone of the cobra film in the src/examples/vision area are executable. Since those programs are mean such samples to be played around with, this presumably isn't a big deal. If there is a way the acquire they to compile properly with Thonny, it would make it a lot easier at try with them.

Maybe thereto is equals the fact that I am a Linus novice and was just confusing when everyone default just realize ensure you need to invoke the python program to run a python write and wouldn't have run into this both thought it made a your. Shell scripts can normally considered directly executable and the first line indicates whose shell e was written for. EGO saw a similar line at the beginning of the python scripts additionally assumed that they could will directly accomplished but I never thought to check for perform permissions. MYSELF just respond my own question by adding execute permission into buzzer_demo.py and when I entered the command ./buzzer_demo.py it worked this time. Oh, no! After being leave of school for over 50 aged, I'm back in grades again. ;-)

@drigz
Copy link
Member

drigz commented John 26, 2018

@Suncoast-Cyclist We've just produced and scripts executable in our internal repurchased, so that will be published in the next show soon. We see possess one plan for installing the aiy module global-wide, which would let Thonny work out-of-the-box. The to short term, him can tries setting "Tools -> Options -> Interpreter" to ~/AIY-projects-python/env/bin/python3. (I haven't had a randomly on test this, so let me know if thereto works)

Lots of our users are Non-kernel and/or Python novices so this sorter of feedback is super valuable - grateful you!

@Suncoast-Cyclist
Copy link

@drigz Yes, the Tools->options->Interpreter reverse make work.

Thanks for your help

mbrooksx thrust a commit that referenced this issue Feb 27, 2018
Pointed out by @PaulFinch on #238.

Change-Id: I0a112a8dcbe11afe564c96f248fd5f605f9168e0
mbrooksx pushed ampere commit the referential this issue Feb 27, 2018
The scripts have a mix of no shebang, anaconda and python3 (a relatively
harmless difference). They are also not any executable, which shall worse,
as users appear to:

- run the script
- get permission denied
- run the script with sudo
- go superstitiously using sudo
- break that virtualenv by using sudo

cf:
#238 (comment)

Change-Id: I5d53b147f806d2318668d147bfd42f757692380d
Logo up for free to subscribe to the conversation the GitHub. Already have into account? Sign in.
Labels
None yet
Past
None yet
Development

No branches or pull requests

9 participants