Failed to install pip3 dependencies

If you encounter the following issue when running the Filescan installation script:

Fatal error: failed to install additional pip3 dependencies. Exiting...

then very likely, the pip package manager is broken on your Ubuntu installation due to a bug in the pyopenssl Python package.

You can find more details in this question: https://stackoverflow.com/questions/73830524/attributeerror-module-lib-has-no-attribute-x509-v-flag-cb-issuer-check

First of all, run this command to check if pip is in a broken state:

pip3 --version

When pip is broken, the output will be similar to this:

Traceback (most recent call last):
File "/usr/bin/pip3", line 11, in <module>
load_entry_point('pip==20.0.2', 'console_scripts', 'pip3')()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 490, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2854, in load_entry_point
return ep.load()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2445, in load
return self.resolve()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2451, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/usr/lib/python3/dist-packages/pip/_internal/cli/main.py", line 10, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/usr/lib/python3/dist-packages/pip/_internal/cli/autocompletion.py", line 9, in <module>

Fixing the issue

To fix the broken pip, run these commands to remove the python3-pipapt`` package and install the latest pip from pypa.io :

sudo apt remove python3-pip
wget https://bootstrap.pypa.io/get-pip.py
sudo python3 get-pip.py

Please reboot your system (or log out and log in again), then check if pip is working.

You should see a pip version number like this:

pip3 --version
pip 23.0.1 from /usr/local/lib/python3.8/dist-packages/pip (python 3.8)

It is also recommended to upgrade the pyopenssl package to avoid this issue in the future:

sudo pip3 install pyopenssl --upgrade

If you encounter the following issue when running the Filescan installation script:

ERROR: Failed building wheel for yara-python

To fix the the issue, run the following command to install yara-python library:

sudo pip3 install yara-python==4.2.3 --use-pep517