← All tasks
pythongoogleapis/python-aiplatform #183Not a task: not reproduced

Fails to install alongside packages that depend on older versions of `mock`

envgap__googleapis__python-aiplatform-183

01 / FAILURE SIGNATURE

As reported upstream

ERROR: google-cloud-aiplatform 0.4.0 has requirement mock>=4.0.2, but you'll have mock 2.0.0 which is incompatible.
Not a benchmark task.
  • In a clean container the reported failure did not reproduce, or the known fix did not make the project run.

02 / ENVIRONMENT RECIPE

Base commit
8c0932f3f4d0e1ac40e55b1f0b2ce67c1873dee6
Manifest
setup.py
Reproduce
Awaiting issue-specific recipe
Run under trace
Awaiting a meaningful runtime command

03 / ORIGINAL ISSUE TEXT

googleapis/python-aiplatform #183 · read the original issue
Hi,



I'm using the latest `pip` version where the default dependency resolver changed, and there are some issues installing `google-cloud-aiplatform` alongside `apache-beam` due to incompatible versions of `mock`.



```sh

(env) ➜  python --version

Python 3.8.5

(env) ➜  pip --version   

pip 20.3.3 from /usr/local/google/home/dcavazos/src/sandbox/env/lib/python3.8/site-packages/pip (python 3.8)

(env) ➜  pip install apache-beam==2.27.0 google-cloud-aiplatform==0.4.0

# Installation fails after a very long time

```



I searched through the `python-aiplatform` repo and `mock` is only used for testing, so it could safely be part of `tests_require` instead of `install_requires` in the [`setup.py`](https://github.com/googleapis/python-aiplatform/blob/master/setup.py) file.



```sh

➜  python-aiplatform git:(master) egrep -R '(import|from) mock' *

tests/unit/gapic/aiplatform_v1beta1/test_specialist_pool_service.py:import mock

tests/unit/gapic/aiplatform_v1beta1/test_dataset_service.py:import mock

tests/unit/gapic/aiplatform_v1beta1/test_endpoint_service.py:import mock

tests/unit/gapic/aiplatform_v1beta1/test_prediction_service.py:import mock

tests/unit/gapic/aiplatform_v1beta1/test_migration_service.py:import mock

tests/unit/gapic/aiplatform_v1beta1/test_model_service.py:import mock

tests/unit/gapic/aiplatform_v1beta1/test_job_service.py:import mock

tests/unit/gapic/aiplatform_v1beta1/test_pipeline_service.py:import mock

```



The `mock` dependency should also be a part of the `tests_require` in Apache Beam as well, but due to [BEAM-8840](https://issues.apache.org/jira/browse/BEAM-8840) the `setup_requires` and `tests_require` sections were removed.



Using an older version of `pip` like `20.2.*` throws an error/warning, but the installation still succeeds.



```sh

# This error/warning shows when using pip 20.2.4, both packages can still be installed.

ERROR: google-cloud-aiplatform 0.4.0 has requirement mock>=4.0.2, but you'll have mock 2.0.0 which is incompatible.

```



Starting with `pip 20.3`, the new dependency resolver cannot install both libraries together due to the `mock` versions incompatibility.



```sh

```



#### Environment details



  - OS type and version: `Linux 5.7.17-1rodete4-amd64 #1 SMP Debian 5.7.17-1rodete4 (2020-10-01) x86_64`

  - Python version: `Python 3.8.5`

  - pip version: `pip 20.3.3 from /usr/local/google/home/dcavazos/src/sandbox/env/lib/python3.8/site-packages/pip (python 3.8)`

  - `google-cloud-aiplatform` version: `0.4.0` but cannot be installed alongside `apache-beam==2.27.0`



#### Steps to reproduce



1. Update `pip` to the latest version.

   ```sh

   pip install -U pip

   ```



2. Install `apache-beam` and `google-cloud-aiplatform` (it takes a _really long_ time to resolve dependencies as well, but that's out of the scope for this).

   ```sh

   pip install apache-beam==2.27.0 google-cloud-aiplatform==0.4.0

   ```



#### Suggested fix



In the [`setup.py`](https://github.com/googleapis/python-aiplatform/blob/master/setup.py) file, create a new section called `tests_require` and move the `mock` dependency to it.



#### Workaround



In the meantime, the only workaround is to force downgrading your `pip` version before installing your requirements, which is not always possible in some managed services.



```sh

pip install -U pip=='20.2.*'

pip install -r requirements.txt

```
Continue on GitHub ↗

04 / LABELS

Labels from the report text only; not yet run

No supported category has been assigned.

Label rules and the text that matched
[]