1

I'm setting up a RHEL8 (8.7) based Docker container, with Python 3.8.13 installed (installed python3-pip, python3.6, python 3.8 and 3.9 too). I have tried to install some Python libraries using requirements.txt:

RUN pip3 install -r requirements.txt

The txt file is recognized, some of the requirements are found and installed, but some of them are exiting with the failure code: 1 For example, I want to install joblib 1.2.0 and numpy 1.23.2, so my requirements.txt file has the following entries too:

joblib == 1.2.0
numpy == 1.23.2

But the build exits with the following as soon as it reaches the "joblib" line:

Collecting joblib==1.2.0 (from -r requirements.txt (line1))
Could not find a version that satisfies the requirement joblib==1.2.0 (from -r requirements.txt (line1)) (from versions: 0.3.2d.dev, ..*omitting a massive list of versions*.. 1.1.0, 1.1.1)
No matching distribution found for joblib==1.2.0 (from -r requirements.txt (line1))
error building image: error building stage: failed to execute command: waiting for process to exit: exit status 1

I have tried to install EPEL and probably install Python 3.10 or 3.11 but did not succeed, probably not supported by RHEL8. I have gone through the following checks advised for cases when pip does not find the correct version:

  • pip install -r requirements.txt command is indeed running with the -r option.
  • version of pip is pip3, matching the installed Python3
  • name of the module is not misspelled, correct
  • the listed modules are not built-in modules (they indeed have to be installed separately)
  • package does support the version of Python: Joblib 1.2.0 supported Python versions are 3.7+ (as stated, 3.8 and 3.9 is installed too) Numpy 1.23.2 supported Python versions are 3.8-3.11 So these should be visible for pip3 installer - yet they are not, Joblib max offered version is 1.1.1... Is there a workaround or solution for this?
Nysa-522
  • 49
  • 3
  • "*version of pip is pip3, matching the installed Python3*" But what is the version? `pip3 --version` ? From the list of available `joblib` versions I guess it's Python 3.6, not 3.7. – phd Feb 07 '23 at 17:22
  • 1
    Thanks for the reply. It is "pip 9.0.3 from /usr/lib/python3.6/site-packages (python 3.6)" - so you were correct. How do I change / upgrade it to 3.7 or higher? – Nysa-522 Feb 07 '23 at 19:05
  • `RUN pip3.7 install -r requirements.txt` and then use `python3.7` instead of `python3`. – phd Feb 07 '23 at 19:27
  • Does it work with python3.8 as well? So like running pip install in form of "RUN pip3.8 install -r requirements.txt" after only python3.8 is installed on the container? – Nysa-522 Feb 07 '23 at 19:57
  • Should work with any version. `RUN python3.8 -m pip install -r requirements.txt` also should work. – phd Feb 07 '23 at 20:07
  • Thank you so much! I will check and let you know if worked. – Nysa-522 Feb 07 '23 at 21:28
  • Thanks again, it worked following the second syntax: RUN python3.8 -m pip install -r requirements.txt – Nysa-522 Feb 08 '23 at 18:58

0 Answers0