I tried to install a python3 module via pip3 using salt, but I failed miserably. I am not sure whether this functionality is supported by saltstack at all, can you confirm please?
python-pip:
pkg.installed
paramiko:
pip.installed:
- name: paramiko
- require:
- pkg: python-pip
python3-pip:
pkg.installed
paramiko3:
pip3.installed:
- name: paramiko
- require:
- pkg: python3-pip
In the my recipe I executed the code snippet from above. The first part executed fine and paramiko fro python was installed. However, I did not manage to install paramiko for python3 via pip
on the workstations running: salt-minion 0.17.5
, OS: Ubuntu Gnome 14.04 LTS
Hi,
the pip3 state doesn't exist but you can install pip3 modules with the following recipe:
python-pip:
pkg.installed:
- pkgs:
- python-pip
- python3-pip
paramiko3:
pip.installed:
- name: paramiko
- bin_env: '/usr/bin/pip3'
- require:
- pkg: python-pip
You need python-pip package for salt minion.
It works on salt-minion 2015.8
, I didn't tested on salt-minion 0.17.5
.
@Da-Juan would it be much of an hassle to you to commend out the lines in the recipe above, and tell what they do?
Here a commented version :)
# Install python-pip packages (version 2 and 3)
# version 2 is needed for salt-minion's pip_state
python-pip:
pkg.installed:
- pkgs:
- python-pip
- python3-pip
paramiko3:
# Install using pip
pip.installed:
# The pip module we want to install
- name: paramiko
# Absolute path to a virtual environment directory or absolute path to a pip executable
# We want to install python3 paramiko so we use pip3 here
- bin_env: '/usr/bin/pip3'
# Require python-pip state to be run before this one
- require:
- pkg: python-pip
I tried the suggested solution and I get the following error:
State: - pip
Name: paramiko
Function: installed
Result: False
Comment: The following requisites were not found:
require:
pkg: python-pip
Changes:
I'd assume the reason is that I do not have python-pip
and python3-pip
pkgs under the python-pip
id declaration.
can you confirm?
Yes if python-pip and python3-pip are installed under another state id you need to require this id to ensure that they are installed before paramiko.
@siemprepeligroso, did you figure out your issue?
Most helpful comment
Here a commented version :)