Python Forum

Full Version: moving python project to aws ec2
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I've got a python project that runs from a cron job.
It runs fine on the local machine, and I need it to run on an AWS EC2.
I copy it to the EC2 and run from the command line to test.

It throws this:
Error:
>Traceback (most recent call last): > File "BTCfeels.py", line 2, in <module> > from tweetfeels import TweetFeels > File "/home/john/anaconda3/lib/python3.5/site-packages/tweetfeels/__init__.py", line 1, in <module> > from .tweetdata import TweetData, TweetBin > File "/home/john/anaconda3/lib/python3.5/site-packages/tweetfeels/tweetdata.py", line 152 > df = df.groupby(pd.Grouper(freq=f'{int(binsize/second)}S')).size() > ^ >SyntaxError: invalid syntax
I tried to use the pip freeze method:

> pip freeze > requirements.txt
> then
> pip install -r requirements.txt

That throws this error:
Error:
> ERROR: Could not find a version that satisfies the requirement anaconda-project==0.8.0 (from -r requirements.txt (line 4)) (from versions: 0.8.1, 0.8.2) ERROR: No matching distribution found for anaconda-project==0.8.0 (from -r requirements.txt (line 4))
I just need to be able to run code that works on one ubuntu16.04 on another ubuntu16.04.

Thanks for any help.
The code you try to run use f-string,then you need Python 3.6 -->.
You use Python 3.5.
>>> binsize = 10
>>> second = 5
>>> freq=f'{int(binsize/second)}S'
>>> freq
'2S'
ubuntu 18.04 on AWS EC2 has Python 3.6.