evandam / evandam.conda Goto Github PK
View Code? Open in Web Editor NEWManage conda environments and packages with Ansible
License: MIT License
Manage conda environments and packages with Ansible
License: MIT License
Exciting! I too was using UDST/ansible-conda for awhile but the project looks unmaintained. How would I go about setting either the default channel order, or adding channels for an install command? See other feature request here: UDST/ansible-conda#26
This role has a module, and that is what's great about it. These folders are unused, and hence should be removed:
Please push a tag to github when PRs are merged. For usage without surprises I'd like to specify a version, for example 1.0.2.
I use this command:
ansible-galaxy install -r requirements.yml -p roles
with this in the requirements.yml file:
---
- src: https://github.com/evandam/evandam.conda.git
scm: git
name: evandam.conda
version: 1.0.2
With only master as the branch and no tags, I can obtain a change without notice.
It does not appear to be possible to do somethings like:
conda:
name: *
state: latest
to update all packages.
I get this error message when using the conda role without specifying executable
. If I log in to the remote host, and echo $PATH
, I see my conda directory in there -- but ansible doesn't find it. I guess this is because .bashrc is not executed in an ansible session; but then is it possible to use this module without specifying executable
at all?
When I specify it, everything works fine (which, BTW, is great help, so thanks!).
Also, the parameter executable
is not mentioned in the documentation.
I'd like to add support for the --override-channels and --strict-channel-priority options. Do you think it makes sense to have individual booleans for them or just a general "extra_args" option?
In my playbook for packer I try:
tasks:
- name: Create conda environments
conda:
executable: "{{ miniconda_dir }}/bin/conda"
name: "python={{ item.python }}"
environment: "{{ item.pyenv }}"
with_items: "{{ miniconda_envs }}"
- name: Configure conda environments
conda:
executable: "{{ miniconda_dir }}/bin/conda"
environment: "{{ item.pyenv }}"
channels: "{{ miniconda_channels }}"
name: "{{ miniconda_packages }}"
state: present
with_items: "{{ miniconda_envs }}"
This fails with:
TASK [Configure conda environments] ********************************************
Monday 25 November 2019 15:50:45 -0500 (0:00:47.290) 0:14:10.788 *******
changed: [127.0.0.1] => (item={u'python': u'2.7', u'pyenv': u'/opt/conda/envs/py27_64'})
failed: [127.0.0.1] (item={u'python': u'3.6', u'pyenv': u'/opt/conda/envs/py36_64'}) => changed=false
cmd: /opt/conda/bin/conda list --json --prefix /opt/conda/envs/py36_64
item:
pyenv: /opt/conda/envs/py36_64
python: '3.6'
msg: '[Errno 22] Invalid argument'
rc: 22
failed: [127.0.0.1] (item={u'python': u'3.7', u'pyenv': u'/opt/conda/envs/py37_64'}) => ged=false
cmd: /opt/conda/bin/conda list --json --prefix /opt/conda/envs/py37_64
item:
pyenv: /opt/conda/envs/py37_64
python: '3.7'
msg: '[Errno 22] Invalid argument'
rc: 22
Edit meta/main.yml to improve the score at https://galaxy.ansible.com/evandam/conda
Maybe this already works, maybe it doesn't, but if it does work it isn't documented.
Setting up my conda env looks like this:
conda env create -n my_conda_env -f path/to/requirements/conda.yml
I see no obvious way to specify that last parameter.
Hi evandam,
Love your work, we are looking to have a way to specify the Build attribute in Conda installs
For example /usr/app/anaconda_root/bin/conda install --json jupyterhub=1.0.0=py37_0
the =py37_0 is the part we are looking for added functionality.
Thanks bud.
There is another library that competes in this space. A PR into Ansible is filed, but stuck in limbo...
doesn't always seem to pick up that the latest version is already installed.
The module could be self-documenting with the proper text embedded.
Yes, it is late, but we still need to be able to switch between python3 and back to python2.
https://docs.anaconda.com/anaconda/user-guide/tasks/switch-environment/
conda create -y --name py27 python=2.7
conda create -y --name py36 python=3.6
conda create -y --name py37 python=3.7
I am creating an environment and installing some packages. However, when I run the playbook again, it doesn't say "OK", but takes a while and says "changed". I am using state: present
instead of latest
and would expect it to finish quickly with "OK" when the environment already exists. Is there any way to get it to do that?
Example task:
- name: Install amalea environment
become: yes
conda:
executable: /opt/tljh/user/bin/mamba
environment: amalea
state: present
channels:
- conda-forge
- defaults
name:
- python=3.9.7
- pip
Edit: it seems the culprit is that I gave the environment name, not a path. The function list_envs
parses the output of conda env list --json
, which only returns the paths.
Installing python 3.10 fails as it is seen as 3.1. My task looks like:
- name: Create a conda environment
conda:
name: python
version: 3.10
environment: py310
executable: "{{ mamba_prefix }}/bin/mamba"
state: present
give the warning:
[WARNING]: The value "3.1" (type float) was converted to "'3.1'" (type string). If this does not look like what you expect, quote the
entire value to ensure it does not change.
Apparently 3.10 is converted to 3.1 and that version is unknown and it fails after thta.
If I put quotes around 3.10 like "3.10" then it works, however, the version is not read and just python 3.9 is installed.
Any idea how to fix this?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.