Ghawken / HomeKitLink-Siri

8 stars 3 forks source link

No module named 'cryptography' #13

Closed compwiz777 closed 2 years ago

compwiz777 commented 2 years ago

I have installed and even uninstalled and reinstalled the cryptography dependency and it shows up as "cryptography==37.0.2"

Followed the instructions more than once for install and no change.

Here is the full error log in indigo:

HomeKitLink Siri Error Error in plugin execution InitializeMain:

File "plugin.py", line 36, in File "/Library/Application Support/Perceptive Automation/Indigo 2022.1/Plugins/HomeKitLink-Siri.indigoPlugin/Contents/Server Plugin/pyhap/accessory_driver.py", line 50, in File "/Library/Application Support/Perceptive Automation/Indigo 2022.1/Plugins/HomeKitLink-Siri.indigoPlugin/Contents/Server Plugin/pyhap/encoder.py", line 9, in type: No module named 'cryptography'

Ghawken commented 2 years ago

It is likely that you have installed library to python2 install:

make sure use pip3 not pip

try again with pip3 and post output

compwiz777 commented 2 years ago

I followed your instructions which use pip3 command. Here is the outputs for installation with and without -H command.

sudo pip3 install cryptography Password: WARNING: The directory '/Users/Admin/Library/Caches/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you should use sudo's -H flag. Requirement already satisfied: cryptography in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (37.0.2) Requirement already satisfied: cffi>=1.12 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from cryptography) (1.14.5) Requirement already satisfied: pycparser in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from cffi>=1.12->cryptography) (2.20) WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv admin@Mac-Mini-Server ~ % sudo -H pip3 install cryptography
Requirement already satisfied: cryptography in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (37.0.2) Requirement already satisfied: cffi>=1.12 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from cryptography) (1.14.5) Requirement already satisfied: pycparser in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from cffi>=1.12->cryptography) (2.20) WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv

Ghawken commented 2 years ago

Odd.

Try without the sudo

Looks like a python install issue; which may be running out of useful suggestions./

Odd that the plugin doesn’t detect cryptography not installed - which it should. Indicating as per PIP that it is installed — just odd that then has that error at that point..

Might what to check that you are installing to Indigo Python3 install - and you don’t have competing Python3 installs floating around your system.

compwiz777 commented 2 years ago

I’m assuming that the plugin is pointing to a python framework that doesn’t have cryptocurrency installed or it’s pointing to the original python 2.7 install not the newer python3 install which I assume it’s not compatible with? Any way to force / make sure plugin is setup to point to proper dependency director like a file I can edit?

here is the result of the new regular install:

pip3 install cryptography Requirement already satisfied: cryptography in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (37.0.2) Requirement already satisfied: cffi>=1.12 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from cryptography) (1.14.5) Requirement already satisfied: pycparser in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from cffi>=1.12->cryptography) (2.20)

Ghawken commented 2 years ago

Its not the plugin. The is set pointing correctly by indigo which manages/starts/runs. It’s your pip command that is likely installing cryptography somewhere else… and your system

https://wiki.indigodomo.com/doku.php?id=indigo_2022.1_documentation:python_packages

Indigo is using python 3.10 - you seem to referencing 3.9 Correct reference is: Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages

Seems your system has multiple python 3 installs and you are installing library to this 3.9 install. Which is also why no one else has reported.

Need to remove the 3.9 install, or at least default to the correct 3.10 as above and install library to it.

compwiz777 commented 2 years ago

Ok per your advice I completely got rid of all versions of python except macOS's 2.7 version and reinstalled python 3.10.

Did a new install of cryptocurrency and this is the new result:

% pip3 install cryptography Collecting cryptography Downloading cryptography-37.0.2-cp36-abi3-macosx_10_10_x86_64.whl (2.8 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.8/2.8 MB 5.7 MB/s eta 0:00:00 Collecting cffi>=1.12 Downloading cffi-1.15.0-cp310-cp310-macosx_10_9_x86_64.whl (178 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 178.9/178.9 KB 6.3 MB/s eta 0:00:00 Collecting pycparser Downloading pycparser-2.21-py2.py3-none-any.whl (118 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 118.7/118.7 KB 6.3 MB/s eta 0:00:00 Installing collected packages: pycparser, cffi, cryptography Successfully installed cffi-1.15.0 cryptography-37.0.2 pycparser-2.21

Went to enable the plugin in indigo and still getting error:

Enabling plugin "HomeKitLink Siri 0.3.1" using API v3.0.0 Starting plugin "HomeKitLink Siri 0.3.1" (pid 1030) HomeKitLink Siri Error Error in plugin execution InitializeMain:

File "plugin.py", line 36, in File "/Library/Application Support/Perceptive Automation/Indigo 2022.1/Plugins/HomeKitLink-Siri.indigoPlugin/Contents/Server Plugin/pyhap/accessory_driver.py", line 50, in File "/Library/Application Support/Perceptive Automation/Indigo 2022.1/Plugins/HomeKitLink-Siri.indigoPlugin/Contents/Server Plugin/pyhap/encoder.py", line 9, in type: No module named 'cryptography'

compwiz777 commented 2 years ago

Here is the list showing installed packages via python 3

% pip3 list Package Version


cffi 1.15.0 cryptography 37.0.2 pip 22.1.1 pycparser 2.21 setuptools 60.10.0 wheel 0.37.1

Ghawken commented 2 years ago

The root issue is your pip3 command is not corresponding to Indigos Python3.10 install.

Indigo installs python - you do not need to, so when you say reinstalled python3 what do you mean?

As I have copied above, that is the correct directory for Indigo python install. Do a pip3 —version as below to check,.

pip3 --version
pip 21.2.4 from /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip (python 3.10)

If all else fails could reinstall Indigo - should just update the paths and the pip3 command to correctly point to indigo, rather than the other Python3 install.

compwiz777 commented 2 years ago

Hi Ghawken,

Thanks for your help. I followed your last bit of advice and found I still had some rouge installs of python. So I was able to go through and manually uninstall all versions of python then installed latest Indigo update and it reinstalled the proper python versions to correct location and then I installed the cryptocurrency dependency and confirmed it now shows up in the proper location and I am finally able to launch the plugin!

Thanks again 😊

Ghawken commented 2 years ago

Good to hear! Well done!