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

KeyError: 'pkgs_dirs' #732

Closed
valeriupredoi opened this issue Oct 15, 2024 · 6 comments · Fixed by #733
Closed

KeyError: 'pkgs_dirs' #732

valeriupredoi opened this issue Oct 15, 2024 · 6 comments · Fixed by #733

Comments

@valeriupredoi
Copy link

Hi @maresb Ben, we're seeing this failure at creating a linux64 conda lock file:

Traceback (most recent call last):
  File "/home/runner/miniconda3/envs/esmvaltool-fromlock/bin/conda-lock", line 10, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/runner/miniconda3/envs/esmvaltool-fromlock/lib/python3.12/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/miniconda3/envs/esmvaltool-fromlock/lib/python3.12/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/home/runner/miniconda3/envs/esmvaltool-fromlock/lib/python3.12/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/miniconda3/envs/esmvaltool-fromlock/lib/python3.12/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/miniconda3/envs/esmvaltool-fromlock/lib/python3.12/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/miniconda3/envs/esmvaltool-fromlock/lib/python3.12/site-packages/click/decorators.py", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/miniconda3/envs/esmvaltool-fromlock/lib/python3.12/site-packages/conda_lock/conda_lock.py", line 1403, in lock
    lock_func(
  File "/home/runner/miniconda3/envs/esmvaltool-fromlock/lib/python3.12/site-packages/conda_lock/conda_lock.py", line 1111, in run_lock
    make_lock_files(
  File "/home/runner/miniconda3/envs/esmvaltool-fromlock/lib/python3.12/site-packages/conda_lock/conda_lock.py", line 393, in make_lock_files
    fresh_lock_content = create_lockfile_from_spec(
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/miniconda3/envs/esmvaltool-fromlock/lib/python3.12/site-packages/conda_lock/conda_lock.py", line 836, in create_lockfile_from_spec
    deps = _solve_for_arch(
           ^^^^^^^^^^^^^^^^
  File "/home/runner/miniconda3/envs/esmvaltool-fromlock/lib/python3.12/site-packages/conda_lock/conda_lock.py", line 748, in _solve_for_arch
    conda_deps = solve_conda(
                 ^^^^^^^^^^^^
  File "/home/runner/miniconda3/envs/esmvaltool-fromlock/lib/python3.12/site-packages/conda_lock/conda_solver.py", line 159, in solve_conda
    dry_run_install = solve_specs_for_arch(
                      ^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/miniconda3/envs/esmvaltool-fromlock/lib/python3.12/site-packages/conda_lock/conda_solver.py", line 383, in solve_specs_for_arch
    return _reconstruct_fetch_actions(conda, platform, dryrun_install)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/miniconda3/envs/esmvaltool-fromlock/lib/python3.12/site-packages/conda_lock/conda_solver.py", line 277, in _reconstruct_fetch_actions
    for d in json.loads(
             ^^^^^^^^^^^
KeyError: 'pkgs_dirs'

Unfortunately I can't reproduce this on my local machine (ie all works fine, with same dependencies), but it is 100% reproducible on the Github Actions machine. Any clues? Many thanks in advance! 🍻

@maresb
Copy link
Contributor

maresb commented Oct 15, 2024

Hey there @valeriupredoi! Working on an OSS project with a visible workflow makes this a whole lot easier than usual to diagonse! 😁

I'd recommend adding a workflow dispatch trigger to give you the following button:

Image

I think this is probably due to Micromamba v2. Experiment in progress at
ESMValGroup/ESMValTool#3773

@valeriupredoi
Copy link
Author

ah interesting, cheers, Ben! Will go there now 🍺

@maresb
Copy link
Contributor

maresb commented Oct 15, 2024

It was indeed v2: ESMValGroup/ESMValTool#3771

I'm a bit concerned about the KeyError reported above. This needs more investigation.

@maresb maresb changed the title issue with click and conda-lock on Github Actions machine KeyError: 'pkgs_dirs' Oct 16, 2024
@maresb
Copy link
Contributor

maresb commented Oct 16, 2024

Thanks so much @valeriupredoi for the bug report! It turns out it was an obscure bug in conda-lock, triggered from a side-effect of the upgrade. In this case mamba v2 was not at fault. Once I release conda-lock v3 you can unpin mamba.

@valeriupredoi
Copy link
Author

excellent @maresb - glad I could help, and well done for figuring out what the actual problem was! Many thanks, I will make a note for us, so we unpin mamba as soon as v3 comes out. Also, close this then? 🍺

@valeriupredoi
Copy link
Author

ah nvmd, just saw #733 is still open 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants