Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
davidcavazos opened this issue Jan 22, 2021 · 3 comments · Fixed by #187
Closed

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

davidcavazos opened this issue Jan 22, 2021 · 3 comments · Fixed by #187
Assignees

Comments

@davidcavazos
Copy link

davidcavazos commented Jan 22, 2021

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.

(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 file.

➜  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 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.

# 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.

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.

    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).

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

Suggested fix

In the 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.

pip install -U pip=='20.2.*'
pip install -r requirements.txt
@dizcology
Copy link
Contributor

@busunkim96 I think mock is included in the generated setup.py, is this something we should change upstream in the library generator templates?

@busunkim96
Copy link
Contributor

@dizcology
Copy link
Contributor

Thanks - looks like I added it manually a while back and I am no longer sure why.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants