In the OP, the cause is that the file name is not correctly quoted i.e. it should be conda env create -f "Python 310.yml"
—the quote is needed here because the file name contains a space.
However, this specific error message
SpecNotFound: Invalid name, try the format: user/package
can be raised by a number of reasons.
See conda env create gives confusing message if environment file does not exist and name is given · Issue #11839 · conda/conda (only for old conda versions):
conda env create -n envname -f missing.yml
, then the error message will be seen, while the root cause is missing.yml
doesn't exist.conda env create -n envname
, this is equivalent to conda env create -n envname -f environment.yml
, so if environment.yml
doesn't exist then you get the same error message.If you want to create an empty environment, refer to Create empty conda environment . In particular, in certain conda
versions, conda create -n envname
works, which is likely why many users find the top-voted answer helpful.