Install parallel-ssh==1.9.1 Python 3.7.16 on Apple M1 Pro 14.2.1

97 Views Asked by At

I'm running into problems installing parallel-ssh==1.9.1 on my Python 3.7.16. When installing I get the following error:

Downloading zope.event-5.0-py3-none-any.whl (6.8 kB)
Building wheels for collected packages: parallel-ssh, ssh2-python, zope.interface, cffi
  Building wheel for parallel-ssh (setup.py) ... done
  Created wheel for parallel-ssh: filename=parallel_ssh-1.9.1-cp37-cp37m-macosx_14_0_arm64.whl size=81652 sha256=5442f141ec1584759d3b4df423a67d46a8921ebdb2561651e7c8ec696d0bb6a2
  Stored in directory: /Users/ekl/Library/Caches/pip/wheels/9b/83/e2/521569088dd75073ad11d33f1b604572725ca3d373d9a6f062
  Building wheel for ssh2-python (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [11 lines of output]
      /bin/sh: cmake: command not found
      Traceback (most recent call last):
        File "<string>", line 36, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/private/var/folders/j1/5kv3krf177z_t3n2n5nyzhqm0000gp/T/pip-install-plbsxp0y/ssh2-python_bad6d8eb0c1e4527a569d49e92dcbc51/setup.py", line 32, in <module>
          build_ssh2()
        File "/private/var/folders/j1/5kv3krf177z_t3n2n5nyzhqm0000gp/T/pip-install-plbsxp0y/ssh2-python_bad6d8eb0c1e4527a569d49e92dcbc51/_setup_libssh2.py", line 38, in build_ssh2
          shell=True, env=os.environ)
        File "/Users/ekl/.pyenv/versions/3.7.12/lib/python3.7/subprocess.py", line 363, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command 'cmake ../libssh2/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.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for ssh2-python
  Running setup.py clean for ssh2-python
  Building wheel for zope.interface (setup.py) ... done
  Created wheel for zope.interface: filename=zope.interface-6.1-cp37-cp37m-macosx_14_0_arm64.whl size=202524 sha256=d17e1d88242c6aaafb23486ac9291776378a26d096740168ebfabd96f621b092
  Stored in directory: /Users/ekl/Library/Caches/pip/wheels/69/d3/42/5f149ced569a4055b0ce71de34f0285ae7845bac7e0b72780e
  Building wheel for cffi (setup.py) ... done
  Created wheel for cffi: filename=cffi-1.15.1-cp37-cp37m-macosx_14_0_arm64.whl size=174663 sha256=43c782a6100770a0cfb0c72ed3c2e3af2ed306077153b2dd41dea950ac00eb98
  Stored in directory: /Users/ekl/Library/Caches/pip/wheels/04/6e/00/ce829dde11540887b1a7ce4905b5a63c36fa1d6ed8afeacf98
Successfully built parallel-ssh zope.interface cffi
Failed to build ssh2-python
ERROR: Could not build wheels for ssh2-python, which is required to install pyproject.toml-based projects

The use of this library is quite important for me, since work of several scripts that I use in my work depends on it. I attribute the installation issues to the fact that I'm currently using a Macbook Pro with an Apple M1 Pro - I've already encountered problems installing earlier versions of Python because of this.

I also tried upgrade my pip and some other tools with 'python3 -m pip install --upgrade pip setuptools wheel'. This fixed the previous errors during installation, but the error I indicated above did not.

UPDATE

@wombatonfire Thanks for you answer! I installed cmake as per the advice below and now I get the error:

  running build_ext
  building 'pssh.native._ssh2' extension
  creating build/temp.macosx-11.1-arm64-cpython-311
  creating build/temp.macosx-11.1-arm64-cpython-311/pssh
  creating build/temp.macosx-11.1-arm64-cpython-311/pssh/native
  clang -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /Users/ekl/anaconda3/include -arch arm64 -fPIC -O2 -isystem /Users/ekl/anaconda3/include -arch arm64 -I/Users/ekl/anaconda3/include/python3.11 -c pssh/native/_ssh2.c -o build/temp.macosx-11.1-arm64-cpython-311/pssh/native/_ssh2.o -O3
  pssh/native/_ssh2.c:196:12: fatal error: 'longintrepr.h' file not found
    #include "longintrepr.h"
             ^~~~~~~~~~~~~~~
  1 error generated.
  error: command '/usr/bin/clang' failed with exit code 1
  [end of output]  
  note: This error originates from a subprocess, and is likely not a problem with pip.

  ERROR: Failed building wheel for parallel-ssh
  Running setup.py clean for parallel-ssh
  Failed to build parallel-ssh
  ERROR: Could not build wheels for parallel-ssh, which is required to install pyproject.toml-based projects

This error seems very strange to me, since it mentions that I have Anaconda 3.11 installed - but now Python 3.7.12 is selected in my pyenv. I don't understand why the installation just doesn't happen for this version of Python.

UPDATE 2

The problem seems clear (but not the solution). It's strange, but now I can't assign the correct Python version through pyenv - I assign the version through

pyenv global 3.7.16
pyenv local 3.7.16

But when checking the version via python3 --version I'm getting

Python 3.11.5
1

There are 1 best solutions below

3
On

/bin/sh: cmake: command not found - this is the problem, cmake is required to build the wheel for ssh2-python, and you don't have it installed on your system.

You can install cmake with:

  • MacPorts: sudo port install cmake
  • Homebrew: brew install --cask cmake