-
Notifications
You must be signed in to change notification settings - Fork 7
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
Using unified conda-lock file in postBuild for reproducible conda environment #14
base: main
Are you sure you want to change the base?
Conversation
So that repo2docker doesn't use it to build the docker image.
Minor version updates to fix `mamba` solver.
/condalock |
Handle both conda and pip dependencies by changing from the old explicit conda-lock (<1.0) format to the newer unified format. Deleting conda-linux-64.lock and replacing it with a placeholder conda-lock.yml for now.
So that the /condalock slash command works.
/condalock |
…ent.yml" This reverts commit 95d8ec8.
Need a proper placeholder conda-lock.yml to prevent `AttributeError: 'NoneType' object has no attribute 'pop'` when running `conda-lock lock`.
The `--file` option doesn't actually work, even though it's documented like so.
Update instructions on how to add or update dependencies in the cryocloud docker image. Specifically, the part where `conda-lock` is used for a fully reproducible conda environment.
Needed to avoid `Warning: found pip deps, but conda-lock was installed without pypi support. pip dependencies will not be included in the lock file`. See https://conda-incubator.github.io/conda-lock/getting_started.
No more explicit conda-linux-64.lock, just the unified conda-lock.yml.
Follow the default environment name on the JupyterHub rather than the conda environment's name.
@@ -42,12 +42,12 @@ jobs: | |||
|
|||
# Install conda-lock library | |||
- name: Install conda-lock | |||
run: pip install conda-lock | |||
run: pip install conda-lock[pip_support]==1.0.5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using conda-lock 1.0.5 instead of the latest 1.2.1 to keep the relative file paths intact. See #15.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, might need to upgrade to conda-lock 1.2.1 actually, because it contains important bugfixes related to pip dependency hashes. E.g. see https://github.com/CryoInTheCloud/hub-image/actions/runs/3578432352/jobs/6018581680#step:5:4747
ERROR:root:ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the package versions, please update the hashes. Otherwise, examine the package contents carefully; someone may have tampered with them.
ERROR:root: fastjsonschema@ https://files.pythonhosted.org/packages/e4/be/cf1b876348070a23cb0c3ebfee7a452ad3a91b07b456dade3bd514656009/fastjsonschema-2.16.2-py3-none-any.whl#md5=None from https://files.pythonhosted.org/packages/e4/be/cf1b876348070a23cb0c3ebfee7a452ad3a91b07b456dade3bd514656009/fastjsonschema-2.16.2-py3-none-any.whl#md5=None (from -r /tmp/tmpn_q_dp50 (line 1)):
ERROR:root: Expected md5 None
ERROR:root: Got fff77553c8612b49c8782a5233541199
ERROR:root:
ERROR:root:
ERROR:root:ERROR conda.cli.main_run:execute(49): `conda run pip install --no-deps -r /tmp/tmpn_q_dp50` failed. (See above for error)
Traceback (most recent call last):
File "/srv/conda/envs/notebook/bin/conda-lock", line 8, in <module>
File "/srv/conda/envs/notebook/lib/python3.7/site-packages/click/core.py", line 1130, in __call__
File "/srv/conda/envs/notebook/lib/python3.7/site-packages/click/core.py", line 1055, in main
File "/srv/conda/envs/notebook/lib/python3.7/site-packages/click/core.py", line 1657, in invoke
File "/srv/conda/envs/notebook/lib/python3.7/site-packages/click/core.py", line 1404, in invoke
File "/srv/conda/envs/notebook/lib/python3.7/site-packages/click/core.py", line 760, in invoke
File "/srv/conda/envs/notebook/lib/python3.7/site-packages/click/decorators.py", line 26, in new_func
File "/srv/conda/envs/notebook/lib/python3.7/site-packages/conda_lock/conda_lock.py", line 1268, in install
File "/srv/conda/envs/notebook/lib/python3.7/site-packages/conda_lock/conda_lock.py", line 219, in do_conda_install
File "/srv/conda/envs/notebook/lib/python3.7/site-packages/conda_lock/invoke_conda.py", line 131, in _invoke_conda
poetry.utils._compat.CalledProcessError: Command '['/srv/conda/bin/mamba', 'run', '--name', 'notebook', 'pip', 'install', '--no-deps', '-r', '/tmp/tmpn_q_dp50']' returned non-zero exit status 1.
Removing intermediate container 4d439bce016f
The command '/bin/sh -c ./postBuild' returned a non-zero code: 1
#!/bin/bash | ||
set -eux | ||
pip install conda-lock[pip_support]==1.0.5 | ||
conda-lock install --mamba --name notebook conda-lock.yml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if it matters, but I've set the conda environment name as notebook
here instead of cryocloud
, because that's the default conda environment name on the CryoCloud JupyterHub.
Also drop the pip_support extras since poetry has been vendored in conda-lock 1.2.0.
Using GitHub Actions hosted runner filepath.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
couple comments, otherwise this looks great!
Co-Authored-By: Yuvi Panda <[email protected]>
Hitting into this bug with INFO:root:Collecting pywinpty@ https://files.pythonhosted.org/packages/22/77/59645ee028f410ef1d582fc2923d2cb61016ed38e6ae5022f405227ca2ad/pywinpty-2.0.9.tar.gz#sha256=01b6400dd79212f50a2f01af1c65b781290ff39610853db99bf03962eb9a615f
INFO:root: Downloading pywinpty-2.0.9.tar.gz (26 kB)
INFO:root: Installing build dependencies: started
INFO:root: Installing build dependencies: finished with status 'done'
INFO:root: Getting requirements to build wheel: started
INFO:root: Getting requirements to build wheel: finished with status 'done'
INFO:root: Preparing metadata (pyproject.toml): started
INFO:root: Preparing metadata (pyproject.toml): finished with status 'error'
INFO:root:
ERROR:root: error: subprocess-exited-with-error
ERROR:root:
ERROR:root: × Preparing metadata (pyproject.toml) did not run successfully.
ERROR:root: │ exit code: 1
ERROR:root: ╰─> [6 lines of output]
ERROR:root:
ERROR:root: Cargo, the Rust package manager, is not installed or is not on PATH.
ERROR:root: This package requires Rust and Cargo to compile extensions. Install it through
ERROR:root: the system's package manager or via https://rustup.rs/
ERROR:root:
ERROR:root: Checking for Rust toolchain....
ERROR:root: [end of output]
ERROR:root:
ERROR:root: note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR:root:error: metadata-generation-failed
ERROR:root:
ERROR:root:× Encountered error while generating package metadata.
ERROR:root:╰─> See above for output.
ERROR:root:
ERROR:root:note: This is an issue with the package mentioned above, not pip.
ERROR:root:hint: See above for details.
ERROR:root:
ERROR:root:ERROR conda.cli.main_run:execute(49): `conda run pip install --no-deps -r /tmp/tmpp9s90hbc` failed. (See above for error)
Traceback (most recent call last):
File "/srv/conda/envs/notebook/bin/conda-lock", line 8, in <module>
File "/srv/conda/envs/notebook/lib/python3.7/site-packages/click/core.py", line 1130, in __call__
File "/srv/conda/envs/notebook/lib/python3.7/site-packages/click/core.py", line 1055, in main
File "/srv/conda/envs/notebook/lib/python3.7/site-packages/click/core.py", line 1657, in invoke
File "/srv/conda/envs/notebook/lib/python3.7/site-packages/click/core.py", line 1404, in invoke
File "/srv/conda/envs/notebook/lib/python3.7/site-packages/click/core.py", line 760, in invoke
File "/srv/conda/envs/notebook/lib/python3.7/site-packages/click/decorators.py", line 26, in new_func
File "/srv/conda/envs/notebook/lib/python3.7/site-packages/conda_lock/conda_lock.py", line 1288, in install
File "/srv/conda/envs/notebook/lib/python3.7/site-packages/conda_lock/conda_lock.py", line 220, in do_conda_install
File "/srv/conda/envs/notebook/lib/python3.7/site-packages/conda_lock/invoke_conda.py", line 131, in _invoke_conda
conda_lock._vendor.poetry.utils._compat.CalledProcessError: Command '['/srv/conda/bin/mamba', 'run', '--name', 'notebook', 'pip', 'install', '--no-deps', '-r', '/tmp/tmpp9s90hbc']' returned non-zero exit status 1.
Removing intermediate container f13e567c749f
The command '/bin/sh -c ./postBuild' returned a non-zero code: 1 This might take a while to resolve on conda-lock, and I'm not sure if there's a good workaround. I think it'll be best if I cherry-pick 90fe9f6 into a separate PR so that #13 can proceed. |
Add back in the 'start'` file to `.github/workflows/build.yaml`.
Replaced by conda-linux.yml.
Marking as draft again as the bug at #14 (comment) isn't fixed yet, waiting on conda-forge/staged-recipes#21369 🤞 (which is itself waiting on a few other things). |
conda-forge/staged-recipes#21369 might take a while I think :D Does this mean @weiji14 this repo can only install from conda and can't install from pip? |
Yes, only via mamba/conda. Using |
Hmm, that seems a major limitation going forward honestly :| PyPI will always have things that won't be on conda-forge I think. Do you know if conda-lock might resolve this, or is it a non-goal? |
The issue is tracked in conda/conda-lock#236, and actually, |
AAAAAAH, apologies @weiji14 for not following links - and thank you so much for clarifying this is desktop-server specific! |
Ready for review @yuvipanda! I've updated to Once this is merged, and tested a few times, we should be able to move ahead with the |
Co-authored-by: Matt Fisher <[email protected]>
Conflicts: conda-linux-64.lock
Bumps [conda-lock](https://github.com/conda/conda-lock) from 2.0.0 to 2.1.0. - [Release notes](https://github.com/conda/conda-lock/releases) - [Commits](conda/conda-lock@v2.0.0...v2.1.0)
Note to self. A 'conda-lock.yml' file was added in #122 already, though the builds which rely on repo2docker are technically still using 'environment.yml' so not 100% reproducible yet hub-image/.github/workflows/build.yaml Lines 35 to 36 in e0ad226
Maybe wait for repo2docker to support conda-lock natively (jupyterhub/repo2docker#1312), and then the 'postBuild' hack here can go away. |
Towards better reproducibility of the conda environment. Done by having a custom
conda-lock
command inpostBuild
, rather than lettingrepo2docker
build directly from anenviroment.yml
file. Suggestion from #11 (comment)TODO:
Addresses #11. Closes #15.