Search code examples
pythondockerpipdockerfile

Can't install Python math library in Docker image


I am building a docker image. I have this command in Dockerfile -

pip3 install -r requirements.txt

The contents of the requirement.txt are -

  • pybind11
  • cppimport
  • jupyter
  • numpy
  • pandas
  • scikit-learn
  • math
  • random

Everything installs as it should other than "math". When Installing math following error message occurs -

ERROR: Could not find a version that satisfies the requirement math (from -r requirements.txt (line 7)) (from versions: none) ERROR: No matching distribution found for math (from -r requirements.txt (line 7))

How can I solve this and install math?


Solution

  • math is a built in library for python. You don't need to install it. Just remove it from requirements.txt.

    If you are having a similar problem importing other Python modules in a Docker image using the requirements.txt file, make sure it is not one of Python's many, many other built-in functions. The complete list is here: https://docs.python.org/3.8/py-modindex.html

    (Select the appropriate version from the dropdown menu at the top of the page.)