keylime / keylime

A CNCF Project to Bootstrap & Maintain Trust on the Edge / Cloud and IoT
https://keylime.dev
Apache License 2.0
415 stars 148 forks source link

`installer.sh` fails to recognize when Python packages were not installed #1089

Open mayaCostantini opened 2 years ago

mayaCostantini commented 2 years ago

Environment

Description

The installer.sh script does not recognize when some Python packages were not installed properly. For example, when running ./installer.sh, the output at the Installing python & crypto libs step shows that:

Package python3-cryptography-3.2.1-5.el8.x86_64 is already installed.
...
Package python3-tornado-6.0.2-1.el8.x86_64 is already installed.
Package python3-zmq-19.0.0-1.el8.x86_64 is already installed.

With versions matching the requirements specified in the script: https://github.com/keylime/keylime/blob/8ac59a9620acfa967b73cd68df3f416aa57e380f/installer.sh#L20-L22

However, the installer.sh produces the following errors:

...
Dependencies resolved.
Nothing to do.
Complete!
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'tornado'
ERROR: Minimum python-tornado version is 4.3, but is installed!
This may introduce security issues, instability or an incomplete install!  Continue? [y/N] y
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'zmq'
ERROR: Minimum python-zmq version is 14.4, but is installed!
This may introduce security issues, instability or an incomplete install!  Continue? [y/N] y
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'cryptography'
ERROR: Minimum python-cryptography version is 2.1.4, but is installed!

(notice the missing version in the error message)

And after verification, two of the packages are not installed on my system:

python3 -c 'import tornado; print(tornado.version)'

Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'tornado'
python3 -c 'import zmq; print(zmq.__version__)'

Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'zmq'

And one is present in a correct version:

python3 -c 'import cryptography; print(cryptography.__version__)'

37.0.4

Expected behavior vs. actual behavior

installer.sh should handle packages that were not properly installed and propagate the issue in the error message.

Steps to reproduce problem

Run the ./installer.sh command.

github-actions[bot] commented 2 years ago

Thank you for reporting your first issue. If the issue relates to a change you intend to work on, please ask that someone assign it to you.

mpeters commented 2 years ago

This seems like it might be a mismatch between expected python versions installed and/or python paths. Do you have multiple versions of python installed?

For more information, it's using your package manager to install the python3-tornado. What happens when you do this by hand? Where does it get installed? Does python3 still not find it?