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

Conda support #108

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open

Conda support #108

wants to merge 14 commits into from

Conversation

mathieu1
Copy link
Contributor

This is a reboot of #94 targetting the dev branch. Still WIP, discussion can start after some documentation is provided.

@mathieu1 mathieu1 mentioned this pull request May 24, 2016
7 tasks
@coveralls
Copy link

Coverage Status

Coverage decreased (-2.2%) to 74.816% when pulling ea78346 on mathieu1:conda_support into 1202044 on Miserlou:dev.

@coveralls
Copy link

Coverage Status

Coverage decreased (-2.2%) to 74.847% when pulling 618aa8e on mathieu1:conda_support into 1202044 on Miserlou:dev.

@coveralls
Copy link

Coverage Status

Coverage decreased (-2.3%) to 74.724% when pulling 2916e9e on mathieu1:conda_support into 1202044 on Miserlou:dev.

@mathieu1
Copy link
Contributor Author

mathieu1 commented May 27, 2016

Ok, the discussion can start. Here's the current status:

  • Implement condasupport, including full content of conda environment (not only python packages).
  • Make a conda package for zappa and for each of its dependencies (uploaded to my channel on anaconda.org). The current version of this branch is packaged under version 0.17.7.dev.
  • Create a repository (see mathieu1/zappa_conda) which serves both to test the current branch and can serve as an initial documentation for now, to help decide on the next steps.
  • Document how to use zappa with conda on other platforms than linux-64 (and discuss limitations, e.g. Windows doesn't have symlinks)
  • Work further on minifying conda packages. On this topic, available conda packages of numpy depend on large numerical optimization libraries (MKL, >100MB! or openblas, >10MB). This contributes to making it hard to fit other packages that depend on numpy such as pandas, scipy, scikit-learn, (although each of them is large on its own). A "noblas" version of numpy is underway, see Attempt at providing a noblas. conda-forge/numpy-feedstock#2

To start the discussion, here are a few questions/issues:

  • Given the advantages listed in Support conda environments #94 and the fact that it does not change any behavior for non-conda users, does this PR look viable for inclusion in Zappa? Should I explain/motivate further?
  • I am still unsure how to proceed with testing. The best I have in that direction is the above-mentioned repository, but it's hard to automate this testing from within zappa.
@coveralls
Copy link

Coverage Status

Coverage decreased (-2.6%) to 74.45% when pulling 75b98f6 on mathieu1:conda_support into 1202044 on Miserlou:dev.

@Miserlou
Copy link
Owner

This is really cool progress! Sorry I haven't been very responsive on this thread.

zappa/cli.py Outdated
exclude=self.zappa_settings[self.api_stage].get('exclude', [])
exclude=self.zappa_settings[self.api_stage].get('exclude', []),
exclude_conda_packages = self.zappa_settings[self.api_stage].get('exclude_conda_packages',
['pip','python','readline','sqlite','wheel', 'boto3', 'botocore'])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe openssl and tk (among other things) are included with miniconda as well. You probably won't want them in your lambda function either.

@mathom
Copy link
Collaborator

mathom commented Jul 6, 2016

As far as testing goes I'd recommend mocking and building out units vs trying to figure out how to make some AWS deployment for it.

Edit: testing packaging/unpackaging locally would probably be a good idea too.

@mathom
Copy link
Collaborator

mathom commented Jul 6, 2016

It might be useful to warn the end user if there are large packages in their conda environment, too. The limits can be found here: http://docs.aws.amazon.com/lambda/latest/dg/limits.html . Note that there's a compressed as well as an uncompressed limitation.

@smrtslckr
Copy link

Tried out the dev branch and did some tinkering. Could not get conda support to work for me. I'm going to stick with elastic beanstalk for now. Definitely, be back in the future when I have more time.

@sdementen
Copy link
Contributor

hello @mathieu1,
At the target, would the approach you are exploring/developing allow to develop within a conda environement on whatever Conda supported system (linux/windows/MacOS, 32/64 bit, ...) and then to package in a zip file the equivalent environment for the AWS image running behind AWS lambda ?
With the ability to choose "light" version to fit within AWS limits ?

@brendancol
Copy link

@mathieu1 @Miserlou this is super exciting.

@mathieu1 mathieu1 force-pushed the conda_support branch 2 times, most recently from 4047089 to 2707025 Compare November 27, 2016 16:29
@coveralls
Copy link

Coverage Status

Coverage decreased (-1.1%) to 77.094% when pulling 35618b0 on mathieu1:conda_support into bee2601 on Miserlou:dev.

@kalefranz
Copy link

Hey everyone. I'm the lead developer on the conda project right now. Just wanted to chime in and say I think this is awesome. I'll try to spend more time with this in the coming days. If there are any specific questions or things you are stuck on, please ask! Tagging @msarahan here too, who's the tech lead of the conda-build project.

@Miserlou
Copy link
Owner

Cool! Hey @kalefranz and @msarahan ! Thanks for stopping by, I would love to have your support on this awesome but neglected PR.

Please also feel free to stop by the Slack channel for discussion: https://slack.zappa.io/

@viksit
Copy link

viksit commented Dec 5, 2016

+1 here. I think the conda support for Zappa is going to be critical for those of us who want to deploy existing applications which rely on scientific computing libraries (numpy, tensorflow et al) which are already running in these environments. It's impossible to move them to a virtuaenv format given conda ships with platform compliant versions of the lower level C libraries that speed up their python wrappers.

@Miserlou
Copy link
Owner

Miserlou commented Dec 5, 2016

Zappa does support hundreds of those libraries already, however conda support would certainly improve that number. See more here: https://blog.zappa.io/posts/zappa-adds-support-for-manylinux-wheels

@yoavram
Copy link

yoavram commented Dec 19, 2016

+1

@hello-di
Copy link

+1 for conda support!

zappa/zappa.py Outdated
quit()

if conda_mode:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except for the precompiled_packages warning, why does this matter if its conda_mode or not?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It changes the way packaging works. In the standard virtualenv mode, zappa takes the site-packages folder of the virtualenv and possibly replaces some binaries using lambda-packages. In conda_mode zappa does a few things:

  1. Create a temporary copy of the conda environment for the following manipulations
  2. Remove excluded conda packages (like python itself)
  3. Move the site-packages folder to the root of the conda environment
  4. Zip up this moved site-packages along with all other remaining binaries in the conda environment.
zappa/zappa.py Outdated
if 'VIRTUAL_ENV' in os.environ:
venv = os.environ['VIRTUAL_ENV']
elif 'CONDA_ENV_PATH' in os.environ:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

envvar is now CONDA_PREFIX

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

may want to check both CONDA_ENV_PATH and CONDA_PREFIX while people have various versions of conda installed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this is fixed.

@bearnshaw
Copy link

+1 from me too. @Miserlou What needs to be done here to merge? Get the coverage to 100%?

@coveralls
Copy link

coveralls commented Jan 7, 2017

Coverage Status

Coverage increased (+1.6%) to 79.786% when pulling fd85cca on mathieu1:conda_support into bee2601 on Miserlou:dev.

@coveralls
Copy link

coveralls commented Jan 7, 2017

Coverage Status

Coverage increased (+1.6%) to 79.786% when pulling 03e8d95 on mathieu1:conda_support into bee2601 on Miserlou:dev.

@ghost
Copy link

ghost commented Jul 2, 2019

+1 for Conda support

@guilhermeprokisch
Copy link

+1 Conda Support

@mwos-sl
Copy link

mwos-sl commented Sep 19, 2019

+1

2 similar comments
@nagmo
Copy link

nagmo commented Nov 7, 2019

+1

@isthisthat
Copy link

+1

@jhulten
Copy link

jhulten commented Feb 21, 2020

Would love to see these merge conflicts resolved...

@xzenggit
Copy link

xzenggit commented Apr 1, 2020

+1 for conda support

1 similar comment
@anibalsolon
Copy link

+1 for conda support

@willyraedy
Copy link

+1 conda support

@sc305495
Copy link

+1 for conda support

@digitizdat
Copy link

+1 conda support please

@hannonq
Copy link

hannonq commented Sep 28, 2020

+1 conda support

1 similar comment
@santiag0m
Copy link

+1 conda support

@andresinostroza13
Copy link

+1 conda support

3 similar comments
@alfredvijender
Copy link

+1 conda support

@MichelML
Copy link

+1 conda support

@gbossy
Copy link

gbossy commented Sep 23, 2021

+1 conda support

@salomonMuriel
Copy link

Please conda support

Copy link

@TheFenrisLycaon TheFenrisLycaon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems okay to me. +1 for conda support !

@gustavorps
Copy link

+1

@codeAshu
Copy link

codeAshu commented Oct 4, 2022

+1 for conda support

@rudralabs
Copy link

Using alias z="export VIRTUAL_ENV='${CONDA_PREFIX}'; zappa" as a workaround for now

@LuizFDuarte
Copy link

+1 for conda support

@drius-22
Copy link

+100 conda support

@KNehe
Copy link

KNehe commented Jul 10, 2023

+1 conda support

@monkut
Copy link

monkut commented Jul 12, 2023

I noticed there are recent comments on this PR.
For those interested, zappa moved to zappa/Zappa years ago, and this, Miserlou/Zappa is no longer maintained.

I'm not sure what "conda support" would require from zappa, but I've reopend the related issue here:
zappa/Zappa#43

If anyone is interested enough to rebase the required changes in this PR against the zappa/Zappa master branch, we can review and consider it for inclusion.

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