-1

I'm a newbie in python.

I try to run Alexa with my ReSpeaker Mic and I'm following all the steps from https://github.com/respeaker/avs. But I have a bunch of errors when I try to run alexa-auth.

The issues are the following :

Traceback (most recent call last):
File "/home/lilitsve/.local/bin/alexa-auth", line 7, in <module>
    from avs.auth import main
  File "/home/lilitsve/.local/lib/python2.7/site-packages/avs/auth.py", line 9, in <module>
    import tornado.httpserver
  File "/home/lilitsve/.local/lib/python2.7/site-packages/tornado/httpserver.py", line 144
    def __init__(self, *args: Any, **kwargs: Any) -> None:
                            ^
SyntaxError: invalid syntax

I found some similar issues which suggested to use python3 instead of python2. On my computer (Linux Ubuntu), I have python2.7, python3 and python3.7 installed, but I don't know how to switch to python3 and make my code use the python3 version. But still, I'm not sure my problem is coming from the python version (need confirmation)

Any help would be greatly appreciated !

  • related/dupe: [How do I tell a Python script to use a particular version](//stackoverflow.com/q/11170827) – Aran-Fey Mar 17 '19 at 09:09
  • When executing the code, use `python3 file.py` instead of `python` – Arturs Vancans Mar 17 '19 at 09:25
  • Thank you @Aran-Fey. Thank you @Peter Wood. As mentionned in the related issue, I tried to add the version at the first line of the script `#!/usr/bin/python3` instead of `#!/usr/bin/python`. That resolved my issue but now I'm getting `Traceback (most recent call last): File "/home/lilitsve/.local/bin/alexa-auth", line 7, in from avs.auth import main ImportError: No module named 'avs'` The module avs is installed with `pip install avs` but it seems not to be recognized by the python3. Now, how can I specify the dependencies to be used under/with the python3 ? – Liliya Tsvetanova Mar 17 '19 at 09:25

1 Answers1

0

There are some ways to use any version and run your project in your desire version.

Step 1:

If you are using Ubuntu. run this command in your command line

pip3 install virtualenv

Step 2 : Enter your avs project folder

cd avs

Then run this

virtualenv -p python3 venv [python3 = python version; venv=virtualenv name]

source venv/bin/activate

Finally

python setup.py install

above the example your project will run on python3

Another way that is on your gitrepo example https://github.com/respeaker/avs

sudo apt-get install mpg123 mpv
sudo apt-get install gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly \
gir1.2-gstreamer-1.0 python3-gi python3-gst-1.0
sudo apt-get install python3-pyaudio

I change python-pyaudio to python3-pyaudio

If have more queries comment below

Shariful Islam
  • 526
  • 3
  • 10
  • Thank you ! But now I'm getting `usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...] or: setup.py --help [cmd1 cmd2 ...] or: setup.py --help-commands or: setup.py cmd --help error: no commands supplied` – Liliya Tsvetanova Mar 17 '19 at 09:47
  • Unfortunately, the second example (modifying the gitrepo example) is not working for me, I still get the same errors. – Liliya Tsvetanova Mar 17 '19 at 09:58
  • does first example work or show same errors? If first example .. first have to activate venv and then run the command . – Shariful Islam Mar 17 '19 at 10:06
  • the first example is giving the following error `usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...] or: setup.py --help [cmd1 cmd2 ...] or: setup.py --help-commands or: setup.py cmd --help error: no commands supplied` I suppose `python setup.py` needs arguments, but I don't know which ones. – Liliya Tsvetanova Mar 17 '19 at 10:18
  • ```python setup.py install``` This will work.. I test it on my local pc. works perfectly – Shariful Islam Mar 17 '19 at 10:29
  • I tried `python setup.py install`, the packages were installed, but when I try to run the `alexa-auth` I'm getting the same errors as those mentionned in my post – Liliya Tsvetanova Mar 17 '19 at 10:36