snapcraft conda plug-in?

Didier Roche didrocks at
Thu Jun 16 08:15:12 UTC 2016

Hey Bill!

Thanks for joining the snapcraft unstoppable bandwagon :)

Le 15/06/2016 21:49, Bill Janssen a écrit :
> I've got a big package, multiple programs, that I assemble in one
> directory under /opt/goodstuff, using conda as the packaging system --
> the goodstuff directory tree is a conda 'env'.  It seems that this
> should be easy to re-package as a snap.  However, conda does a few
> things that have to be changed, or undone, for snap:
>   1) It mungs shebangs; that is, a header like "#!/usr/bin/env python"
>   gets changed to "#!/opt/goodstuff/bin/python".  I think that would
>   have to be undone; what snapcraft stage should that occur in?
>   2) It symlinks in some of the binaries; for example,
>   /opt/goodstuff/bin/conda is a symlink to /opt/conda/bin/conda.  Those
>   would have to be reified (copied), perhaps in the "pull" stage?
>   3) It rewrites RPATH on some platforms (OS X), but perhaps not on
>   Linux, I'll have to check.  That should be redone to accord with snap.

I think you are on the right path with this one: I would (apart if
Sergio and others have a better way), build my own "conda" plugin. This
one can specify "after: [other_part_list]", so that it can do those
kinds of changes in the other parts (parts/<part_name>/install/)
directory and impacting them. For renaming files and directories, you
can have a look at the filesets and reorg concepts from snapcraft

Maybe Sergio would have a better idea on how to solve those?

>   4) It's not a completely clean package.  There are some dependencies,
>   like "python-dbus", that are hard to build, and therefore installed
>   via apt-get.

You can either rebuild them directly as another part of your
snapcraft.yaml. As you say, some may be hard to build, you can use the
"stage-packages" stenza to declare a list of package to pull from the
ubuntu archives while building your snap (including its dependencies).
That should hopefully help you getting started!
> Seems to me that the way to this is with a conda plug-in for snapcraft
> that would take a conda env and package it; "copy" with fixes for conda.
> Any suggestions about this?  What would be a good plug-in to use as a
> template?

I would suggest to look at a simple plugin like the ant one :
(or copy plugin)

I hope this gives you a good head's up. Do not hesitate if you have any
further question or need help to ask around!

More information about the Snapcraft mailing list