Skip to content

SSH2 Transport

Carl Montanari edited this page May 20, 2020 · 1 revision

Table of Contents


SSH2-Python and Alpine

Alpine containers are fairly popular, but there are some hiccups you may run into if using alpine! In general, Alpine, does not support many linux wheels -- which causes some potential issues for python packages that use C extensions. For scrapli this is mostly a non-issue, except for if you want to use ssh2-python!

networktocode slack user rechter ran into the following issue trying to install ssh2-python in an alpine container:

ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-df5rt80m/ssh2-python/setup.py'"'"'; __file__='"'"'/tmp/pip-install-df5rt80m/ssh2-python/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-9rtatp1t/install-record.txt --single-version-externally-managed --compile --install-headers /usr/include/python3.7m/ssh2-python Check the logs for full command output.
bash-5.0# 

The fix to get this working was relatively simple:

apk add --no-cache cmake 
pip install scrapli-ssh2 

My normal stance is to just use Debian containers, but if you need to use alpine, hopefully this helps!

Clone this wiki locally