I am trying to setup aiy projects on RPI3, as i follow the inrecutions on the hacking.md file, i am stuck at this step:
env/bin/python checkpoints/check_audio.py
First, i do not have env folder, so i adjusted the command to be:

How can i fix this issue?
I searched other old threads, but none of them helped me to resolve this issue. Please note that i use Raspbian Stretch on RPI3.
Thanks.
Please use python3 instead of python, or run the script directly: ./check_audio.py
Same thing:

When i debugged my file, i found this is the import that causes the exception:
import aiy._drivers._alsa
https://github.com/google/aiyprojects-raspbian/blob/2a78558cda2ac390638d2e1f062b77d491c13482/checkpoints/check_audio.py#L28
This is where I am getting stuck on.
Hi,
I managed to get this working by copying the aiy folder found in src to the checkpoint directory. I used the following commands from the root of the project:
cp -R src/aiy checkpoints/aiy
python3 checkpoints/check_audio.py
I am having the same issue on two boards. The mic does not play a recording but the speaker is working. I tried the check audio bash file but it did not work on both boards!
Yeah I have the same issue as you do
I am having the same issue on two boards. The mic does not play a recording but the speaker is working. I tried the check audio bash file but it did not work on both boards!
Same for me. I am following the HACKING,md guideline and have the same error.
I don't have the env folder as well.
Ok here is the solution:
The bug is due to a change in the install-deps.sh that has remove the creation of the /env folder.
I noticed there are new kits and new image file available at https://dl.google.com/dl/aiyprojects/aiyprojects-latest.img.xz. The actual file downloaded is aiyprojects-2018-04-13.xz. Has anyone tried the new image out to see if it resolves this problem? I'm at work right now.
Cross posting with issue #310 as this is probably relevant to both bugs.
You can actually run it by modifying PYTHONPATH env variable (same for running the examples). Like so:
PYTHONPATH="src/" checkpoints/check_audio.py
But I'm stuck on installing the drivers for the voicehat. I'm getting Failed to find the voiceHAT soundcard even after installing the alsa configs.
I had the same problem with the missing aiy module, but all i had to do was "activate" the python environment "env" using source ./env/bin/activate :
pi@pi3plus:~/AIY-projects-python $ src/examples/voice/assistant_grpc_demo.py
Traceback (most recent call last):
File "src/examples/voice/assistant_grpc_demo.py", line 20, in <module>
import aiy.assistant.grpc
ImportError: No module named 'aiy'
pi@pi3plus:~/AIY-projects-python $ source ./env/bin/activate
(env) pi@pi3plus:~/AIY-projects-python $ src/examples/voice/assistant_grpc_demo.py
Please visit this URL to authorize this application: https://accounts.google....
We got rid of virtualenv, please use the latest SD card image. Everything should just work:
pi@raspberrypi:~ $ python3
Python 3.5.3 (default, Jan 19 2017, 14:11:04)
[GCC 6.3.0 20170124] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import aiy
>>>
@dmitriykovalev it doesn't! 馃槈 Well, at least building from source doesn't...
Building from source and following HACKING.md doesn't work. There's a bunch of related issues including errors like the following which I receive on a fresh Stretch install.
$ checkpoints/check_audio.py
Traceback (most recent call last):
File "checkpoints/check_audio.py", line 28, in <module>
import aiy.audio # noqa
ImportError: No module named 'aiy'
I've forked and am testing by reverting the removal of install-deps.sh and potentially reintroducing virtualenv, but I'm not a python guy and aren't sure about the impact. I'm happy to hack away and submit a PR for feedback but I think this warrants some proper attention and testing.
If you create a fresh Stretch Lite image and follow the instructions from HACKING.md, you'll quickly see the issues.
Is there competition between the image and building from source? Personally, I'd expect to be able to manually install things so would favour support of both.
My fork is https://github.com/tobyweston/aiyprojects-raspbian/commits/aiyprojects btw
Hello.
Has anyone been able to install by HACKING.md?
Any update forecast?
Thanks!
This is just plain broken and there seems to be no interest in even commenting here. I鈥檝e started a fork but it鈥檚 not 100% working with a fresh raspbian :sad:
Wow. This is so frustrating!
this worked for me.. from above.
If trying to install on an existing pi image or a current Voice image and using HACKING instructions...
just do this...
be in AIY_PROJECTs dir already
cp -R src/aiy checkpoints/aiy
python3 checkpoints/check_audio.py
Sadly having the same problem once I try to run assistant_grpc_demo.py.
This is indeed very broken and very frustrating. The kit website (https://aiyprojects.withgoogle.com) needs an update or it will continue to waste everyone's time. Is there any place to find instructions on the current image linked above?
I also get the same problem but I slove it using
import aiy.voice.audio
instead of import aiy.audio
I've been having this issue too but with
Traceback (most recent call last):
File "./led_demo.py", line 7, in <module>
import aiy.voicehat
ImportError: No module named 'aiy.voicehat'
I can't find the voicehat module anywhere when searching through the /aiy/ directory
note: I'm also using the older version of the AIY MagPi guide, so when I was trying to do the led_demo.py I had this issue
Instead of import aiy.voicehat use
from aiy.board import Board, Led
And replace
button.wait_for_press() ==銆媌oard.button.wait_for_press() .
button.wait_for_release() ==銆媌oard.button.wait_for_release() .
You can use button Led using following commands
board.led.state = Led.ON
board.led.state = Led.OFF
I am trying to use a similar idea. I have a working Voice Kit and I have seen Github threads that install vlc, add commands to get internet radio stations and hence play internet radio. I can get this to work with vlc on a raspberry pi only kit using google assistant library where I have a usb mic and external speaker. I use the assistant_library_with_local_commands_demo.py to which I add the extra command lines. However a parallel setup on the Voice kit only gives the error "I cannot play that yet". The setup will answer the usual questions.
I guess there is no solution to this problem either?
hellow there, im having the same problem; (No module named aiy.audio)
when using the following code, help me please im stuck
`#!/usr/bin/env python3
#
#
#
#
"""Run a recognizer using the Google Assistant Library.
The Google Assistant Library has direct access to the audio API, so this Python
code doesn't need to record audio. Hot word detection "OK, Google" is supported.
The Google Assistant Library can be installed with:
env/bin/pip install google-assistant-library==0.0.2
It is available for Raspberry Pi 2/3 only; Pi Zero is not supported.
"""
import logging
import platform
import subprocess
import sys
import aiy.assistant.auth_helpers
from aiy.assistant.library import Assistant
import aiy.audio
import aiy.voicehat
from google.assistant.library.event import EventType
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(26,GPIO.OUT)
GPIO.setup(6,GPIO.OUT)
GPIO.setup(13,GPIO.OUT)
GPIO.setup(5,GPIO.OUT)
logging.basicConfig(
level=logging.INFO,
format="[%(asctime)s] %(levelname)s:%(name)s:%(message)s"
)
def red_led_on():
aiy.audio.say('Red light on')
GPIO.output(26,GPIO.HIGH)
def red_led_off():
aiy.audio.say('Red light off')
GPIO.output(26,GPIO.LOW)
def blue_led_on():
aiy.audio.say('Blue light on')
GPIO.output(6,True)
def blue_led_off():
aiy.audio.say('Blue light off')
GPIO.output(6,False)
def green_led_on():
aiy.audio.say('Green light on')
GPIO.output(13,True)
def green_led_off():
aiy.audio.say('Green light off')
GPIO.output(13,False)
def yellow_led_on():
aiy.audio.say('Yellow light on')
GPIO.output(5,True)
def yellow_led_off():
aiy.audio.say('Yellow light off')
GPIO.output(5,False)
def all_led_on():
aiy.audio.say('Turning all lights on')
GPIO.output(26,True)
GPIO.output(6,True)
GPIO.output(13,True)
GPIO.output(5,True)
def all_led_off():
aiy.audio.say('Turning all lights off')
GPIO.output(26,False)
GPIO.output(6,False)
GPIO.output(13,False)
GPIO.output(5,False)
def primary_on():
aiy.audio.say('Turning blue, red and yellow lights, since they are primary colors.')
GPIO.output(26,True)
GPIO.output(6,True)
GPIO.output(13,False)
GPIO.output(5,True)
def primary_off():
aiy.audio.say('Turning off primary colors.')
GPIO.output(26,False)
GPIO.output(6,False)
GPIO.output(5,False)
def power_off_pi():
aiy.audio.say('Shutting down.')
subprocess.call('sudo shutdown now', shell=True)
def reboot_pi():
aiy.audio.say('Rebooting now.')
subprocess.call('sudo reboot', shell=True)
def say_ip():
ip_address = subprocess.check_output("hostname -I | cut -d' ' -f1", shell=True)
aiy.audio.say('My IP address is %s' % ip_address.decode('utf-8'))
def process_event(assistant, event):
status_ui = aiy.voicehat.get_status_ui()
if event.type == EventType.ON_START_FINISHED:
status_ui.status('ready')
if sys.stdout.isatty():
print('Say "OK, Google" then speak, or press Ctrl+C to quit...')
elif event.type == EventType.ON_CONVERSATION_TURN_STARTED:
status_ui.status('listening')
elif event.type == EventType.ON_RECOGNIZING_SPEECH_FINISHED and event.args:
print('You said:', event.args['text'])
text = event.args['text'].lower()
if text == 'power off':
assistant.stop_conversation()
power_off_pi()
elif text == 'reboot':
assistant.stop_conversation()
reboot_pi()
elif text == 'ip address':
assistant.stop_conversation()
say_ip()
elif text == 'red light on':
assistant.stop_conversation()
red_led_on()
elif text == 'red light off':
assistant.stop_conversation()
red_led_off()
elif text == 'blue light on':
assistant.stop_conversation()
blue_led_on()
elif text == 'blue light off':
assistant.stop_conversation()
blue_led_off()
elif text == 'green light on':
assistant.stop_conversation()
green_led_on()
elif text == 'green light off':
assistant.stop_conversation()
green_led_off()
elif text == 'yellow light on':
assistant.stop_conversation()
yellow_led_on()
elif text == 'yellow light off':
assistant.stop_conversation()
yellow_led_off()
elif text == 'primary colors on':
assistant.stop_conversation()
primary_on()
elif text == 'primary colors off':
assistant.stop_conversation()
primary_off()
elif text == 'all lights on':
assistant.stop_conversation()
all_led_on()
elif text == 'all lights off':
assistant.stop_conversation()
all_led_off()
elif event.type == EventType.ON_END_OF_UTTERANCE:
status_ui.status('thinking')
elif event.type == EventType.ON_CONVERSATION_TURN_FINISHED:
status_ui.status('ready')
elif event.type == EventType.ON_ASSISTANT_ERROR and event.args and event.args['is_fatal']:
sys.exit(1)
def main():
if platform.machine() == 'armv6l':
print('Cannot run hotword demo on Pi Zero!')
exit(-1)
credentials = aiy.assistant.auth_helpers.get_assistant_credentials()
with Assistant(credentials) as assistant:
for event in assistant.start():
process_event(assistant, event)
if __name__ == '__main__':
main()
`
Hey peeps,
I purchased my AIY voice kit on clearance from Target and had the same trouble. I was able to get the demos to run via the following command.
cd ~/AIY-projects-python/src/examples
voice/assistant_grpc_demo.py
Hope that helps someone else out there that was having trouble. Good luck!
Most helpful comment
Hi,
I managed to get this working by copying the aiy folder found in src to the checkpoint directory. I used the following commands from the root of the project:
cp -R src/aiy checkpoints/aiypython3 checkpoints/check_audio.py