pycopia/ssh2-python3

installation failed

Opened this issue · 3 comments

Ri0n commented
$ docker run --rm -it public.ecr.aws/sam/build-python3.10:latest-x86_64 bash
bash-4.2# pip install ssh2-python3
Collecting ssh2-python3
  Downloading ssh2-python3-1.11.1.tar.gz (613 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 613.6/613.6 kB 2.5 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [6 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-wlztxhc4/ssh2-python3_8e5bb10e4a3f469488c4fdbe80b612ed/setup.py", line 8, in <module>
          from Cython.Distutils.extension import Extension
      ModuleNotFoundError: No module named 'Cython'
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

[notice] A new release of pip is available: 23.0.1 -> 23.2
[notice] To update, run: pip install --upgrade pip

After manual installation of Cython there is another error

gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -Ilibssh2/include -I/var/lang/include/python3.10 -c ssh2/knownhost.c -o build/temp.linux-x86_64-cpython-310/ssh2/knownhost.o -O3
      gcc -pthread -shared -Wl,-rpath=/var/lang/lib build/temp.linux-x86_64-cpython-310/ssh2/knownhost.o -L/tmp/pip-install-qq19ux6x/ssh2-python3_2e993007002f46589797c2c73a8da3b4/build/glibc2.26/src -L/var/lang/lib -lssh2 -lssl -lcrypto -lz -o build/lib.linux-x86_64-cpython-310/ssh2/knownhost.cpython-310-x86_64-linux-gnu.so
      /usr/bin/ld: cannot find -lssh2
      /usr/bin/ld: cannot find -lssl
      /usr/bin/ld: cannot find -lcrypto
      collect2: error: ld returned 1 exit status

So I had to manually install libssh2-devel and openssl-devel to make it working.

I believe all of this happens because there are no pre-built binaries for Amazon Linux.
So I'm wondering where it's possible to add distributions with pre-built binaries.


Even after successful installation it still doesn't work

ImportError: /var/lang/lib/python3.10/site-packages/ssh2/session.cpython-310-x86_64-linux-gnu.so: undefined symbol: libssh2_userauth_publickey_frommemory
bash-4.2# nm -D /lib64/libssh2.so.1 | grep libssh2_userauth_publickey_frommemory
bash-4.2# nm -D /lib64/libssh2.so.1 | grep libssh2_userauth_publickey
0000000000019e90 T libssh2_userauth_publickey
0000000000019cf0 T libssh2_userauth_publickey_fromfile_ex

@kdart-brt would you be able to take this on and release a new version? Unfortunately, ssh2-python has become stale and we're looking at this fork as a replacement.

The same error at Fedora 39 server

Hi @ZlobinDA I decided to publish a (hopefully) temporary package that works with python 3.12 (linux and mac) if you're interested in using it instead.
https://pypi.org/project/ssh2-python312/