Home > Blockchain >  Docker: Cannot install specific pip packages
Docker: Cannot install specific pip packages

Time:10-13

I want to install specific packages in a docker container. For most of them, the pip installation works fine. However, it seems like some of the versions of the packages cannot be found.

Here's the requirements.txt file from which I'm installing the packages. It was obtained from pip freeze done in PyCharm from Windows.

Currently, I am trying to install them in Docker working on Ubuntu 20.04.

absl-py==0.13.0
appdirs==1.4.4
argon2-cffi==20.1.0
astunparse==1.6.3
async-generator==1.10
attrs==21.2.0
backcall==0.2.0
bleach==4.0.0
Bottleneck==1.3.2
cachetools==4.2.2
certifi==2021.5.30
cffi==1.14.6
charset-normalizer==2.0.4
cityscapesScripts==2.2.0
colorama==0.4.4
coloredlogs==15.0.1
cycler==0.10.0
decorator==5.0.9
defusedxml==0.7.1
entrypoints==0.3
flatbuffers==1.12
focal-loss==0.0.7
gast==0.4.0
google-auth==1.34.0
google-auth-oauthlib==0.4.6
google-pasta==0.2.0
graphviz==0.17
grpcio==1.34.1
h5py==3.1.0
humanfriendly==9.2
idna==3.2
imageio==2.9.0
importlib-metadata==3.10.0
ipykernel==5.3.4
ipython==7.24.1
ipython-genutils==0.2.0
ipywidgets==7.6.3
jedi==0.18.0
Jinja2==3.0.1
jsonschema==3.2.0
jupyter-client==6.1.12
jupyter-console==6.4.0
jupyter-core==4.7.1
jupyterlab-pygments==0.1.2
jupyterlab-widgets==1.0.0
keras-nightly==2.5.0.dev2021032900
Keras-Preprocessing==1.1.2
kiwisolver==1.3.1
Markdown==3.3.4
MarkupSafe==2.0.1
matplotlib==3.4.2
matplotlib-inline==0.1.2
mistune==0.8.4
mkl-fft==1.3.0
mkl-random==1.2.2
mkl-service==2.4.0
nbclient==0.5.3
nbconvert==6.1.0
nbformat==5.1.3
nest-asyncio==1.5.1
networkx==2.6.2
notebook==6.4.3
numexpr==2.7.3
numpy==1.19.5
oauthlib==3.1.1
opencv-python==4.5.3.56
opt-einsum==3.3.0
packaging==21.0
pandas==1.3.1
pandocfilters==1.4.3
parso==0.8.2
pickleshare==0.7.5
Pillow==8.3.1
pip==21.2.2
prometheus-client==0.11.0
prompt-toolkit==3.0.17
protobuf==3.17.3
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycparser==2.20
pydot==1.4.2
pydot-ng==2.0.0
pydotplus==2.0.2
Pygments==2.10.0
pyparsing==2.4.7
pyquaternion==0.9.9
pyreadline==2.1
pyrsistent==0.17.3
python-dateutil==2.8.2
pytz==2021.1
PyWavelets==1.1.1
pywin32==228
pywinpty==0.5.7
PyYAML==5.4.1
pyzmq==22.2.1
qtconsole==5.1.0
QtPy==1.9.0
requests==2.26.0
requests-oauthlib==1.3.0
rsa==4.7.2
scikit-image==0.18.2
scipy==1.7.1
Send2Trash==1.5.0
setuptools==52.0.0.post20210125
sip==4.19.13
six==1.16.0
tensorboard==2.6.0
tensorboard-data-server==0.6.1
tensorboard-plugin-wit==1.8.0
tensorflow==2.5.1
tensorflow-estimator==2.5.0
termcolor==1.1.0
terminado==0.9.4
testpath==0.5.0
tifffile==2021.8.8
tornado==6.1
tqdm==4.62.0
traitlets==5.0.5
typing==3.7.4.3
typing-extensions==3.7.4.3
urllib3==1.26.6
wcwidth==0.2.5
webencodings==0.5.1
Werkzeug==2.0.1
wheel==0.36.2
widgetsnbextension==3.5.1
wincertstore==0.2
wrapt==1.12.1
zipp==3.5.0

I have this Dockerfile.

FROM tensorflow/tensorflow:2.5.1-gpu

WORKDIR /home/<my-app-name>

COPY ./<my-app-name-code> ./<my-app-name-code>

RUN /usr/bin/python3 -m pip install --upgrade pip
RUN pip install -r ./<my-app-name-code>/requirements.txt

CMD ["python", "./<start-script>"]

In order to create the image, I use this command.

docker build -t my-img <path-to-dockerfile>

Here's the output when the building gets to the point of pip install:

 ---> Running in 13f8507027f0
Requirement already satisfied: absl-py==0.13.0 in /usr/local/lib/python3.6/dist-packages (from -r ./<my-app>/requirements.txt (line 1)) (0.13.0)
... more output of successful installations ...
  Downloading importlib_metadata-3.10.0-py3-none-any.whl (14 kB)
Collecting ipykernel==5.3.4
  Downloading ipykernel-5.3.4-py3-none-any.whl (120 kB)
ERROR: Could not find a version that satisfies the requirement ipython==7.26.0 (from versions: 0.10, 0.10.1, 0.10.2, 0.11, 0.12, 0.12.1, 0.13, 0.13.1, 0.13.2, 1.0.0, 1.1.0, 1.2.0, 1.2.1, 2.0.0, 2.1.0, 2.2.0, 2.3.0, 2.3.1, 2.4.0, 2.4.1, 3.0.0, 3.1.0, 3.2.0, 3.2.1, 3.2.2, 3.2.3, 4.0.0b1, 4.0.0, 4.0.1, 4.0.2, 4.0.3, 4.1.0rc1, 4.1.0rc2, 4.1.0, 4.1.1, 4.1.2, 4.2.0, 4.2.1, 5.0.0b1, 5.0.0b2, 5.0.0b3, 5.0.0b4, 5.0.0rc1, 5.0.0, 5.1.0, 5.2.0, 5.2.1, 5.2.2, 5.3.0, 5.4.0, 5.4.1, 5.5.0, 5.6.0, 5.7.0, 5.8.0, 5.9.0, 5.10.0, 6.0.0rc1, 6.0.0, 6.1.0, 6.2.0, 6.2.1, 6.3.0, 6.3.1, 6.4.0, 6.5.0, 7.0.0b1, 7.0.0rc1, 7.0.0, 7.0.1, 7.1.0, 7.1.1, 7.2.0, 7.3.0, 7.4.0, 7.5.0, 7.6.0, 7.6.1, 7.7.0, 7.8.0, 7.9.0, 7.10.0, 7.10.1, 7.10.2, 7.11.0, 7.11.1, 7.12.0, 7.13.0, 7.14.0, 7.15.0, 7.16.0, 7.16.1)
ERROR: No matching distribution found for ipython==7.26.0
The command '/bin/bash -c pip install -r ./<my-app>/requirements.txt' returned a non-zero code: 1

I have tried this, i.e. to use --network=host. The output is exactly the same.

How can I install those specific packages?

CodePudding user response:

Try to use some other version of ipython.

Replace the python version in your requirements.txt with:

ipython==7.24.1

However, it doesn't have anything to do with docker configuration i.e. --network=host

CodePudding user response:

ipython 7.26.0 requires Python >= 3.7. You're using Python 3.6; the last IPython version that supports Python 3.6 is https://pypi.org/project/ipython/7.16.1/

So either upgrade Python or use a lower IPython version:

pip install -U "ipython < 7.17"
  • Related