I'm trying to install ansible-pylibssh
on an Apple Silicon based Mac.
ansible
is already installed.
When running pip3 install ansible-pylibssh
I get the following error:
pip3 install --user ansible-pylibssh 1 ✘ took 3s at 00:36:15
Collecting ansible-pylibssh
Using cached ansible-pylibssh-1.0.0.tar.gz (97 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: ansible-pylibssh
Building wheel for ansible-pylibssh (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for ansible-pylibssh (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [18 lines of output]
[1/1] Cythonizing /private/var/folders/6l/48k83hdn30bc24655lbtzgx80000gn/T/pip-install-lme1njwa/ansible-pylibssh_0b7185d13e5244b3982c6d892f55319b/src/pylibsshext/_libssh_version.pyx
running build_ext
creating /private/var/folders/6l/48k83hdn30bc24655lbtzgx80000gn/T/pip-install-lme1njwa/ansible-pylibssh_0b7185d13e5244b3982c6d892f55319b/src/tmpa3ax4nf7/private
creating /private/var/folders/6l/48k83hdn30bc24655lbtzgx80000gn/T/pip-install-lme1njwa/ansible-pylibssh_0b7185d13e5244b3982c6d892f55319b/src/tmpa3ax4nf7/private/var
creating /private/var/folders/6l/48k83hdn30bc24655lbtzgx80000gn/T/pip-install-lme1njwa/ansible-pylibssh_0b7185d13e5244b3982c6d892f55319b/src/tmpa3ax4nf7/private/var/folders
creating /private/var/folders/6l/48k83hdn30bc24655lbtzgx80000gn/T/pip-install-lme1njwa/ansible-pylibssh_0b7185d13e5244b3982c6d892f55319b/src/tmpa3ax4nf7/private/var/folders/6l
creating /private/var/folders/6l/48k83hdn30bc24655lbtzgx80000gn/T/pip-install-lme1njwa/ansible-pylibssh_0b7185d13e5244b3982c6d892f55319b/src/tmpa3ax4nf7/private/var/folders/6l/48k83hdn30bc24655lbtzgx80000gn
creating /private/var/folders/6l/48k83hdn30bc24655lbtzgx80000gn/T/pip-install-lme1njwa/ansible-pylibssh_0b7185d13e5244b3982c6d892f55319b/src/tmpa3ax4nf7/private/var/folders/6l/48k83hdn30bc24655lbtzgx80000gn/T
creating /private/var/folders/6l/48k83hdn30bc24655lbtzgx80000gn/T/pip-install-lme1njwa/ansible-pylibssh_0b7185d13e5244b3982c6d892f55319b/src/tmpa3ax4nf7/private/var/folders/6l/48k83hdn30bc24655lbtzgx80000gn/T/pip-install-lme1njwa
creating /private/var/folders/6l/48k83hdn30bc24655lbtzgx80000gn/T/pip-install-lme1njwa/ansible-pylibssh_0b7185d13e5244b3982c6d892f55319b/src/tmpa3ax4nf7/private/var/folders/6l/48k83hdn30bc24655lbtzgx80000gn/T/pip-install-lme1njwa/ansible-pylibssh_0b7185d13e5244b3982c6d892f55319b
creating /private/var/folders/6l/48k83hdn30bc24655lbtzgx80000gn/T/pip-install-lme1njwa/ansible-pylibssh_0b7185d13e5244b3982c6d892f55319b/src/tmpa3ax4nf7/private/var/folders/6l/48k83hdn30bc24655lbtzgx80000gn/T/pip-install-lme1njwa/ansible-pylibssh_0b7185d13e5244b3982c6d892f55319b/src
creating /private/var/folders/6l/48k83hdn30bc24655lbtzgx80000gn/T/pip-install-lme1njwa/ansible-pylibssh_0b7185d13e5244b3982c6d892f55319b/src/tmpa3ax4nf7/private/var/folders/6l/48k83hdn30bc24655lbtzgx80000gn/T/pip-install-lme1njwa/ansible-pylibssh_0b7185d13e5244b3982c6d892f55319b/src/pylibsshext
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/include/python3.9 -c /private/var/folders/6l/48k83hdn30bc24655lbtzgx80000gn/T/pip-install-lme1njwa/ansible-pylibssh_0b7185d13e5244b3982c6d892f55319b/src/pylibsshext/_libssh_version.c -o /private/var/folders/6l/48k83hdn30bc24655lbtzgx80000gn/T/pip-install-lme1njwa/ansible-pylibssh_0b7185d13e5244b3982c6d892f55319b/src/tmpa3ax4nf7/private/var/folders/6l/48k83hdn30bc24655lbtzgx80000gn/T/pip-install-lme1njwa/ansible-pylibssh_0b7185d13e5244b3982c6d892f55319b/src/pylibsshext/_libssh_version.o
/private/var/folders/6l/48k83hdn30bc24655lbtzgx80000gn/T/pip-install-lme1njwa/ansible-pylibssh_0b7185d13e5244b3982c6d892f55319b/src/pylibsshext/_libssh_version.c:757:10: fatal error: 'libssh/libssh.h' file not found
#include "libssh/libssh.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 ansible-pylibssh
Failed to build ansible-pylibssh
ERROR: Could not build wheels for ansible-pylibssh, which is required to install pyproject.toml-based projects
However libssh
is already installed:
brew install libssh
Warning: libssh 0.10.4 is already installed and up-to-date.
To reinstall 0.10.4, run:
brew reinstall libssh
I have tried reinstalling ansible
, libssh
, none of them worked.
CodePudding user response:
The problem was with the package not my computer.
It seems that Github Actions are not available for ARM Macs so no dists were built for this platform.
Manually building and installing from source worked:
$ git clone https://github.com/ansible/pylibssh.git
$ cd pylibssh
$ pip install tox
$ tox -e build-dists
Installing:
cd dist
pip3 install ansible_pylibssh-1.0.1.dev47 g75289d4-cp39-cp39-macosx_12_0_arm64.whl
Defaulting to user installation because normal site-packages is not writeable
Processing ./ansible_pylibssh-1.0.1.dev47 g75289d4-cp39-cp39-macosx_12_0_arm64.whl
Installing collected packages: ansible-pylibssh
Successfully installed ansible-pylibssh-1.0.1.dev47 g75289d4
CodePudding user response:
I'm having the same problem as you, this issue was finally solved today. When i manually building and installing from source, still run into this problem:
#include "libssh/libssh.h"
^~~~~~~~~~~~~~~~~
1 error generated.
error: command '/usr/bin/clang' failed with exit code 1
This is because the libssh library was not discovered by clang, so we manually added a softlink to solve it.
- Find out the lib dir:
% clang -E -x c - -v < /dev/null
Apple clang version 14.0.0 (clang-1400.0.29.102)
Target: arm64-apple-darwin21.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
......
ignoring nonexistent directory "/usr/include"
#include "..." search starts here:
#include <...> search starts here:
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
/Library/Developer/CommandLineTools/usr/include
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks (framework directory)
End of search list.
......
- Create a softlink for libssh:
% cd /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
% sudo ln -s /opt/homebrew/Cellar/libssh/0.10.4/include/libssh/ libssh
- Rebuilding and installing from source, Worked!