pyupio / dparse

A parser for Python dependency files
MIT License
61 stars 23 forks source link

Make pytest-runner a conditional requirement in setup.py #16

Closed schamp closed 6 years ago

schamp commented 6 years ago

Description

I was installing dparse using pipenv, and during the setup.py egg_info process, it failed with an error similar to this: https://stackoverflow.com/questions/44375119/buildroot-installing-of-the-pytest-runner-package-fails

Upon digging in, I found the recommendation in the pytest-runner page (https://github.com/pytest-dev/pytest-runner#conditional-requirement) to make pytest-runner a conditional requirement only when tests are being invoked.

What I Did

I applied the patch as recommended, pointed my Pipfile.lock to the alternate repo, and the install worked properly.

schamp commented 6 years ago

Here's the error output from the pipenv install, if it's any use:

Collecting dparse==0.2.1
  1 location(s) to search for versions of dparse:
  * https://pypi.python.org/simple/dparse/
  Getting page https://pypi.python.org/simple/dparse/
  Looking up "https://pypi.python.org/simple/dparse/" in the cache
  Current age based on date: 292
  Freshness lifetime from max-age: 600
  Freshness lifetime from request max-age: 600
  The response is "fresh", returning cached response
  600 > 292
  Analyzing links from page https://pypi.python.org/simple/dparse/
    Skipping link https://pypi.python.org/packages/0a/6b/2481b66ce4dd346a64355d683004cd67aec18625135950371eda0796e701/dparse-0.1.0-py2-none-any.whl#md5=f8ede457a98883222d0f005950392295 (from https://pypi.python.org/simple/dparse/); it is not compatible with this Python
    Skipping link https://pypi.python.org/packages/2b/4a/bc4b626bba95201368260c009c24be47f408f23005edb4fab3df95d070f4/dparse-0.2.0-py2-none-any.whl#md5=c8beb3c5ea7dfa3c594aa2c46200b782 (from https://pypi.python.org/simple/dparse/); it is not compatible with this Python
    Skipping link https://pypi.python.org/packages/3a/d6/ff118373ed355aab395b68faf1f06b1381b7ce8a418a50640767df829783/dparse-0.2.1-py2-none-any.whl#md5=e87c298adc5087ab59ed3633acc7222f (from https://pypi.python.org/simple/dparse/); it is not compatible with this Python
    Found link https://pypi.python.org/packages/3b/f1/4db6b93683edb017ea1523ab2f7b0159420904daa2bdb77956ec47ae7a48/dparse-0.1.0.tar.gz#md5=b12088a0d4a010afd50b90f055ac3f4d (from https://pypi.python.org/simple/dparse/), version: 0.1.0
    Found link https://pypi.python.org/packages/40/78/f5d9458904c0586b2d6d07c6bdd821c443ffc54983e0ca9e08cbcbcf3d92/dparse-0.2.1.tar.gz#md5=51e718d64a2de13409d754e4f93665c5 (from https://pypi.python.org/simple/dparse/), version: 0.2.1
    Found link https://pypi.python.org/packages/96/c9/5128351d7852f139ef61585a55957fcf54bbb58613a19831a2b212c9c589/dparse-0.2.0.tar.gz#md5=d38c81647900bff43890d21650677096 (from https://pypi.python.org/simple/dparse/), version: 0.2.0
    Found link https://pypi.python.org/packages/b7/29/7fad5cf9d0c72d664b6a7e9e2200012d07e7583e6e6ba9101123e0e6faea/dparse-0.1.1.tar.gz#md5=fee423eb1aba64ec455cc21b4f2fdf33 (from https://pypi.python.org/simple/dparse/), version: 0.1.1
    Skipping link https://pypi.python.org/packages/e5/8d/888d1144e7c86b0df7da2be1b16a49fd61211c9a1da60897694f7a987193/dparse-0.1.1-py2-none-any.whl#md5=5fb9e36b4bb3793e40c2f0478cf8727b (from https://pypi.python.org/simple/dparse/); it is not compatible with this Python
  Using version 0.2.1 (newest of versions: 0.2.1)
  Looking up "https://pypi.python.org/packages/40/78/f5d9458904c0586b2d6d07c6bdd821c443ffc54983e0ca9e08cbcbcf3d92/dparse-0.2.1.tar.gz" in the cache
  Current age based on date: 292
  Freshness lifetime from max-age: 31557600
  The response is "fresh", returning cached response
  31557600 > 292
  Using cached dparse-0.2.1.tar.gz
  Downloading from URL https://pypi.python.org/packages/40/78/f5d9458904c0586b2d6d07c6bdd821c443ffc54983e0ca9e08cbcbcf3d92/dparse-0.2.1.tar.gz#md5=51e718d64a2de13409d754e4f93665c5 (from https://pypi.python.org/simple/dparse/)
  Running setup.py (path:/tmp/pip-build-9_d7qfrg/dparse/setup.py) egg_info for package dparse
    Running command python setup.py egg_info
    Download error on http://devpi:3141/root/pypi/+simple/pytest-runner/: [Errno -2] Name or service not known -- Some packages may not be found!
    Couldn't find index page for 'pytest-runner' (maybe misspelled?)
    Download error on http://devpi:3141/root/pypi/+simple/: [Errno -2] Name or service not known -- Some packages may not be found!
    No local packages or working download links found for pytest-runner
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-9_d7qfrg/dparse/setup.py", line 57, in <module>
        setup_requires=setup_requirements,
      File "/usr/local/lib/python3.6/site-packages/setuptools/__init__.py", line 128, in setup
        _install_setup_requires(attrs)
      File "/usr/local/lib/python3.6/site-packages/setuptools/__init__.py", line 123, in _install_setup_requires
        dist.fetch_build_eggs(dist.setup_requires)
      File "/usr/local/lib/python3.6/site-packages/setuptools/dist.py", line 455, in fetch_build_eggs
        replace_conflicting=True,
      File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 866, in resolve
        replace_conflicting=replace_conflicting
      File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1146, in best_match
        return self.obtain(req, installer)
      File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1158, in obtain
        return installer(requirement)
      File "/usr/local/lib/python3.6/site-packages/setuptools/dist.py", line 522, in fetch_build_egg
        return cmd.easy_install(req)
      File "/usr/local/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 667, in easy_install
        raise DistutilsError(msg)
    distutils.errors.DistutilsError: Could not find suitable distribution for Requirement.parse('pytest-runner')
Cleaning up...
Exception information:
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/usr/local/lib/python3.6/site-packages/pip/commands/install.py", line 335, in run
    wb.build(autobuilding=True)
  File "/usr/local/lib/python3.6/site-packages/pip/wheel.py", line 749, in build
    self.requirement_set.prepare_files(self.finder)
  File "/usr/local/lib/python3.6/site-packages/pip/req/req_set.py", line 380, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "/usr/local/lib/python3.6/site-packages/pip/req/req_set.py", line 634, in _prepare_file
    abstract_dist.prep_for_dist()
  File "/usr/local/lib/python3.6/site-packages/pip/req/req_set.py", line 129, in prep_for_dist
    self.req_to_install.run_egg_info()
  File "/usr/local/lib/python3.6/site-packages/pip/req/req_install.py", line 439, in run_egg_info
    command_desc='python setup.py egg_info')
  File "/usr/local/lib/python3.6/site-packages/pip/utils/__init__.py", line 707, in call_subprocess
    % (command_desc, proc.returncode, cwd))
pip.exceptions.InstallationError: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-9_d7qfrg/dparse/

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-9_d7qfrg/dparse/