Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install ansible-pylibssh using apt instead of pip

I am using WSL2 to run Ansible on Debian 12.2. When I run a playbook that uses SSH to connect I get the following warning message:

[WARNING]: ansible-pylibssh not installed, falling back to paramiko

I want to use ansible-pylibssh instead of paramiko and I have to install it via apt instead via pip.

I am unable to find that package.

I have tried using apt, apt-get, aptitude with updated list of packages and I am just not able to find that package to install it.

How can I install it on Debian?

like image 473
zeros111 Avatar asked Oct 26 '25 06:10

zeros111


2 Answers

Consider whether you need to install it via apt because "pip" says so.

Pip also suggests to use a virtual environment with ansible, and install ansible-pylibssh here.

# Ubuntu 24.04
# create a local virtual environment
$ python3 -m venv .venv

# activate it
$ source .venv/bin/activate

# install ansible and ansible-pylibssh
$ python3 -m pip install ansible ansible-pylibssh

# run ansible command through python
$ python3 -m ansible <some command>

NB: pip does actually have an apt package, so this is good:

$ sudo apt-get install python3-pip

I tried looking for apt packages, I tried pipx, I tried to install pip with get-pip.py, I tried everything. The above got going and I can always put it into a script. So if virtual environments is the right way to do it, so be it. I wrote about it here: https://variable.dk/2024/12/11/installing-ansible-pylibssh-in-ubuntu-24-04-on-wsl-2/

like image 88
DrLime2k10 Avatar answered Oct 29 '25 10:10

DrLime2k10


While it doesn't necessarily answerer the question, how to install ansible-pylibssh via apt, I had good success installing ansible and ansible-pylibssh via pipx

pipx install --include-deps ansible

  • without --include-deps only the ansible community package is installed but not ansible-core.

pipx inject ansible ansible-pylibssh

installs ansible-pylibssh into the newly created environment

like image 38
Vlad Avatar answered Oct 29 '25 09:10

Vlad



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!