ssh2-python icon indicating copy to clipboard operation
ssh2-python copied to clipboard

Update from source build documentation

Open smurguia opened this issue 3 years ago • 6 comments

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

smurguia avatar Dec 10 '21 22:12 smurguia

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.

pkittenis avatar Dec 14 '21 13:12 pkittenis

Openssl is installed

sarah@MacBook-Pro-2 ~ % brew list
==> Formulae
ca-certificates	cmake		libssh2		[email protected]

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

smurguia avatar Dec 14 '21 18:12 smurguia

@pkittenis Can we reopen this?

smurguia avatar Dec 14 '21 19:12 smurguia

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.

pkittenis avatar Dec 16 '21 10:12 pkittenis

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?

smurguia avatar Jan 05 '22 19:01 smurguia

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

pkittenis avatar Jan 12 '22 11:01 pkittenis