ParallelSSH / parallel-ssh

Asynchronous parallel SSH client library.
https://parallel-ssh.org
GNU Lesser General Public License v2.1
1.2k stars 148 forks source link

install error in package ssh2-python #367

Open FengJiDetecon opened 1 year ago

FengJiDetecon commented 1 year ago

Describe the bug the problem is caused first by from ssh2.error_codes import LIBSSH2_ERROR_EAGAI which tries to load error_codes.cpython-37m-darwin.so but fails the reason is that '/private/var/folders/zb/t0r1t7451tx4vfhc9jbk2rzr0000gn/T/pip-install-vik15j8x/ssh2-python_fc1f843181664c9aa95e798b0c981b59/build_dir/src/libssh2.1.dylib' (no such file)

To Reproduce

Steps to reproduce the behavior:

  1. pip3 install parallel-ssh

Expected behavior installed

Actual behaviour error msg

Screenshots

Bildschirm­foto 2022-12-05 um 16 02 26

Additional information on Mac os cmake and gcc installed cmake version 3.24.2 gcc 12.2.0

plamendelchev commented 1 year ago

Hi, I had the same problem. I managed to solve it by installing libssh2 with brew and setting up LDFLAGS and CPPFLAGS:

$ brew install libssh2

$ grep libssh2 ~/.zshrc
export LDFLAGS="-L${HOME}/brew/opt/libssh2/lib"
export CPPFLAGS="-I${HOME}/brew/opt/libssh2/include"

$ pip3 cache purge

$ pip3 install parallel-ssh
...
Successfully installed gevent-22.10.2 greenlet-2.0.1 parallel-ssh-2.12.0 ssh-python-1.0.0 ssh2-python-1.0.0 zope.event-4.6 zope.interface-5.5.2

$ cat test.py
from pssh.clients import SSHClient

client = SSHClient(host='github.com', user='git', port=22, pkey='~/.ssh/github')
host_out = client.run_command('hostname')
for line in host_out.stdout:
    print(line)
for line in host_out.stderr:
    print(line)

$ python3 test.py
Invalid command: 'hostname'
  You appear to be using ssh to clone a git:// URL.
  Make sure your core.gitProxy config option and the
  GIT_PROXY_COMMAND environment variable are NOT set.
jandvorak-sol60279 commented 1 year ago

Hi, I had the same problem. I managed to solve it by installing libssh2 with brew and setting up LDFLAGS and CPPFLAGS:

$ brew install libssh2

$ grep libssh2 ~/.zshrc
export LDFLAGS="-L${HOME}/brew/opt/libssh2/lib"
export CPPFLAGS="-I${HOME}/brew/opt/libssh2/include"

$ pip3 cache purge

$ pip3 install parallel-ssh
...
Successfully installed gevent-22.10.2 greenlet-2.0.1 parallel-ssh-2.12.0 ssh-python-1.0.0 ssh2-python-1.0.0 zope.event-4.6 zope.interface-5.5.2

$ cat test.py
from pssh.clients import SSHClient

client = SSHClient(host='github.com', user='git', port=22, pkey='~/.ssh/github')
host_out = client.run_command('hostname')
for line in host_out.stdout:
    print(line)
for line in host_out.stderr:
    print(line)

$ python3 test.py
Invalid command: 'hostname'
  You appear to be using ssh to clone a git:// URL.
  Make sure your core.gitProxy config option and the
  GIT_PROXY_COMMAND environment variable are NOT set.

had the same issue and with some modification went to success

need to change flags path

export LDFLAGS="-L$(dirname $(which brew))/../opt/libssh2/lib"
export CPPFLAGS="-I$(dirname $(which brew))/../opt/libssh2/include"

install cmake (obviously)

brew install cmake

after that i got another (openssl) error

CMake Error at /opt/homebrew/Cellar/cmake/3.25.1/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
        Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the
        system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY
        OPENSSL_INCLUDE_DIR)

even tho openssl was in some obscure version, i did install it thru brew

brew install openssl

crate links

brew link --force openssl

and hallelujah ... installing parallel-ssh went finally ok and working (using fresh venv)

FengJi2021 commented 1 year ago

both not working for me? any trouble shooting suggestion? i think this package using cpython to get openssl and problem shall be compiler lib link.