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

Enable specification of conda dependencies for apps #338

Open
danielhollas opened this issue Jun 30, 2022 · 9 comments
Open

Enable specification of conda dependencies for apps #338

danielhollas opened this issue Jun 30, 2022 · 9 comments
Labels
documentation question Further information is requested

Comments

@danielhollas
Copy link
Contributor

danielhollas commented Jun 30, 2022

While I understand the new paragraph in README.md about the special volume that AiiDAlab launch creates for local conda environments, I am still unsure how to use it in practice.

To be concrete, in my case I need to install xtb-python as a dependency of my AiiDALab application. This package is not published on pip and must be installed via conda-forge channel.

So far I've been installing it as root

aiidalab-launch exec --privileged -- conda install xtb-python

If I wanted to install as aiida user, my understanding is that I'd need to create a new conda environment. Should this new environment be a clone of the base, like this?

conda create --name xtb --clone base

And then I guess I need to automatically activate it, perhaps in /home/aiida/.bashrc? What is the best practice here?

Thanks!

@csadorf
Copy link
Member

csadorf commented Jul 5, 2022

Sorry for not getting back to you earlier. I was on vacation for a few days and was still in catch-up mode.

Indeed, the base environment cannot be changed by a non-root user. However, you can always create a separate environment for the specific needs that you have and also use it as a Kernel for your notebooks and apps. I don't think we really have a standard approach for this scenario.

The main challenge of simply putting everything into separate environments is that aiida-core needs to be installed in a consistent location and also expects other dependencies to be available there.

@danielhollas
Copy link
Contributor Author

@csadorf no worries, thanks! Would you happen to have a working example somewhere of setting up and using nondefault conda environment for the AiiDAlab apps? I looked into it a bit and it seems nontrivial. What I would really like is to make so that when I do aiidalab-launch start the app uses the new environment automatically (without e.g. switching the kernel).

@csadorf
Copy link
Member

csadorf commented Jul 7, 2022

@csadorf no worries, thanks! Would you happen to have a working example somewhere of setting up and using nondefault conda environment for the AiiDAlab apps? I looked into it a bit and it seems nontrivial. What I would really like is to make so that when I do aiidalab-launch start the app uses the new environment automatically (without e.g. switching the kernel).

No, I don't think such an example exist yet. Just to make sure that I understand correctly: Your primary motivation is to install additional dependencies that are required by an app that cannot be installed by pip, right? The replacement of the default conda environment is not the primary motive, or is it?

@danielhollas
Copy link
Contributor Author

Yes, exactly, I need additional dependencies via pip, and want them to persist between the AiiDAlab launch invocations.

@csadorf
Copy link
Member

csadorf commented Jul 8, 2022

Yes, exactly, I need additional dependencies via pip, and want them to persist between the AiiDAlab launch invocations.

I thought they cannot be installed via pip?

@danielhollas
Copy link
Contributor Author

Uh, apologies, I meant via conda.

@csadorf
Copy link
Member

csadorf commented Jul 8, 2022

Ok, I do not have a straight-forward solution for this at the moment. However, I am going to put it on our agenda to discuss.

@csadorf csadorf changed the title Managing local conda environments inside AiiDALab container Enable specification of conda dependencies for apps Jul 8, 2022
@danielhollas danielhollas added documentation question Further information is requested labels Nov 15, 2022
@danielhollas
Copy link
Contributor Author

Update on this.

The original issue here was that one could not put the conda install in the post_install script, because that script was run under aiida user, but installing into conda environment required root privileges. However, I think in the new Docker stack images that is no longer the case since the conda environment is managed by the jovyan user. So this issue might be solved already. I will test whether conda install works within post_install. If it works, the only thing to be done is here is to document this somewhere (but I think the AiiDAlab documentation needs a bigger overhaul and update anyway).

I have reduced the urgency to 'low' because it's no longer a blocker for me since I am building my own Docker image anyway. If anybody else runs into this then it can be increased again.

cc @unkcpz @yakutovicha

@danielhollas
Copy link
Contributor Author

@unkcpz @yakutovicha this issue in on the wrong repo. Would you mind moving it either to the docker-stack or aiidalab repositories?

This is related to our discussion in aiidalab/aiidalab-docker-stack#343

@yakutovicha yakutovicha transferred this issue from aiidalab/aiidalab-launch Dec 13, 2022
@danielhollas danielhollas removed their assignment Feb 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants