Facebook-Messenger-Bot icon indicating copy to clipboard operation
Facebook-Messenger-Bot copied to clipboard

app.py issue

Open montaser85 opened this issue 8 years ago • 6 comments

Hello, In point 8, while deploying flask server to heroku, after running the "heroku run python app.py deploy" command I am getting an error named "valueerror unsupported pickle protocol 3". but if I change the content of the app.py to some basic code then it runs. I am using python 3.6.2 and windows computer. Would you please help? 1fs

montaser85 avatar Feb 13 '18 20:02 montaser85

As mentioned here and here I'm thinking that this is some sort of issue with storing/loading a file (in this case wordsList.txt) when using Python 2 vs 3. I think it would be good to look at the pickle load documentation and see if there's some sort of special parameter that you need to pass in (If you look at that 2nd Stack Overflow post, it looks like adding an encoding parameter might fix it). Another option is to change line 82 in Word2Vec.py (which is where we use pickle to create wordList.txt) to something that would be compatible with Python 3.

adeshpande3 avatar Feb 13 '18 23:02 adeshpande3

tried encoding parameters, "bytes","latin1","utf-8" but a new error is shown for these arguments. which is : TypeError: load() got an unexpected keyword argument 'encoding'

I am new to python therefore finding no way to solve this issue. I am using your app.py as it is.Would you please help about this app.py?

montaser85 avatar Feb 14 '18 10:02 montaser85

Okay, so you created the wordList.txt using your computer which means you used Python 3. However, from the error message, it seems like your Heroku app is using Python 2. You may need to change your requirements.txt file so that you use Python3 instead of 2. This link may have some useful info.

adeshpande3 avatar Feb 15 '18 03:02 adeshpande3

Changing the python version in runtime.txt worked...thanks a lot. But unfortunately while deploying app.py a new error is shown : 1111fdgdf

montaser85 avatar Feb 15 '18 09:02 montaser85

Looks like it's a Tensorflow error where it can't find the appropriate checkpoint file. Double check the directory where you have your saved models and make sure you see a file structure like this.

image

adeshpande3 avatar Feb 15 '18 16:02 adeshpande3

i am also facing same issue , i have changed the version in the runtime.txt , but still when running app.py it is showing me error no module named numpy i have already installed all the dependencies

requirements.txt runtime.txt screenshot 10

YashviP avatar Dec 19 '18 07:12 YashviP