rules_conda icon indicating copy to clipboard operation
rules_conda copied to clipboard

Add conda bin to built apps

Open leriel opened this issue 1 year ago • 0 comments

Hello, and thanks a lot for your awesome work with conda rules!

Unfortunately, for some conda packages, combination of py_runtime+interpreter pointing to conda python will not be enough. As i understand, conda packages can be devided into at least three categories:

  1. require only python libs. This is a case covered by the original example. As long as a python script requiring such package is being ran by conda/env/bin/python, everything works. I believe conda packages that include .so/.dll fall under this category as well.
  2. require linux binaries. In some cases, a pip package relies on a certain binary being present in a system $PATH to be able to fully function. My PR adds possible solution along with one example of this case. Pikepdf usually handles set of image encodings inside a pdf, but as long as it encounters pdf with images coded with jbig2, it reaches out to a system jbig2dec executable to handle them.
  3. require full init script. Some binaries called by conda packages require certain config env vars present. For those, full conda activate is required. For example, for tesseract, this is init script:export TESSDATA_PREFIX=$CONDA_PREFIX/share/tessdata/. It can't be ran standalone, as it relies on $CONDA_PREFIX which comes from conda activate. This is much harder nut to crack and not covered by this PR, but i might be able to figure out something for this later on.

One other way to add conda bin to py_runtime path is to extend entire bootstrap_template, but that's a lot of code that would need to be kept in this repo and a huge lockdown, with need to update upstream. stub_shebang is still a lockdown but much smaller and so much easier to fix in an event of upstream change.

leriel avatar Oct 30 '23 15:10 leriel