Skip to content

conda should not allow mixing different types of input files when creating an environment #14684

@soapy1

Description

@soapy1

Checklist

  • I added a descriptive title
  • I searched open reports and couldn't find a duplicate

What happened?

conda create and install commands support a --file argument which is a list of files to install. Files can either be explicit files or regular text files. If there is a mix of --files that specify regular packages and explicit package then this will produce a ParseError. For example, consider the following two environment files:

env1.txt (explicit file)

@EXPLICIT
https://repo.anaconda.com/pkgs/main/linux-64/_libgcc_mutex-0.1-main.conda
https://repo.anaconda.com/pkgs/main/linux-64/ca-certificates-2025.2.25-h06a4308_0.conda

env2.txt (regular text file)

numpy

Running a conda create against these files individually works. Providing both files as arguments produces an error:

$ conda create -n testenv-mixed --file env1.txt --file env2.txt 

ParseError: Could not parse explicit URL: file:///home/sophia/projects/conda/numpy

It is correct to raise an error for this situation, but it would be helpful if the error more accurately described what is going wrong and how to fix it. For example, it would be better for the result to be something like

$ conda create -n testenv-mixed --file env1.txt --file env2.txt 

CondaError: can not mix `file` types

env1.txt is found to be an explicit type file
env2.txt is found to be requirements.txt type file

Checklist

Metadata

Metadata

Assignees

Labels

source::contributorcreated by a frequent contributortype::bugdescribes erroneous operation, use severity::* to classify the type

Type

No type

Projects

Status

🏁 Done

Status

TODO 📬

Status

Done 💪🏾

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions