Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only works with Python 2.7? #6

Closed
tiagofassoni opened this issue Feb 10, 2016 · 27 comments
Closed

Only works with Python 2.7? #6

tiagofassoni opened this issue Feb 10, 2016 · 27 comments

Comments

@tiagofassoni
Copy link

First of all, awesome work, folks! Really liked it and intend to use.

This is more of a reminder for the README, because, when reading the code, I saw "python2.7" hardcoded and I figured it would be best to write that in the README

@Miserlou
Copy link
Owner

The problem is that Lambda itself only supports Python 2.7 for now.

I don't think there's any reason why it wouldn't work on P3, but the
target is what AWS supports.

On Wed, Feb 10, 2016 at 6:03 PM, Tiago Fassoni notifications@github.com
wrote:

First of all, awesome work, folks! Really liked it and intend to use.

This is more of a reminder for the README, because, when reading the code,
I saw "python2.7" hardcoded and I figured it would be best to write that in
the README


Reply to this email directly or view it on GitHub
#6.

@tiagofassoni
Copy link
Author

Oops. Totally forgot about that. Mind if I update the README to write about that “limitation"?

On Feb 10, 2016, at 3:09 PM, Rich Jones notifications@github.com wrote:

The problem is that Lambda itself only supports Python 2.7 for now.

I don't think there's any reason why it wouldn't work on P3, but the
target is what AWS supports.

On Wed, Feb 10, 2016 at 6:03 PM, Tiago Fassoni notifications@github.com
wrote:

First of all, awesome work, folks! Really liked it and intend to use.

This is more of a reminder for the README, because, when reading the code,
I saw "python2.7" hardcoded and I figured it would be best to write that in
the README


Reply to this email directly or view it on GitHub
#6.


Reply to this email directly or view it on GitHub #6 (comment).

@Miserlou
Copy link
Owner

So, I was thinking more about this, and only the stuff that actually runs AWS side needs to be Py2.7.

All the rest can be Python3. However, this means that the tests need to be aware that some functions should only be tested on the target platform. Do you know how to do that with Travis?

@tiagofassoni
Copy link
Author

Well, I have absolutely no idea, sorry.

@mathom
Copy link
Collaborator

mathom commented Feb 20, 2016

I believe you could run Python 3 on lambda if you really wanted but you would have to ship a statically compiled version of the python binary along with your code. Sounds pretty gross, though.

@Miserlou
Copy link
Owner

That's a nightmarish idea.. not supporting that! :-P

Honestly I expect that Lambda will support multiple Python versions in the next 12 months. Screenshot this and we'll come back to it in a year to see if I was right..

@Miserlou
Copy link
Owner

That being said, I think we should target 3.5 for all of the local Zappa tools (although I don't know what that will do to the venv packaging stuff. Could relate to our idea to pass custom venvs through the ZAPPA_SETTINGS.)

@maljac
Copy link
Contributor

maljac commented Apr 9, 2016

Sidenote: I was not able to use zappa with Python 2.7.6 (SSL / Insecure.. warnings from urllib3). With 2.7.11 I had no problems. Maybe you should put this in the Readme as requirement.

@Miserlou
Copy link
Owner

Miserlou commented Apr 9, 2016

That's interesting. I think that comes because you need to install requests[security] on pythons.

@hayd
Copy link

hayd commented May 9, 2016

FWIW Here's some work towards py3 https://github.com/hayd/Zappa/tree/py3. IIUC it's all for nought while lambda in python 2.7 only, but may be worth testing out early anyway.

Note: Some unicode handling became a little messier in a few places, but a lot of this could be cleaned up (for one thing by defining b64encode on str).

@xuru
Copy link

xuru commented Aug 10, 2016

Hey guys... we can always add a compat.py file to allow python2.7/python3.5 compatibility functions. That way we'll be ready when it happens.

@Miserlou
Copy link
Owner

Can you elaborate more on that, @xuru ? I'm not familiar with that pattern.

@xuru
Copy link

xuru commented Aug 11, 2016

@Miserlou
Copy link
Owner

That looks like voodoo to me..

@hayd
Copy link

hayd commented Aug 11, 2016

I think the only thing that might want to go into a compat module is the b64encode/b64decode (to ensure this handles bytes/unicode consistently and correctly in py2 and py3). As you can see in the second commit above that's the majority of fiddly code repetition. I don't recall if that branch was passing py3 tests yet.

@iJebus
Copy link

iJebus commented Aug 24, 2016

Note that just actual 2.7 apparently won't do. I wasn't careful in using something recent (e.g. 2.7.12) and when I tried zappa deploy dev_api on the example project, I got the below. I didn't see this on 2.7.12 so, yup.

Packaging project as zip...
Uploading zip (4.4MiB)...
'ascii' codec can't encode character u'\u258e' in position 6: ordinal not in range(128)
Unable to upload to S3. Quitting.

@Miserlou
Copy link
Owner

Hmm. Interesting.

@hayd
Copy link

hayd commented Aug 24, 2016

@iJebus Which version of python are you using? (The unicode handing should not be different between minor 2.7 versions...!!) Could that be dependent on the file (rather than the python version)? Or does precisely this same package work with 2.7.12?

@xuru
Copy link

xuru commented Nov 23, 2016

I know this is a bit late in coming but there is a way to run python3 on lambda (it's a bit hackish, but it works): http://www.cloudtrek.com.au/blog/running-python-3-on-aws-lambda/

In my case, I have an API that I'm running in elastic beanstalk (so I get my python 3), but now I need to run some background processes on events from a 3rd party API. So in order to process those events, I need to modify the user object in dynamodb, and set a temporary password (long story). So right there, I have a problem, as now I have to have two copies of the user model, and also two spots that holds the password salt.

So I thought, I could have a paired down flask app.py with only the dynamodb stuff and the same settings file etc, as my main API, except I went the python 3 route...

@Miserlou
Copy link
Owner

Soooooo.. that's a really interesting idea. I'm into it.

However - is it worth building and maintaining that if official Python 3 support is right around the corner? Maybe we should talk more after reinvent..

@nueverest
Copy link

nueverest commented Feb 8, 2017

Could you provide an update on the status of Python 3 support? I would prefer it over 2.7.13

You can go to this AWS forum post to voice your support for python3.

@c22
Copy link

c22 commented Feb 13, 2017

@nueverest you should ask AWS when they're going to support Python3 on Lambda

@mikespoff
Copy link

I was really excited to use Zappa, but I've spent the past two days banging my head against an endless stream of problems. Now I realise that it was because Zappa only works on Python 2, and I'm using 3.

It would be very helpful to have a prominent warning up at the top of the readme saying something like, "Note: Because AWS Lambda currently only supports Python 2.7, Zappa also only runs on 2.7"

@1oglop1
Copy link

1oglop1 commented Mar 7, 2017

I just hope that Djago will drop support for legacy python(2) soon enough.
This seems to be super interesting project and should not use legacy stuff :/

@mathom
Copy link
Collaborator

mathom commented Mar 7, 2017

@1oglop1 Unfortunately there are a lot of projects out there that don't have python 3 support for various reasons. In this case, we're waiting on AWS to implement support.

iMerica added a commit to iMerica/Zappa that referenced this issue Mar 15, 2017
As a brand new Zappa user, I wasted ~2 hours migrating from a local
docker based environment to Virtual Env only to find out Zappa doesn't
support 3.5  :-(.

It looks like others have experienced the same thing too[0], so this PR is
meant to the be a bare minimum notice that Python 3x is not supported.
Down the road, it would be helpful to have a `zappa doctor` type command
to validate/troubleshoot this stuff early on.

Nonetheless, I'm still excited about this project so keep up the good
work!

[0] Miserlou#6
@c22
Copy link

c22 commented Apr 19, 2017

See #793

@Miserlou
Copy link
Owner

Python3 support has arrived! Try it out in 0.41.0! Please report any bugs you find! Nothing is guaranteed but it Works For Me™!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests