-
Notifications
You must be signed in to change notification settings - Fork 71
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
Pinning python version in the created environment #114
Comments
I added an extra CI step for now:
|
Hi @jaimergp, thanks for the thorough report and explanation. This is indeed an issue I was worrying some day will happen :), having the loose python version is not a guarantee (in very specific environments) We could look at and test https://docs.conda.io/projects/conda/en/latest/configuration.html
We could also inject the dependency on the yaml file. If no yaml file is used, well then it means the user is in charge of intaling hs things.
Yeah that is a very odd behavior... and still there... conda/conda#9016 A pin is a pin, and specified in a file there is no reason for it to be ignored., unless
Can't think of one either, so yes either pin + updating the yaml file by injecting the |
If your yaml explicitly doesn't agree with the python-version, yeah it'll
be hard. Updating is reasonable, though as #107 already does this to avoid
the extra solve.
Quick fix against v2 might be to add a condarc and set a few things, but at
least:
freezeInstalled: true
This is probably more drastic than needed, and may have other side effects.
But if it works, we could raise it to an action input.
In the future, being able to set ALL of condarc YAML directly in "with"
might be useful, and we could get rid of a lot of one-off inputs.
|
Hi @bollwyvl thanks for the input. I prefer exposing one off options than the yaml in yaml option. These options are fine as they are conda config options so except for the "complex" ones the rest should probably be exposed to be used in the with: Unless I did not understand things correctly 🙃 |
My point is: there are over a hundred condarc options, some of which are
complex types (e.g objects, ordered lists). actions.yml is a pretty poor
specification language, even weaker than JSON Schema, and we do very little
checking on them _anyhow_ because everything comes in as "a string".
So, as a user, to figure out what to type, first you have to check our docs
(maybe) for the name-mangled version, and maybe if we do, you have to use
commas to separate things. if we don't support it, then maybe go read the
conda docs for _another_ name, and the actual documentation of the value,
write a file, set _another_ key, etc.
Just saying, "go read the conda docs" and "write YAML like you find there"
might be easier and more robust over time. We even already have a YAML
parser sitting around!
Further, skipping the conda cli, and just writing the condarc directly,
will avoid weirdness like doing the channels in reverse order, and allow
for the complex keys.
But of course, on v2, we can't deprecate our special snowflakes... v3
could add (one) warning, and v4 could purge them... But we might just be
stuck with them.
|
Ok I understood correctly :-p
True, may be extra work on our side to maintain but providing options, keeps providing the best UX and that is important too. |
Whew, "best UX" would likely be a whole shooting match of gathering a bunch of observational data (e.g. survey, poll, etc). |
As of https://github.com/conda-incubator/setup-miniconda/blob/master/src/env/yaml.ts#L44 This should save us both the initial env spin-up, as well as only consider your new, confected environment, in this case with We should probably add a test for this scenario. |
Just checking @bollwyvl, is this solved by the latest work you did? |
Yeah, the one-before-last-of-107 does it with the patched yaml, so just one
solve. The test may not be complete, we should probably add an env.yml with
a python, and verify it overloads it.
|
I meet the same problems in win10 conda64 python3.8 & python 3.9,the pinned file in conda-meta folder was ignoreed or overrided, I hope there will be a good solution |
Just ran into a weird issue. Some complex environment files will happily downgrade (and I guess also upgrade) Python versions to solve the environment.
, where teachopencadd.yml is this file.
That example above will downgrade Python to 3.8, silently! As a result, my CI branch is NOT testing Python 3.9 at all! See this in live action here.
To avoid that problem (there's no conda-env flag to avoid that behavior), I suggest pinning Python in that environment with
Even with that pinning, conda env STILL ignores that but at least a warning is now shown:
We might want to catch that warning and thrown an error instead because this kind of behavior in a CI context is very unexpected.
Alternatively, we might want to check the output of
python -V
once everything is installed and see if it matchespython-version
, but I think that's a bit more complicated?Question is: should we always pin Python if
python-version
was specified? I can't think of any example where not doing this would lead to surprising behaviour, but happy to discuss!The text was updated successfully, but these errors were encountered: