ParallelSSH / ssh2-python

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

Installation with pip is failing in Ubuntu 18.04 for version 0.20.0 #113

Closed aka-raccoon closed 4 years ago

aka-raccoon commented 4 years ago

Hello, I'm unable to install newest version 0.20.0. It fails during pip install ssh2-python.
Installation for older version is working fine (0.19.0 for example).

My envinronment

Distributor ID: Ubuntu Description: Ubuntu 18.04.4 LTS Release: 18.04 Codename: bionic

Logs

λ   pip install ssh2-python==0.20.0
Collecting ssh2-python==0.20.0
  Using cached https://files.pythonhosted.org/packages/27/22/90452ef0261e9f6fbceb231210c1384993bc5f2ae33d893903078c52ce49/ssh2-python-0.20.0.tar.gz
Building wheels for collected packages: ssh2-python
  Running setup.py bdist_wheel for ssh2-python ... error
  Complete output from command /home/user/projects/sshcon/.venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-p67hlffl/ssh2-python/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmpwb1sx2vrpip-wheel- --python-tag cp36:
  /bin/sh: 1: cmake: not found
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-build-p67hlffl/ssh2-python/setup.py", line 34, in <module>
      build_ssh2()
    File "/tmp/pip-build-p67hlffl/ssh2-python/_setup_libssh2.py", line 24, in build_ssh2
      shell=True, env=os.environ)
    File "/usr/lib/python3.6/subprocess.py", line 311, in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command 'cmake ../libssh2 -DBUILD_SHARED_LIBS=ON     -DENABLE_ZLIB_COMPRESSION=ON -DENABLE_CRYPT_NONE=ON     -DENABLE_MAC_NONE=ON -DCRYPTO_BACKEND=OpenSSL' returned non-zero exit status 127.

  ----------------------------------------
  Failed building wheel for ssh2-python
  Running setup.py clean for ssh2-python
Failed to build ssh2-python
Installing collected packages: ssh2-python
  Found existing installation: ssh2-python 0.19.0
    Uninstalling ssh2-python-0.19.0:
      Successfully uninstalled ssh2-python-0.19.0
  Running setup.py install for ssh2-python ... error
    Complete output from command /home/user/projects/sshcon/.venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-p67hlffl/ssh2-python/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-kxqca8fn-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/user/projects/sshcon/.venv/include/site/python3.6/ssh2-python:
    /bin/sh: 1: cmake: not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-p67hlffl/ssh2-python/setup.py", line 34, in <module>
        build_ssh2()
      File "/tmp/pip-build-p67hlffl/ssh2-python/_setup_libssh2.py", line 24, in build_ssh2
        shell=True, env=os.environ)
      File "/usr/lib/python3.6/subprocess.py", line 311, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command 'cmake ../libssh2 -DBUILD_SHARED_LIBS=ON     -DENABLE_ZLIB_COMPRESSION=ON -DENABLE_CRYPT_NONE=ON     -DENABLE_MAC_NONE=ON -DCRYPTO_BACKEND=OpenSSL' returned non-zero exit status 127.

    ----------------------------------------
  Rolling back uninstall of ssh2-python
Command "/home/user/projects/sshcon/.venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-p67hlffl/ssh2-python/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-kxqca8fn-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/user/projects/sshcon/.venv/include/site/python3.6/ssh2-python" failed with error code 1 in /tmp/pip-build-p67hlffl/ssh2-python/
pkittenis commented 4 years ago

Thanks for the interest.

The error message /bin/sh: 1: cmake: not found means the environment is lacking source build dependencies.

Binary wheels are provided for python 2.7-3.9 amd64, which should have been used in this case.

You seem to have a cached source package.

Try pip install --no-cache ssh2-python. It installs a binary wheel on any 64-bit python version 2.7 - 3.9 inclusive.

pip install --no-cache ssh2-python
Collecting ssh2-python
  Downloading ssh2_python-0.20.0-cp36-cp36m-manylinux2010_x86_64.whl (4.0 MB)
     |████████████████████████████████| 4.0 MB 4.9 MB/s 
Installing collected packages: ssh2-python
Successfully installed ssh2-python-0.20.0
aka-raccoon commented 4 years ago

I thank you for this project. It's really cool and I'm very happy to use it!

I tried python versions Python 3.6.9 and Python 3.8.0 and both are failing. I tried with --no-cache but it's failing with the same error:

[🐍testssh]  λ   pip install --no-cache ssh2-python
Collecting ssh2-python
  Downloading https://files.pythonhosted.org/packages/27/22/90452ef0261e9f6fbceb231210c1384993bc5f2ae33d893903078c52ce49/ssh2-python-0.20.0.tar.gz (535kB)
    100% |████████████████████████████████| 542kB 5.3MB/s
Installing collected packages: ssh2-python
  Running setup.py install for ssh2-python ... error
    Complete output from command /home/user/projects/testssh/.venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-9y0oqpyx/ssh2-python/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-biapyz9o-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/user/projects/testssh/.venv/include/site/python3.6/ssh2-python:
    /bin/sh: 1: cmake: not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-9y0oqpyx/ssh2-python/setup.py", line 34, in <module>
        build_ssh2()
      File "/tmp/pip-build-9y0oqpyx/ssh2-python/_setup_libssh2.py", line 24, in build_ssh2
        shell=True, env=os.environ)
      File "/usr/lib/python3.6/subprocess.py", line 311, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command 'cmake ../libssh2 -DBUILD_SHARED_LIBS=ON     -DENABLE_ZLIB_COMPRESSION=ON -DENABLE_CRYPT_NONE=ON     -DENABLE_MAC_NONE=ON -DCRYPTO_BACKEND=OpenSSL' returned non-zero exit status 127.

I tried installation on different Ubuntu machine (Release 20.04) and it's working fine there so I assume there is something wrong with my server (Ubuntu 18.04). The strange thing is that installation of ssh2-python 0.19.0 is working fine on that machine. I think you can close this. I'm planning to make clean installation of my ubuntu server and that could fix that.

pkittenis commented 4 years ago

Update your version of pip. See installation documentation.