Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Subtle mistake in conda create syntax will install a patch = 0 version of python

I’m creating a new conda environment with no additional packages.

It is interesting to note the difference in the python interpreter version installed with a small change in the conda create syntax…

conda create --name test python=3.11

…installs python 3.11.9 as expected.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

However but putting a double == rather than a single = when specifying the python version…

conda create --name test python==3.11

…does not throw any errors but creates an environment containing python 3.11.0, not the 3.11.9 that I was expecting.

This is consistent across 3.9, 3.10, 3.11 and 3.12, all install patch version 0.

I assume the double == is not the correct syntax and that this is not an intended behaviour but this is not caught and certainly confused me for a while.

Windows 10, conda version 23.11.0

>Solution :

It is definitely desired behavior and not a bug: Regarding the specification of version numbers, the Conda Cheat Sheet gives as an example:

Constraint type Specification Result
Fuzzy numpy=1.11 1.11.0, 1.11.1, 1.11.2, 1.11.18 etc.
Exact numpy==1.11 1.11.0

Similarly, as pointed out by @FlyingTeller, the section Conda Package Specification (subsection Command Line Match Spec Examples) of the conda documentation gives the following examples:

Example Meaning
conda install numpy=1.11 The fuzzy constraint numpy=1.11 matches 1.11, 1.11.0, 1.11.1, 1.11.2, 1.11.18, and so on.
conda install numpy==1.11 The exact constraint numpy==1.11 matches 1.11, 1.11.0, 1.11.0.0, and so on.

Arguably, this could be better documented with the conda install command itself, where, at the time of writing, no such documentation can be found.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading