Skip to content

Conda support#108

Open
mathieu1 wants to merge 14 commits intoMiserlou:masterfrom
mathieu1:conda_support
Open

Conda support#108
mathieu1 wants to merge 14 commits intoMiserlou:masterfrom
mathieu1:conda_support

Conversation

@mathieu1
Copy link
Copy Markdown
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
Copy Markdown

Coverage Status

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

@coveralls
Copy link
Copy Markdown

Coverage Status

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

@coveralls
Copy link
Copy Markdown

Coverage Status

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

@mathieu1
Copy link
Copy Markdown
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
Copy Markdown

Coverage Status

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

@Miserlou
Copy link
Copy Markdown
Owner

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

Comment 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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown

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
Copy Markdown
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
Copy Markdown

@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
Copy Markdown

Coverage Status

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

@kalefranz
Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown

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
Copy Markdown
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
Copy Markdown

yoavram commented Dec 19, 2016

+1

@hello-di
Copy link
Copy Markdown

+1 for conda support!

Comment thread zappa/zappa.py
print("Zappa requires an active virtual or conda environment.")
quit()

if conda_mode:
Copy link
Copy Markdown

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
Copy Markdown
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.

Comment thread zappa/zappa.py Outdated
conda_mode = False
if 'VIRTUAL_ENV' in os.environ:
venv = os.environ['VIRTUAL_ENV']
elif 'CONDA_ENV_PATH' in os.environ:
Copy link
Copy Markdown

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

Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown

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

@coveralls
Copy link
Copy Markdown

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
Copy Markdown

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
Copy Markdown

ghost commented Jul 2, 2019

+1 for Conda support

@guilhermeprokisch
Copy link
Copy Markdown

+1 Conda Support

@mwos-sl
Copy link
Copy Markdown

mwos-sl commented Sep 19, 2019

+1

2 similar comments
@nagmo
Copy link
Copy Markdown

nagmo commented Nov 7, 2019

+1

@isthisthat
Copy link
Copy Markdown

+1

@jhulten
Copy link
Copy Markdown

jhulten commented Feb 21, 2020

Would love to see these merge conflicts resolved...

@xzenggit
Copy link
Copy Markdown

xzenggit commented Apr 1, 2020

+1 for conda support

1 similar comment
@anibalsolon
Copy link
Copy Markdown

+1 for conda support

@willyraedy
Copy link
Copy Markdown

+1 conda support

@sc305495
Copy link
Copy Markdown

+1 for conda support

@digitizdat
Copy link
Copy Markdown

+1 conda support please

@hannonq
Copy link
Copy Markdown

hannonq commented Sep 28, 2020

+1 conda support

1 similar comment
@santiag0m
Copy link
Copy Markdown

+1 conda support

@andresinostroza13
Copy link
Copy Markdown

+1 conda support

3 similar comments
@alfredvijender
Copy link
Copy Markdown

+1 conda support

@MichelML
Copy link
Copy Markdown

+1 conda support

@gbossy
Copy link
Copy Markdown

gbossy commented Sep 23, 2021

+1 conda support

@salomonMuriel
Copy link
Copy Markdown

Please conda support

Copy link
Copy Markdown

@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
Copy Markdown

+1

@codeAshu
Copy link
Copy Markdown

codeAshu commented Oct 4, 2022

+1 for conda support

@rudralabs
Copy link
Copy Markdown

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

@LuizFDuarte
Copy link
Copy Markdown

+1 for conda support

@drius-22
Copy link
Copy Markdown

+100 conda support

@KNehe
Copy link
Copy Markdown

KNehe commented Jul 10, 2023

+1 conda support

@monkut
Copy link
Copy Markdown

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.