LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-07-2019, 12:12 PM   #1
enigma9o7
Senior Member
 
Registered: Jul 2018
Location: Silicon Valley
Distribution: Bodhi Linux
Posts: 1,388

Rep: Reputation: 560Reputation: 560Reputation: 560Reputation: 560Reputation: 560Reputation: 560
Installing / Configuring Alexa Snap


I did sudo snap install --beta alexa

I created an Amazon Developer account and security profile as described here:
https://github.com/alexa/avs-device-...curity-Profile
then added http://alexa.local:3000/authresponse to the Allowed Return URLs and http://alexa.local:3000 to the Allowed Origins.

However, I don't know how to use/run it. Trying to open http://alexa.local:3000 in a browser doesn't do anything. I have this config.json file I downloaded, do I need to put it somewhere? There must be some step I'm missing.
 
Old 01-07-2019, 10:32 PM   #2
enigma9o7
Senior Member
 
Registered: Jul 2018
Location: Silicon Valley
Distribution: Bodhi Linux
Posts: 1,388

Original Poster
Rep: Reputation: 560Reputation: 560Reputation: 560Reputation: 560Reputation: 560Reputation: 560
https://blog.ubuntu.com/2017/05/16/d...r-raspberry-pi

Could "Open http://alexa.local:3000 in a web browser on a local device or a device on the same network" mean not on the device you installed it on? Regardless I tried opening it from my phone and didn't do anything different.

Could there be some reason it won't work on PC but does on RPi? I'm using bodhi 5 which is ubuntu 18 based...
 
Old 06-19-2021, 08:05 PM   #3
richaardvark
LQ Newbie
 
Registered: Jun 2021
Posts: 2

Rep: Reputation: Disabled
Quote:
Originally Posted by enigma9o7 View Post
https://blog.ubuntu.com/2017/05/16/d...r-raspberry-pi

Could "Open http://alexa.local:3000 in a web browser on a local device or a device on the same network" mean not on the device you installed it on? Regardless I tried opening it from my phone and didn't do anything different.

Could there be some reason it won't work on PC but does on RPi? I'm using bodhi 5 which is ubuntu 18 based...
I realize this is an old post, but I saw you post about this in several places/others post that they were stuck at the same step and wanted to help/provide more information for anyone in the future who might come across this via Google. You're most welcome future people, lol.

You didn't do anything wrong - the developers of this "Alexa for Virtual Device/Raspberry PI" (DataArt) just wrote terrible directions/poor coding.
Their code/app/snap package is supposed to setup a local host address on your device ("alexa.local") but for whatever reason this fails to happen, at least it did for you and it did for me (my system is MX Linux 19.3, based on Debian 10 [Buster]). In order to fix this, I edited a line of code in one configuration file in the snap package to replace "alexa.local" with "localhost" and then everything worked fine. However, Snap packages/the files that make a snap package are read-only/you're not supposed to be able to easily modify a snap package. In order to do so, you must first unmount the snap package, then you "unsquash" the .snap package (it's a compressed file", then modify the configuration file and update "alexa.local" to "localhost", then recompile/"resquash" the .snap package, reinstall your updated Alexa snap package, start the Alexa snap package service, then start the alexa app. It sounds hard but it's really not and only takes a moment. If you get lost, here is a helpful website that breaks down how to modify a snap package and then reinstall it.



Code:
#see where your alexa snap file is mounted
mount |grep snap

#stop the alexa snap package
sudo snap stop alexa

#unmount the alexa snap package
sudo umount /snap/alexa/2

#unsquash the alexa .snap package to a temporary folder
sudo unsquashfs -d /home/<your username>/tempalexa /var/lib/snapd/snaps/alexa_2.snap

#edit the "local.alexa" parameter to "localhost"
<name of your text editing program> /home/<your username>//tempalexa/bin/alexa_params.py
Once inside this file, you should see:

Code:
#!/usr/bin/env python3

import os

LOCAL_HOST="alexa.local"
LOCAL_PORT=3000
BASE_URL = "http://" + LOCAL_HOST + ":" + str(LOCAL_PORT) + "/"
DEFAULT_VOICE_THRESHOLD = 0.25
DEFAULT_PRODUCT_ID = ""
DEFAULT_CLIEND_ID = ""
DEFAULT_DEVICE_SERIAL = ""
DEFAULT_CLIENT_SECRET = ""
ALEXA_CREDENTIALS_FILE = os.getenv("SNAP_USER_DATA", ".") + "/alexa_credentials"
Update the LOCAL_HOST="alexa.local" line to instead say LOCAL_HOST="localhost". Save the file and close it.

Code:
# re-squash the files/folders in your "tempalexa" folder into a new .snap package file
sudo mksquashfs /home/<your username>/tempalexa/ alexa_2.snap

#copy the updated .snap package back to where it lives
sudo cp alexa_2.snap /var/lib/snapd/snaps/alexa_2.snap

#re-mount the snap package
sudo mount -t squashfs -o ro,nodev,relatime,x-gdu.hide /var/lib/snapd/snaps/alexa_2.snap /snap/alexa/2

#start the alexa snap service again
sudo snap start alexa

#and finally, run the alexa snap application.  (this is the code you will run in your terminal whenever you want to talk to Alexa on your machine
alexa.alexa-run
From there you should be able to authorize your Alexa virtual device with the Amazon server.

The next roadblock/fun part that broke my machine was the snap pulseaudio installation prerequisite. Granted, I attempted this on a desktop PC and not an actual raspberry pi, but I already had Alsa and Pulse audio running just fine on my machine. Installing the snap pulseaudio package totally broke my sound. But after uninstalling the snap pulseaudio package, and then reinstalling regular pulse audio and restarting it, I was good to go - Alexa works/I can talk to her.

However, after alllll of that fun - I can't say it's a very well-written application for interacting with Alexa It's no comparable to the "Alexa for PC" Windows Store app on Windows 10 by any means... many of Alexa's more useful functions are not supported (playing music, communications, etc.) and the coding for alexa listening to you is terribly written - half the time she will cut you off before you've finished speaking and then gives an error saying it couldn't understand you, in broken English: "Cancel 2.5s due to the low level". Adjusting microphone levels helps, but not well for me anyway. I have to scream super loud for it to work. It's not fantastic.

But there you go! Hopefully someone finds this helpful.
 
Old 03-30-2022, 12:34 AM   #4
millithvr
LQ Newbie
 
Registered: Jul 2008
Posts: 1

Rep: Reputation: 0
I did all above. Still I get the following when I give alexa.alexa-run


xcb_connection_has_error() returned true
shm_open() failed: Permission denied
Traceback (most recent call last):
File "/snap/alexa/2/bin/alexa.py", line 20, in <module>
main()
File "/snap/alexa/2/bin/alexa.py", line 10, in main
alexa_audio_device.init()
File "/snap/alexa/2/bin/alexa_audio_device_pulse.py", line 29, in init
+ str(pa.strerror(error), 'ascii'))
Exception: Could not create pulse audio output stream: No such device or addressWhen I give alexa.alexa.run still I get the following

Last edited by millithvr; 03-30-2022 at 12:42 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Conexant voice board lets you summon Alexa from a Raspberry Pi LXer Syndicated Linux News 0 12-10-2016 06:18 AM
LXer: Drupal and Alexa: The Next Big Thing? LXer Syndicated Linux News 0 05-12-2016 03:20 AM
are the stats for LQ at alexa right? aizkorri LQ Suggestions & Feedback 2 08-04-2010 09:45 AM
LXer: Linux keeps Alexa's engineers happy LXer Syndicated Linux News 0 01-10-2008 10:51 AM
LXer: Alexa Gone Wild! Website Ranking Service Loses Its Mind. LXer Syndicated Linux News 0 04-04-2006 06:03 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:45 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration