Installing a custom version of a Python package with pip3
pip (also known as pip3 in Python 3) is a package-management system (written in Python) and is used to install and manage Python software packages.
The Problem
I came to install a package called gradio
using the command pip3 install gradio
as shown:
dev@apache-dev:/home/dev> pip3 install gradio
.
.
.
Installing collected packages: mdurl, attrs, uc-micro-py, multidict, markdown-it-py, frozenlist, cffi, yarl, starlette, pynacl, pillow, monotonic, mdit-py-plugins, linkify-it-py, kiwisolver, idna-ssl, h11, cycler, cryptography, charset-normalizer, bcrypt, backoff, asynctest, async-timeout, asgiref, aiosignal, uvicorn, python-multipart, pydub, pycryptodome, paramiko, orjson, matplotlib, ffmpy, fastapi, analytics-python, aiohttp, gradio
Running setup.py install for idna-ssl ... done
Running setup.py install for python-multipart ... done
Running setup.py install for ffmpy ... done
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
oci 2.85.0 requires cryptography<=37.0.2,>=3.2.1, but you have cryptography 40.0.2 which is incompatible.
Successfully installed aiohttp-3.8.6 aiosignal-1.2.0 analytics-python-1.4.post1 asgiref-3.4.1 async-timeout-4.0.2 asynctest-0.13.0 attrs-21.4.0 backoff-1.10.0 bcrypt-4.0.1 cffi-1.15.1 charset-normalizer-3.0.1 cryptography-40.0.2 cycler-0.11.0 fastapi-0.68.2 ffmpy-0.3.2 frozenlist-1.2.0 gradio-3.0.12 h11-0.13.0 idna-ssl-1.1.0 kiwisolver-1.3.1 linkify-it-py-1.0.3 markdown-it-py-2.0.1 matplotlib-3.3.4 mdit-py-plugins-0.3.0 mdurl-0.1.0 monotonic-1.6 multidict-5.2.0 orjson-3.6.1 paramiko-3.4.0 pillow-8.4.0 pycryptodome-3.20.0 pydub-0.25.1 pynacl-1.5.0 python-multipart-0.0.5 starlette-0.14.2 uc-micro-py-1.0.1 uvicorn-0.16.0 yarl-1.7.2
The Warning
You'll notice that towards the end output, there's a message that says oci 2.85.0 requires cryptography<=37.0.2,>=3.2.1, but you have cryptography 40.0.2 which is incompatible.
So apparently I have the cryptography
package version 40.0.2 which is already installed but incompatible with another oci
package with version 2.85.0 that was bundled with the gradio
package.
The Solution
Explicitly specify the version of the package as shown:
pip install cryptography==37.0.2