conda-incubator / conda-project

Tool for encapsulating, running, and reproducing projects with Conda environments
https://conda-incubator.github.io/conda-project/
BSD 3-Clause "New" or "Revised" License
28 stars 11 forks source link

Some conda errors do not have a 'messages' key #133

Closed AlbertDeFusco closed 1 year ago

AlbertDeFusco commented 1 year ago

Consider the following condarc

solver: [fake]

This leads conda-project lock to report

...
    raise CalledProcessError(
conda_lock._vendor.poetry.utils._compat.CalledProcessError: Command '['/Users/adefusco/Applications/miniconda3/bin/conda', 'create', '--prefix', '/var/folders/cg/wyhz9cvx06vdt65k8tr31trc0000gp/T/tmppbqxemhx/prefix', '--dry-run', '--json', '--override-channels', '--channel', 'defaults', '--channel', 'file:///var/folders/cg/wyhz9cvx06vdt65k8tr31trc0000gp/T/tmpxmr8mbbv']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/adefusco/Applications/miniconda3/bin/conda-project", line 10, in <module>
    sys.exit(main())
  File "/Users/adefusco/Applications/miniconda3/lib/python3.9/site-packages/conda_project/cli/main.py", line 376, in main
    retcode = parse_and_run(args)
  File "/Users/adefusco/Applications/miniconda3/lib/python3.9/site-packages/conda_project/cli/main.py", line 364, in parse_and_run
    return parsed_args.func(parsed_args)
  File "/Users/adefusco/Applications/miniconda3/lib/python3.9/site-packages/conda_project/cli/commands.py", line 46, in wrapper
    ret = func(args)
  File "/Users/adefusco/Applications/miniconda3/lib/python3.9/site-packages/conda_project/cli/commands.py", line 96, in lock
    env.lock(force=args.force, verbose=True)
  File "/Users/adefusco/Applications/miniconda3/lib/python3.9/site-packages/conda_project/project.py", line 584, in lock
    msg = output["message"].replace(
KeyError: 'message'

which obscures the real error, which itself is isn't super helpful.

    AttributeError: 'YamlRawParameter' object has no attribute 'typify'

`$ /Users/adefusco/Applications/miniconda3/bin/conda create -p ./broken --dry-run`

  environment variables:
conda info could not be constructed.
KeyError('pkgs_dirs')

An unexpected error has occurred. Conda has prepared the above report.

If submitted, this report will be used by core maintainers to improve
future releases of conda.
Would you like conda to send this report to the core maintainers? [y/N]: