udst / ansible-conda Goto Github PK
View Code? Open in Web Editor NEWAn Ansible module for managing Python packages via Conda
License: BSD 2-Clause "Simplified" License
An Ansible module for managing Python packages via Conda
License: BSD 2-Clause "Simplified" License
Referring to #9
I'm using conda 4.3.11 and the output is now different, so this patch is not working because it's returning a dict instead of string:
$ conda list -f ^oracle-instantclient$ --json
[
{
"base_url": null,
"build_number": 1,
"build_string": "1",
"channel": "dody",
"dist_name": "oracle-instantclient-11.2.0.4.0-1",
"name": "oracle-instantclient",
"platform": null,
"version": "11.2.0.4.0",
"with_features_depends": null
}
]
Okay I was able to reproduce this and can point to what is causing it.
To reproduce:
I found that because in the backend what is happening is conda has created a lock file that is not cleanly deleted when Ctrl-C is hit. So this causes the package install to hang while it tries to deal with the lock file. The can be seen when running conda install manually on the target host.
What can be done is to:
If a version number has extra ".0" precision - e.g. only version 0.8 exists, yet version 0.8.0 is requested - conda
happily ignores the extra ".0"s.
However, this module still reports a change when this happens, e.g.:
TASK [hail : install conda prerequisites] ******************************************************************************************************************************************************************
changed: [localhost] => {
"changed": true,
"invocation": {
"module_args": {
"channels": null,
"executable": "/usr/local/anaconda-4.4.0/bin/conda",
"extra_args": null,
"name": "seaborn",
"state": "present",
"version": "0.8.0"
}
},
"name": "seaborn",
"stderr": "",
"stderr_lines": [],
"stdout": "Fetching package metadata .........\nSolving package specifications: .\n\n# All requested packages already installed.\n# packages in environment at /usr/local/Anaconda2-4.4.0-Linux-x86_64:\n#\nseaborn 0.8 py27_0 \n",
"stdout_lines": [
"Fetching package metadata .........",
"Solving package specifications: .",
"",
"# All requested packages already installed.",
"# packages in environment at /usr/local/Anaconda2-4.4.0-Linux-x86_64:",
"#",
"seaborn 0.8 py27_0 "
],
"version": "0.8.0"
}
It's worth noting that conda install seaborn=0.8.1
leads to a PackageNotFoundError
error.
I love this plugin, so first off, thanks for the time you took to create and publish it!
Currently the channels
parameter allows one to append channels to the channel list when using conda. The code for this is here and although the language suggests addition, the action is an append:
Lines 175 to 189 in f26ac9f
Using the Bioconda channel requires addition of channels in a known order so installation is predictable and dependencies are matched correctly:
❯ conda config --add channels defaults
❯ conda config --add channels bioconda
❯ conda config --add channels conda-forge
So the channels order become:
❯ conda config --show channels
channels:
- conda-forge
- bioconda
- defaults
Would you be willing to support overriding of the channel order via configuration? If you have a good idea on how to achieve this I would be willing to submit a PR!
Hi, I posted this issue already here.
jupyterhub/jupyterhub-deploy-teaching#77
I'm getting a lot of errors of this kind
failed: [sapho - longwing](item = ipywidgets) => {
"failed": true,
"item": "ipywidgets",
"module_stderr": "\
OpenSSH_7.2p2 Ubuntu-4ubuntu2.2, OpenSSL 1.0.2g 1 Mar 2016 \
debug1: Reading configuration data /etc/ssh/ssh_config \
debug1: /etc/ssh/ssh_config line 19: Applying options for * \
debug1: auto-mux: Trying existing master \
debug2: fd 3 setting O_NONBLOCK \
debug2: mux_client_hello_exchange: master version 4 \
debug3: mux_client_forwards: request forwardings: 0 local, 0 remote \
debug3: mux_client_request_session: entering \
debug3: mux_client_request_alive: entering \
debug3: mux_client_request_alive: done pid = 897 \
debug3: mux_client_request_session: session request sent \
debug1: mux_client_request_session: master session id: 2 \
debug3: mux_client_read_packet: read header failed: Broken pipe \
debug2: Received exit status from master 0 \
Shared connection to sapho-longwing closed. \
",
"module_stdout": "\
Traceback (most recent call last): \
File \"/tmp/ansible_dRn5ki/ansible_module_conda.py\", line 296, in <module> \
main() \
File \"/tmp/ansible_dRn5ki/ansible_module_conda.py\", line 281, in main \
installed, installed_version = _check_installed(module, conda, name) \
File \"/tmp/ansible_dRn5ki/ansible_module_conda.py\", line 141, in _check_installed \
pname, pversion, pdist = other.rsplit('-', 2) \
AttributeError: 'dict' object has no attribute 'rsplit' \
",
"msg": "MODULE FAILURE",
"rc": 0
}
With many packages. The problem is that sometimes object
becomes a dict
object. In thos case I solved the problem with this
if isinstance(other, dict):
pname = other.get('name', '')
pversion = other.get('version', '')
else:
pname, pversion, pdist = other.rsplit('-', 2)
This seems like it would be a worthy addition to upstream Ansible. Would you consider submitting this to https://github.com/ansible/ansible-modules-extras ?
If you're not interested in dealing with that process, I'd be happy to submit a PR to ansible-modules-extras myself (maintaining credit to you as Git author and copyright owner).
Cool option would be possibility to create conda
environment from the specification files created in other env by either
conda list -e
or
conda list --explicit
conda's depsolving is pretty strange, and if you ask to install packages one at a time you can get pretty different results and a lot of churn among dependencies compared to when you request all of the packages you want at once.
First decision is how to specify the list of packages and perhaps versions. My preference would be to try to match a module like dnf as much as possible. This would be a big change though - as I think we would want to get rid of the separate version argument and have users pass in the version specification in name (as is done in dnf). Then name could be a comma separated string or a list of packages.
When I try using this conda library it gets stuck at this stage:
TASK: [app_server | Upgrade conda] ********************************************
<localhost> REMOTE_MODULE conda name=conda state=latest executable=/opt/miniconda2/bin/conda CHECKMODE=True
<localhost> EXEC ['/bin/sh', '-c', 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1464234711.62-251681184121083 && echo $HOME/.ansible/tmp/ansible-tmp-1464234711.62-251681184121083']
<localhost> PUT /tmp/tmpJtd_Ak TO //.ansible/tmp/
Any idea why ?
Hello,
When using the conda module, if a playbook is replayed, conda packages will be reinstalled too.
A check should be performed to verify if a package is already installed before installing it ?
Regards,
Nicolas
How do I use this module to install package to specific environment?
For example,
Given that I have Anaconda installed under /opt/anaconda2/,
and that I have manually created environment called 'myconda'
I want to write a task to install package pip into environment 'myconda'
Here is an example task:
This does not work in my environment with ansible 2.4.3.0
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.