What Do I Do If "subprocess.CalledProcessError: Command '('lsb_release', '-a')' return non-zero exit status 1" Is Displayed During pip3 Installation?

Symptom

During dependency installation, the error message "subprocess.CalledProcessError: Command '('lsb_release', '-a')' return non-zero exit status 1" is displayed when you run the pip3 install xxx command to install related software. The error message is as follows:

Possible Cause

When the subprocess module of Python 3.7.5 is executed, the system displays a message indicating that the lsb_release.py module cannot be found when the lsb_release -a command is executed. The lib path of Python 3.7.5 is /usr/local/python3.7.5/lib/python3.7/. The lsb_release.py module does not exist in the path. Therefore, an error is reported.

Solution

  1. Run the following command to search for the missing file lsb_release.py:
    find / -name lsb_release
    After the preceding command is run, the following path is obtained (the actual path may be different):
    /usr/bin/lsb_release
  2. Run the following command to back up the /usr/bin/lsb_release file in Step 1:
    mv /usr/bin/lsb_release /usr/bin/lsb_release.bak
  3. Run the pip3 install xxx command to check whether the fault is rectified.