Skip to content
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

Skip solver at install time #559

Merged
merged 6 commits into from
Sep 8, 2022
Merged

Conversation

jaimergp
Copy link
Contributor

@jaimergp jaimergp commented Aug 30, 2022

Description

Comes from and closes #541 (read the issue for more details)

I checked using just --no-deps as an install flag, and while the docs hint that it skips the dependency checks... what it actually does is to perform a full solve, and then trim the dependencies from the graph.

So instead I am opting for a feature already present in conda: @EXPLICIT installs using the remote URLs. Since the repodata and channel cache is mocked already to make the previous method work, we get almost everything for free.

Basically, constructor invokes conda install --offline --file <file>, with this file:

tzdata==2022a=hda174b7_0
ca-certificates==2022.07.19=hca03da5_0
libffi==3.4.2=hc377ac9_4
openssl==1.1.1q=h1a28f6b_0
zlib==1.2.12=h5a0b063_2
setuptools==63.4.1=py310hca03da5_0
certifi==2022.6.15=py310hca03da5_0
sqlite==3.39.2=h1058600_0
pip==22.1.2=py310hca03da5_0
ncurses==6.3=h1a28f6b_3
readline==8.1.2=h1a28f6b_1
python==3.10.4=hbdb9e5c_0
xz==5.2.5=h1a28f6b_1
wheel==0.37.1=pyhd3eb1b0_0
tk==8.6.12=hb8d0fd4_0
libcxx==12.0.0=hf6beb65_1
bzip2==1.0.8=h620ffc9_4

What we are doing in this PR is changing the file syntax to:

# platform: osx-arm64
@EXPLICIT
https://conda.anaconda.org/pkgs/main/noarch/tzdata-2022a-hda174b7_0.tar.bz2#<md5hash>
https://conda.anaconda.org/pkgs/main/osx-arm64/ca-certificates-2022.07.19-hca03da5_0.tar.bz2#<md5hash>
https://conda.anaconda.org/pkgs/main/osx-arm64/libffi-3.4.2-hc377ac9_4.tar.bz2#<md5hash>
https://conda.anaconda.org/pkgs/main/osx-arm64/openssl-1.1.1q-h1a28f6b_0.tar.bz2#<md5hash>
https://conda.anaconda.org/pkgs/main/osx-arm64/zlib-1.2.12-h5a0b063_2.tar.bz2#<md5hash>
https://conda.anaconda.org/pkgs/main/osx-arm64/setuptools-63.4.1-py310hca03da5_0.tar.bz2#<md5hash>
https://conda.anaconda.org/pkgs/main/osx-arm64/certifi-2022.6.15-py310hca03da5_0.tar.bz2#<md5hash>
https://conda.anaconda.org/pkgs/main/osx-arm64/sqlite-3.39.2-h1058600_0.tar.bz2#<md5hash>
https://conda.anaconda.org/pkgs/main/osx-arm64/pip-22.1.2-py310hca03da5_0.tar.bz2#<md5hash>
https://conda.anaconda.org/pkgs/main/osx-arm64/ncurses-6.3-h1a28f6b_3.tar.bz2#<md5hash>
https://conda.anaconda.org/pkgs/main/osx-arm64/readline-8.1.2-h1a28f6b_1.tar.bz2#<md5hash>
https://conda.anaconda.org/pkgs/main/osx-arm64/python-3.10.4-hbdb9e5c_0.tar.bz2#<md5hash>
https://conda.anaconda.org/pkgs/main/osx-arm64/xz-5.2.5-h1a28f6b_1.tar.bz2#<md5hash>
https://conda.anaconda.org/pkgs/main/noarch/wheel-0.37.1-pyhd3eb1b0_0.tar.bz2#<md5hash>
https://conda.anaconda.org/pkgs/main/osx-arm64/tk-8.6.12-hb8d0fd4_0.tar.bz2#<md5hash>
https://conda.anaconda.org/pkgs/main/osx-arm64/libcxx-12.0.0-hf6beb65_1.tar.bz2#<md5hash>
https://conda.anaconda.org/pkgs/main/osx-arm64/bzip2-1.0.8-h620ffc9_4.tar.bz2#<md5hash>

This still goes through the transaction API, and the records are sorted in topological order, so we should be good.

Checklist - did you ...

  • Add a file to the news directory (using the template) for the next release's release notes?
  • Add / update necessary tests?
  • Add / update outdated documentation?

@conda-bot conda-bot added the cla-signed [bot] added once the contributor has signed the CLA label Aug 30, 2022
@hmaarrfk
Copy link
Contributor

Does this allow users to update their environments in the future?

@jaimergp
Copy link
Contributor Author

It's like installing a conda-locked environment from scratch.

With the exclude option enabled, the environment will be deemed "inconsistent" (same as when you do conda remove --force <pkg>) and a further operation on the conda environment might bring it back, though.

@jaimergp jaimergp linked an issue Aug 30, 2022 that may be closed by this pull request
@jaimergp jaimergp marked this pull request as ready for review September 1, 2022 07:57
@jaimergp jaimergp requested a review from a team as a code owner September 1, 2022 07:57
Copy link
Contributor

@hoechenberger hoechenberger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Very clever approach

@hmaarrfk
Copy link
Contributor

hmaarrfk commented Sep 1, 2022

Do you think this will solve issues with users having an existing .condarc file that specifies different channels? We've been having lots of complaints at Miniforge regarding old installations stopping new installs due to lingering .condarc files

@jaimergp
Copy link
Contributor Author

jaimergp commented Sep 1, 2022

Yes, it will alleviate solver-derived problems because this solution bypasses it entirely. It might still suffer from other configuration keys, but I can't think of any examples right now.

We do need better condarc isolation for conda-standalone in general, but that's separate issue (#542) we need to solve at the conda level first (my idea is to expose the CONDARC_SEARCH_PATH constant as a context key).

@jaimergp
Copy link
Contributor Author

jaimergp commented Sep 7, 2022

Any other comments @conda/constructor? I will merge later this week.

@@ -5,6 +5,8 @@ channels:
- http://repo.anaconda.com/pkgs/main/
specs:
- python
exclude: # [unix]
- tk # [unix]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is interesting as a use case.

@jaimergp jaimergp merged commit 4a7dafa into conda:main Sep 8, 2022
@jaimergp
Copy link
Contributor Author

jaimergp commented Sep 8, 2022

Thanks everybody!

@EisW
Copy link
Contributor

EisW commented Feb 24, 2023

The generated pkgs/envs.txt does not honour info['channel_remap'], so the generated installer fails for locally built channels, by reclaiming the path of the package from the environment running constructor.

The problem seems in preconda.py.

Files pkgs/urls.txt and pkgs/urls are written using get_final_url(info, url) (within all_final_urls_md5s --> this honours channel_remap; but pkgs/envs_txt uses info["_urls"] directly.

You have the remap info already in final_urls_md5s, so the solution -hopefully- is as simple as:

Replace

    # base environment file used with conda install --file
    # (list of specs/dists to install)
    write_env_txt(info, dst_dir, info["_urls"])

with

    # base environment file used with conda install --file
    # (list of specs/dists to install)
    write_env_txt(info, dst_dir, final_urls_md5s)

Equal change is required for sub environment:

replace

        write_env_txt(info, env_dst_dir, env_info["_urls"])

with

        write_env_txt(info, env_dst_dir, env_urls_md5)

==> generated installer than works in my cases

@EisW
Copy link
Contributor

EisW commented Mar 13, 2023

Is it possible to ping #656?
Meanwhile I signed the CLA, but do not know the next step ...

@github-actions github-actions bot added the locked [bot] locked due to inactivity label Mar 13, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla-signed [bot] added once the contributor has signed the CLA locked [bot] locked due to inactivity
Projects
Archived in project
6 participants