Skip to content
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

Working dir changes conflicts with -r include in environment file #108

Closed
renefritze opened this issue Jan 9, 2023 · 9 comments
Closed
Labels
bug Something isn't working

Comments

@renefritze
Copy link

I'm trying to switch to this action from conda-incubator/setup-miniconda@v2 (with use-mamba: true).

I'm using this environment file which includes an requirements files with a relative path. This breaks if I try to use it directly with provision-with-micromamba since it seemingly changes the current working directory to /tmp and during runtime cannot find /tmp/../requirements-ci.txt

Would you consider my setup a valid use case? Is this a bug in this action?

@jonashaag
Copy link
Contributor

I'm not familiar with external files in an environment.yml file but I think we can make it work by not changing directory.

That said, env caching will be broken because it doesn't look at the requirements.txt file.

@jonashaag jonashaag added the bug Something isn't working label Jan 9, 2023
@renefritze
Copy link
Author

Would the env caching not work at all, or would only the packages in the requirements file not be cached?

@jonashaag
Copy link
Contributor

I would be incapable of properly invalidating the cache, thus you'll get the old version of the env after updates to requirements.txt. When envs are restored from cache, no micromamba install/create is executed so nothing will run pip.

@renefritze
Copy link
Author

Ok, so my best course of action currently would be to move the pip section out of the environment.yml and mamba install --file it manually? It's not a big deal to me if the packages from the requirements file are not cached.
And after #99 is done I would be able to add the requirements file as an additional environment source? Or does this action only support pure yaml environment configs?

@jonashaag
Copy link
Contributor

jonashaag commented Jan 9, 2023

By far the best course of action would be to use environment.yml files only. If you're looking for variants (eg. by Python version), maybe you can autogenerate those as well or put some parts into extra-specs of this action?

But yeah using --file should work as well, although I'm not sure this will always reinstall the latest version (the cached env will contain an old version)

@renefritze
Copy link
Author

maybe ... put some parts into extra-specs of this action?

That might be a good idea for me, thank you! A previous step could read the requirements file into a step output which I could then use in the extra-specs.

But yeah using --file should work as well, although I'm not sure this will always reinstall the latest version (the cached env will contain an old version)

That would not be an issue for me. The packages in the requirement file all have exact pinned versions anyhow. So this should do as a fallback in case I do not get the other idea to work.

Thanks!

@jonashaag
Copy link
Contributor

jonashaag commented Jan 9, 2023

Sounds good! Personally I prefer not to make the CI setup too much dependent on GHA so maybe you can also generate a complete environment.yml file and pass that to the action. That way one can also install it locally where extra-specs isn't available. (Actually it is available but not obviously so: micromamba create -f env.yml extra-spec1 extra-spec2 ...)

@renefritze
Copy link
Author

Reading the requirements file into a previous step's output and using it in the extra-specs does indeed work as imagined.

@jonashaag
Copy link
Contributor

Please recreate this issue with https://github.com/mamba-org/setup-micromamba if it is still relevant.

@jonashaag jonashaag closed this as not planned Won't fix, can't repro, duplicate, stale May 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants