ParallelSSH / ssh2-python

Python bindings for libssh2 C library.
https://parallel-ssh.org
GNU Lesser General Public License v2.1
229 stars 73 forks source link

Update from source build documentation #165

Open smurguia opened 2 years ago

smurguia commented 2 years ago

Bug reports

ERROR: Command errored out with exit status 1: /Library/Frameworks/Python.framework/Versions/3.10/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/vy/wtkzjlqx7kv442vcjx4mh9400000gn/T/pip-install-jlfhuw96/ssh2-python_a5fdf50f6e8f430f9993603a5bb86f32/setup.py'"'"'; file='"'"'/private/var/folders/vy/wtkzjlqx7kv442vcjx4mh9400000gn/T/pip-install-jlfhuw96/ssh2-python_a5fdf50f6e8f430f9993603a5bb86f32/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /private/var/folders/vy/wtkzjlqx7kv442vcjx4mh9400000gn/T/pip-record-odjgx9ar/install-record.txt --single-version-externally-managed --compile --install-headers /Library/Frameworks/Python.framework/Versions/3.10/include/python3.10/ssh2-python Check the logs for full command output.

Steps to reproduce:

  1. Use Apple Silicon Mac
  2. Brew install cmake and libssh2
  3. Update Python to 3.9+
  4. python3 -m pip install ssh2_python

Expected behaviour: Able to install and use ssh2_python

Actual behaviour: Find_package fails to find libssh and cmake install command errors out

Additional info: libssh2: stable 1.10.0 (bottled)

ssh2_python_install_error.txt

pkittenis commented 2 years ago

Thanks for the interest and report.

From log output:

    CMake Error at /opt/homebrew/Cellar/cmake/3.22.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)

OpenSSL is required for from source installations. See documentation.

smurguia commented 2 years ago

Openssl is installed

sarah@MacBook-Pro-2 ~ % brew list
==> Formulae
ca-certificates cmake       libssh2     openssl@1.1

This package is able to install on Intel based Macs but not Apple Silicon

smurguia commented 2 years ago

@pkittenis Can we reopen this?

pkittenis commented 2 years ago

Can try:

SYSTEM_LIBSSH2=1 python3 -m pip install ssh2-python

To use system library instead of building embedded libssh2. Otherwise will have to set OPENSSL_ROOT_DIR env variable to the openssl installation dir. This is build system dependent, nothing the library can do about it.

Source build docs could use an update with instructions.

smurguia commented 2 years ago

Setting SYSTEM_LIBSSH2=1 did not work but setting OPENSSL_ROOT_DIR did.

The documentation states that Wheel packages have no dependencies but I have to brew install these packages and manually list the OPENSSL_ROOT_DIR to install, do you know why?

pkittenis commented 2 years ago

There are no wheels provided for Apple Silicon Mac. The above is a from source build.