Closed carlmontanari closed 4 years ago
I am also experiencing this. I have an Ubuntu 20.04 with python 3.8 and an Alpine based Docker image with python 3.7 for CI: it seems that on 3.7 most cpython shared libraries are missing.
On Ubuntu I have:
$ ls .venv/lib/python3.8/site-packages/ssh2
agent.c exceptions.cpython-38-x86_64-linux-gnu.so listener.pxd sftp_handle.c
agent.cpython-38-x86_64-linux-gnu.so exceptions.pyx listener.pyx sftp_handle.cpython-38-x86_64-linux-gnu.so
agent.pxd fileinfo.c pkey.c sftp_handle.pxd
agent.pyx fileinfo.cpython-38-x86_64-linux-gnu.so pkey.cpython-38-x86_64-linux-gnu.so sftp_handle.pyx
channel.c fileinfo.pxd pkey.pxd sftp.pxd
channel.cpython-38-x86_64-linux-gnu.so fileinfo.pyx pkey.pyx sftp.pyx
channel.pxd find_eol.c publickey.c statinfo.c
channel.pyx find_eol.cpython-38-x86_64-linux-gnu.so publickey.cpython-38-x86_64-linux-gnu.so statinfo.cpython-38-x86_64-linux-gnu.so
c_pkey.pxd find_eol.h publickey.pxd statinfo.pxd
c_sftp.pxd __init__.pxd publickey.pyx statinfo.pyx
c_ssh2.pxd __init__.py __pycache__ utils.c
c_stat.pxd knownhost.c session.c utils.cpython-38-x86_64-linux-gnu.so
error_codes.c knownhost.cpython-38-x86_64-linux-gnu.so session.cpython-38-x86_64-linux-gnu.so utils.pxd
error_codes.cpython-38-x86_64-linux-gnu.so knownhost.pxd session.pxd utils.pyx
error_codes.pxd knownhost.pyx session.pyx _version.py
error_codes.pyx listener.c sftp.c
exceptions.c listener.cpython-38-x86_64-linux-gnu.so sftp.cpython-38-x86_64-linux-gnu.so
while in the docker image:
$ ls /usr/local/lib/python3.7/site-packages/ssh2/
__init__.pxd channel.pyx libssh2.so sftp.pxd
__init__.py error_codes.pxd libssh2.so.1 sftp.pyx
__pycache__ error_codes.pyx libssh2.so.1.0.1 sftp_handle.pxd
_version.py exceptions.pyx listener.pxd sftp_handle.pyx
agent.pxd fileinfo.pxd listener.pyx statinfo.pxd
agent.pyx fileinfo.pyx pkey.pxd statinfo.pyx
c_pkey.pxd find_eol.c pkey.pyx utils.pxd
c_sftp.pxd find_eol.cpython-37m-x86_64-linux-gnu.so publickey.pxd utils.pyx
c_ssh2.pxd find_eol.h publickey.pyx
c_stat.pxd knownhost.pxd session.pxd
channel.pxd knownhost.pyx session.pyx
$ python3
Python 3.7.9 (default, Aug 18 2020, 04:02:05)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from ssh2.session import Session
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'ssh2.session'
Thanks for the interest and report.
This is a bad source package on pypi that was uploaded without the .c
files included. It seems that they are not included by default on systems with cython installed, have made changes so they are always included.
On older Linux distributions update pip to get binary wheels instead of building from source. pip install -U pip
. See also documentation.
Resolved by 0.22.0
Bug report
0.20.0
on MacOS for Python versions 3.6 and 3.7 installs improperly. Python 3.8 on MacOS works as expected. I have tested this locally on my Mac and an Ubuntu 20 host, as well as onmacOS-lastest
andubuntu-latest
via GitHub Actions. Ubuntu works on all versions as expected.Steps to reproduce:
python -c 'from ssh2.session import Session'
or importingfrom ssh2.channel import Channel
for example.See below.
Expected behaviour: Import is successful
Actual behaviour: Python 3.6 and 3.7 raise
ModuleNotFoundError
Additional info:
Installing via pip or from source both fails for 3.6 and 3.7, pip installing 3.8 works as expected.
Fresh venv ++ upgrade pip ++ install
ssh2-python
on 3.6.8:Same thing on 3.7.7:
And working w/ 3.8:
The actual installed .pyx files look the same between versions, and the
Channel
class for example is definitely there :)I'm a outa my depth on the Cython/bindings bits so not super sure where else to be poking about, but happy to check whatever you need me to look at!
Glad to see this project getting some commits lately, I'm a big fan :D!
Carl