Error Message "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 Causes

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. 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:
    1
    find / -name lsb_release
    
    After the preceding command is executed, the following path is obtained. The path is only an example and may vary according to the actual situation.
    1
    /usr/bin/lsb_release
    
  2. Run the following command to back up the /usr/bin/lsb_release file in Step 1:
    1
    mv /usr/bin/lsb_release /usr/bin/lsb_release.bak
    
  3. Run the following command to check whether the fault is rectified.
    1
    pip3 list