question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[0.7.11] - > Task :python:installBuildRequirements FAILED

See original GitHub issue

Repro:

$ gradlew clean build

Error:

> Task :python:installBuildRequirements FAILED
Error installing package using `[/Users/<>/repo/cs-interview-questions/python/build/venv/bin/python, /Users/<>/repo/cs-interview-questions/python/build/venv/bin/pip, install, --disable-pip-version-check, --no-deps, --upgrade, /Users/<>/.gradle/caches/modules-2/files-2.1/pypi/mccabe/0.5.2/14c5b2794cae2a723cdf4ce520c4e0d8cae62986/mccabe-0.5.2.tar.gz]`
Processing /Users/<>/.gradle/caches/modules-2/files-2.1/pypi/mccabe/0.5.2/14c5b2794cae2a723cdf4ce520c4e0d8cae62986/mccabe-0.5.2.tar.gz
    Complete output from command python setup.py egg_info:
    Couldn't find index page for 'pytest-runner' (maybe misspelled?)
    No local packages or working download links found for pytest-runner
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/1w/20_t1jyx6ggfdscxxg8gq0gw0000gn/T/pip-3RHXIR-build/setup.py", line 57, in <module>
        'Topic :: Software Development :: Quality Assurance',
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 111, in setup
        _setup_distribution = dist = klass(attrs)
      File "/Users/<>/repo/cs-interview-questions/python/build/venv/lib/python2.7/site-packages/setuptools/dist.py", line 317, in __init__
        self.fetch_build_eggs(attrs['setup_requires'])
      File "/Users/<>/repo/cs-interview-questions/python/build/venv/lib/python2.7/site-packages/setuptools/dist.py", line 372, in fetch_build_eggs
        replace_conflicting=True,
      File "/Users/<>/repo/cs-interview-questions/python/build/venv/lib/python2.7/site-packages/pkg_resources/__init__.py", line 846, in resolve
        dist = best[req.key] = env.best_match(req, ws, installer)
      File "/Users/<>/repo/cs-interview-questions/python/build/venv/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1118, in best_match
        return self.obtain(req, installer)
      File "/Users/<>/repo/cs-interview-questions/python/build/venv/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1130, in obtain
        return installer(requirement)
      File "/Users/<>/repo/cs-interview-questions/python/build/venv/lib/python2.7/site-packages/setuptools/dist.py", line 440, in fetch_build_egg
        return cmd.easy_install(req)
      File "/Users/<>/repo/cs-interview-questions/python/build/venv/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 668, in easy_install
        raise DistutilsError(msg)
    distutils.errors.DistutilsError: Could not find suitable distribution for Requirement.parse('pytest-runner')
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/1w/20_t1jyx6ggfdscxxg8gq0gw0000gn/T/pip-3RHXIR-build/


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':python:installBuildRequirements'.
> Failed to install mccabe-0.5.2. Please see above output for reason, or re-run your build using ``gradle -i build`` for additional logging.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 24s
31 actionable tasks: 30 executed, 1 up-to-date

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:1
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
anjaneyulu1989commented, Apr 9, 2018

@zvezdan / @jaredsburrows, Am a new bee to pygradle, Facing the same issue on example-project build.

build.gradle

plugins { id “com.linkedin.python” version “0.7.14” } dependencies { python ‘pypi:requests:2.9.1’ test ‘pypi:mock:1.3.0’ } repositories { pyGradlePyPi() }

Could someone give me the steps to fix this.

1reaction
zvezdancommented, Mar 29, 2018

@ameliedagenais The setup_requires is sometimes necessary – it’s not a bad practice, it’s just that pip does not process it, but rather only setuptools.

@jaredsburrows I don’t know the particular details of your environment, but perhaps the external network access is not allowed so setuptools couldn’t reach pypi.python.org, or some network connection transient issue happened.

We actually provide a feature in pygradle that helps with this. It’s the optional input named distutilsCfg on the InstallVirtualEnvironment task.

In a typical enterprise, the external network access would not be allowed on build hosts. All used Python packages would have to be in an internal PyPI mirror. But then, there must be a way to tell somehow setuptools where to find packages it processes for setup_requires. The feature we provided allows you to define an entry for distutils.cfg file like this:

public static final String DISTUTILS_CFG = """\
        | [easy_install]
        | allow_hosts = *.example.com*
        | index_url = https://something.example.com/path/to/pypi/simple
        | no_find_links = true
        """.stripMargin().stripIndent()

and then use it in the provided input in a project.afterEvaluate closure :

/*
 * Customize distutils.cfg inside the virtualenv to ensure all the
 * packages resolve setup_requires with the same restrictions.
 * This is needed because pip does not resolve setup_requires, setuptools does.
 * See the docs for virtualenv at https://virtualenv.pypa.io and pip at
 * https://pip.pypa.io/en/stable/reference/pip_install/#controlling-setup-requires
 */
project.tasks.withType(InstallVirtualEnvironmentTask) { InstallVirtualEnvironmentTask task ->
    task.distutilsCfg = DISTUTILS_CFG
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found