ModuleNotFoundError: import ssh2.session
I tried everything to make this work:
brew install cmake
brew install libssh2
pip install --upgrade pip setuptools wheel
pip install ssh2-python
brew info libssh2
Everything seems to work but when I try to run my python code it fails on the import!!!
Thanks for the interest.
pip show ssh2-python will confirm it is installed. python -c 'import ssh2.session' to confirm it is installed correctly.
Use command line and show steps to reproduce with error message(s) if you think there is an issue with the library.
@pkittenis Thank you for answering the issue I created.
I run both commands. The second command fails.
% pip show ssh2-python main
Name: ssh2-python
Version: 1.1.2.post1
Summary: Bindings for libssh2 C library
Home-page: https://github.com/ParallelSSH/ssh2-python
Author: Panos Kittenis
Author-email: [email protected]
License: LGPLv2
Location: /usr/local/lib/python3.11/site-packages
Requires:
Required-by:
% python3 -c 'import ssh2.session'
Traceback (most recent call last):
File "<string>", line 1, in <module>
import ssh2.session
ModuleNotFoundError: No module named 'ssh2'
Your pip seems to not match your python3 version.
Use python3 -m pip install ssh2-python if you are not sure which pip is for which python.