4

I'm trying to begin developing a skill for Alexa using flask-ask and ngrok in python. Following is my code:

from flask import Flask

from flask_ask import Ask, statement


app = Flask(__name__)
ask = Ask(app, "/")

@ask.launch
def start_skill():
    welcome_message = 'Hello there'
    return statement(welcome_message)

@ask.intent("sampleIntent")
def sampleIntent():
    return statement('I am the sample intent')
    
@app.route('/')
def homepage():
    return "Hi,there"


if __name__ == '__main__':

    app.run(port=7025, debug=True)

The code runs fine on my machine and returns the correct output if I print it out and I am able to view the text "Hi,there" when i view both the ngrok https link and the python localhost link. Both ngrok and the python code are on the same port of 7025.

I know the issue is cryptography as i have version 3.0 installed. I was instructed by the tutorial to downgrade both cryptography and Werkzeug. I was able to downgrade Werkzeug but was not able to downgrade cryptography. The pip freeze is bellow:

aniso8601==1.2.0
appdirs==1.4.4
ask-sdk-core==1.14.0
ask-sdk-model==1.24.0
ask-sdk-runtime==1.14.0
ask-sdk-webservice-support==1.2.0
asn1crypto==1.4.0
certifi==2020.6.20
cffi==1.14.1
chardet==3.0.4
click==7.1.2
cryptography==3.0
distlib==0.3.1
filelock==3.0.12
Flask==0.12.1
Flask-Ask==0.9.8
flask-ask-sdk==1.0.0
idna==2.10
itsdangerous==1.1.0
Jinja2==2.11.2
MarkupSafe==1.1.1
openssl-python==0.1.1
pycparser==2.20
pyOpenSSL==17.0.0
pyserial==2.7
python-dateutil==2.8.1
PyYAML==3.12
requests==2.24.0
six==1.11.0
Unidecode==1.1.1
urllib3==1.25.10
virtualenv==20.0.30
Werkzeug==0.16.0

When I try and downgrade cryptography to the version 2.1.4, I get a lot of red text, however, the first line seems to be:

   Running setup.py install for cryptography ... error

I am running python version 3.8.5 and I have pip version 20.2.2.

Annon
  • 123
  • 1
  • 9

1 Answers1

2

There are several ways to solve this, to my mind the easiest looks like this (git required):

  1. navigate to your project's root folder
  2. clone the flask-ask repo: git clone https://github.com/johnwheeler/flask-ask -- this will create a local copy of the repo in your project's directory
  3. modify the requirements.txt file in /your_project/flask_ask/ and remove the version number from cryptography's package. It's currently frozen at ==2.1.4 -- simply remove ==2.1.4 to allow pip to resolve the correct dependency.
  4. Once you've modified the underlying package, and still in /your_project/flask_ask/ run pip install -e . -- this will install an "editable" copy of the flask_ask package so that further updates will be recognized

enter image description here

kerasbaz
  • 1,774
  • 1
  • 6
  • 15
  • Hi, I am so sorry for the late reply, I will give the bounty when I get it fixed. I think I'm close. I Just saw this now as i didn't get a notification, But I am confused with step number 3, am i supposed to find this in the root folder in windows explorer? Is there a git command for it? Again, Thanks a lot for the help! – Annon Aug 20 '20 at 10:47
  • For the modification to requirements.txt? No, there's no git command for that. After you clone to repo a local copy of the repo will be pulled into wherever you cloned it from. You will need to cd into /flask-ask/ (the repo name) and open requirements.txt. In requirements.txt change the cryptography version by removing the version totally as described above. You may also need to modify setup.py and change the cryptography version there as well. Once you make the changes use the `pip install -e .` command. – kerasbaz Aug 20 '20 at 12:10