Conflicting with version dependencies when running pip install

  django, docker, pip, python-3.x

Having issues with version dependencies when running pip install on docker. However, when installing on my mac without docker and just virtualenv, works perfectly fine.

These are the versions I used on my local machine:

  1. Mac OS – macOS Mojave v10.14.
  2. Python Version – v3.7.3
  3. Docker Compose Version – version 1.27.4, build 40524192

Here’s the first error I got when running the docker-compose up

ERROR: Cannot install -r ./python-project/requirements/base.txt (line 104), -r ./python-project/requirements/base.txt (line 109), -r ./python-project/requirements/base.txt (line 114), -r ./python-project/requirements/base.txt (line 116), -r ./python-project/requirements/base.txt (line 141), -r ./python-project/requirements/base.txt (line 144), -r ./python-project/requirements/base.txt (line 145), -r ./python-project/requirements/base.txt (line 87) and six==1.10.0 because these package versions have conflicting dependencies.

The conflict is caused by:
    The user requested six==1.10.0
    bcrypt 3.2.0 depends on six>=1.4.1
    cvxpy 1.0.25 depends on six
    django-anymail 0.5 depends on six
    django-compat 1.0.15 depends on six>=1.10.0
    django-extensions 2.2.1 depends on six>=1.2
    drf-yasg 1.16.1 depends on six>=1.10.0
    fake-factory 0.6.0 depends on six
    google-api-core 1.26.0 depends on six>=1.13.0

To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict

ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/user_guide/#fixing-conflicting-dependencies
ERROR: Service 'backend' failed to build : The command '/bin/sh -c pip install -r ./python-project/requirements/base.txt' returned a non-zero code: 1

I tried to loosen the six package from six==1.10.0 to six>=1.2,<=1.15.0

And throws a different error for requests package this time. Here’s the error

ERROR: Cannot install -r ./python-project/requirements/base.txt (line 1), -r ./python-project/requirements/base.txt (line 10), -r ./python-project/requirements/base.txt (line 109), -r ./python-project/requirements/base.txt (line 13), -r ./python-project/requirements/base.txt (line 145), -r ./python-project/requirements/base.txt (line 159), -r ./python-project/requirements/base.txt (line 166), -r ./python-project/requirements/base.txt (line 79), -r ./python-project/requirements/base.txt (line 81), -r ./python-project/requirements/base.txt (line 83), -r ./python-project/requirements/base.txt (line 9), -r ./python-project/requirements/base.txt (line 97) and requests==2.22.0 because these package versions have conflicting dependencies.

The conflict is caused by:
    The user requested requests==2.22.0
    adal 1.2.6 depends on requests<3 and >=2.0.0
    azure-cosmosdb-table 1.0.6 depends on requests
    azure-datalake-store 0.0.51 depends on requests>=2.20.0
    azure-keyvault 1.1.0 depends on requests>=2.18.4
    azure-servicebus 0.21.1 depends on requests
    azure-servicemanagement-legacy 0.20.7 depends on requests
    azure-storage-common 1.4.2 depends on requests
    coreapi 2.3.3 depends on requests
    django-anymail 0.5 depends on requests>=2.4.3
    google-api-core 1.26.0 depends on requests<3.0.0dev and >=2.18.0
    jira 2.0.0 depends on requests>=2.10.0
    microsofthealth 0.1.0 depends on requests==2.12.1

To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict

ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/user_guide/#fixing-conflicting-dependencies
ERROR: Service 'backend' failed to build : The command '/bin/sh -c pip install -r ./python-project/requirements/base.txt' returned a non-zero code: 1

After changing the package from requests==2.22.0 to requests>=2.0.0,<=2.25.1. Now, it takes ages to finish the installation.

Collecting azure-common~=1.1
  Downloading azure_common-1.1.25-py2.py3-none-any.whl (12 kB)
  Downloading azure_common-1.1.24-py2.py3-none-any.whl (12 kB)
  Downloading azure_common-1.1.23-py2.py3-none-any.whl (11 kB)
  Downloading azure_common-1.1.22-py2.py3-none-any.whl (11 kB)
  Downloading azure_common-1.1.21-py2.py3-none-any.whl (11 kB)
  Downloading azure_common-1.1.20-py2.py3-none-any.whl (11 kB)
  Downloading azure_common-1.1.19-py2.py3-none-any.whl (11 kB)
  Downloading azure_common-1.1.18-py2.py3-none-any.whl (12 kB)
  Downloading azure_common-1.1.17-py2.py3-none-any.whl (10 kB)
  Downloading azure_common-1.1.16-py2.py3-none-any.whl (10 kB)
  Downloading azure_common-1.1.15-py2.py3-none-any.whl (10 kB)
  Downloading azure_common-1.1.14-py2.py3-none-any.whl (10 kB)
  Downloading azure_common-1.1.13-py2.py3-none-any.whl (10 kB)
  Downloading azure_common-1.1.12-py2.py3-none-any.whl (9.7 kB)
  Downloading azure_common-1.1.11-py2.py3-none-any.whl (9.7 kB)
  Downloading azure_common-1.1.10-py2.py3-none-any.whl (9.6 kB)
  Downloading azure_common-1.1.9-py2.py3-none-any.whl (10 kB)
  Downloading azure_common-1.1.8-py2.py3-none-any.whl (7.9 kB)
  Downloading azure_common-1.1.7-py2.py3-none-any.whl (7.7 kB)
  Downloading azure_common-1.1.6-py2.py3-none-any.whl (5.9 kB)
  Downloading azure_common-1.1.5-py2.py3-none-any.whl (4.1 kB)
  Downloading azure_common-1.1.4-py2.py3-none-any.whl (4.9 kB)
  Downloading azure_common-1.1.3-py2.py3-none-any.whl (4.9 kB)
  Downloading azure_common-1.1.2-py2.py3-none-any.whl (4.9 kB)
  Downloading azure_common-1.1.1-py2.py3-none-any.whl (4.8 kB)
  Downloading azure_common-1.1.0-py2.py3-none-any.whl (4.8 kB)
INFO: pip is looking at multiple versions of azure-cosmosdb-table to determine which version is compatible with other requirements. This could take a while.
INFO: This is taking longer than usual. You might need to provide the dependency resolver with stricter constraints to reduce runtime. If you want to abort this run, you can press Ctrl + C to do so. To improve how pip performs, tell us what happened here: https://pip.pypa.io/surveys/backtracking
INFO: pip is looking at multiple versions of azure-common to determine which version is compatible with other requirements. This could take a while

Source: Docker Questions

LEAVE A COMMENT