features icon indicating copy to clipboard operation
features copied to clipboard

pip install -r requirements.txt in Python feature

Open davetapley opened this issue 2 years ago • 3 comments

I see #40 gave installJupyterlab to the Python feature.

Would you accept a PR to more broadly allow dependencies to be installed via pip's requirements.txt file?

Either optimistically installing if present (which would be a behavior change) and/or by adding an e.g. installRequirements option to enable / disable this behavior?

davetapley avatar Nov 02 '23 21:11 davetapley

... although I suppose this does depend on the file being available at build time, and I'm not sure if it would be?

davetapley avatar Nov 02 '23 21:11 davetapley

Hi 👋

@davetapley Have you looked at the Oryx Feature? This Feature will automatically install packages if requirements.txt file exists. It also installs other utils based on the project, the universal image makes use of this Feature for Oryx'x magic.

Look at microsoft/Oryx for more tool specific information. Let us know if this will be helpful for your use case, or happy to chat about alternatives.

samruddhikhandale avatar Nov 02 '23 23:11 samruddhikhandale

@samruddhikhandale thanks!

As I now understand: I wasn't getting Oryx behavior because I'm on Python 3.11.4, which isn't supported by Oryx. So, I feel like similar to ⬇️ this is another place where behavior changes where using Oryx or not, which is not great :
https://github.com/devcontainers/features/issues/746

~I'm still not quite sure how Oryx installs requirements.txt though, since that would necessarily have to run after the Codespace has checked out the code, which I assume happens after the build step.~

Edit: I just tried a Python version which does use Oryx to install, and it does not automatically install requirements.txt.

davetapley avatar Nov 08 '23 00:11 davetapley