pypa / pypa/setuptools

Installing packages that references an git repository in requirements.txt fails.

Open
#1,052 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Needs Triage
Dominant language
Python
Stars
2.9k
Forks
1.4k
Avg merge
1d 1h
Merged PRs (30d)
1

Description

Here is an example package's reuirements.txt and setup.py that is hosted on github only that fails every time it is attempted to be installed using pip.

Also happens when running setup.py directly without pip.

requirements.txt:

regex
aioredis
colorama
pycares
discord.py
aiohttp
PyNacl
cchardet
cffi
multidict
yarl
discord.webhooks
TinyURL3
consolechange
git+https://github.com/AraHaan/dbapi.git
youtube_dl

setup.py:

from setuptools import setup
from setuptools.extension import Extension
import sys


def get_requirements():
    """
    lists the requirements to install.
    """
    requirements = []
    try:
        with open('requirements.txt') as f:
            requirements = f.read().splitlines()
    except Exception as ex:
        with open('DecoraterBotUtils.egg-info\requires.txt') as f:
            requirements = f.read().splitlines()
    return requirements


def get_version():
    """
    returns version.
    """
    return '0.0.1'


def get_extensions():
    """
    lists the extensions to build with an compiler.
    """
    if sys.platform != 'cygwin':
        BotErrors = Extension(
            'DecoraterBotUtils.BotErrors', [
                'DecoraterBotUtils/BotErrors.c'])
    else:
        BotErrors = Extension(
            'DecoraterBotUtils.BotErrors',
            library_dirs=['/usr/local/bin'],
            sources=['DecoraterBotUtils/BotErrors.c'])
    return [BotErrors]


if not get_version():
    raise RuntimeError('version is not set')

try:
    with open('README.rst') as f:
        readme = f.read()
except FileNotFoundError:
    readme = ""

setup(name='DecoraterBotUtils',
      author='Decorater',
      author_email='seandhunt_7@yahoo.com',
      url='https://github.com/DecoraterBot-devs/DecoraterBotUtils',
      bugtrack_url='https://github.com/DecoraterBot-devs/DecoraterBotUtils/issues',
      version=get_version(),
      packages=['DecoraterBotUtils'],
      ext_modules=get_extensions(),
      license='MIT',
      description='This package is for bringing various things to DecoraterBot.',
      long_description=readme,
      maintainer_email='seandhunt_7@yahoo.com',
      download_url='https://github.com/DecoraterBot-devs/DecoraterBotUtils',
      include_package_data=True,
      install_requires=get_requirements(),
      platforms='Any',
      classifiers=[
        'Development Status :: 5 - Production/Stable',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: MIT License',
        'Natural Language :: English',
        'Operating System :: OS Independent',
        'Programming Language :: C',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: Implementation :: CPython',
        'Topic :: Software Development :: Libraries',
        'Topic :: Software Development :: Libraries :: Python Modules',
      ]
)

output with pip:

E:\Users\Elsword>cd E:\DecoraterBotUtils

E:\DecoraterBotUtils>python -m pip install --upgrade .
Processing e:\decoraterbotutils
    Complete output from command python setup.py egg_info:
    E:\python360\lib\distutils\dist.py:261: UserWarning: Unknown distribution op
tion: 'bugtrack_url'
      warnings.warn(msg)
    error in DecoraterBotUtils setup command: 'install_requires' must be a strin
g or list of strings containing valid project/version requirement specifiers; In
valid requirement, parse error at "'+https:/'"

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in E:\Users\Elsword\
AppData\Local\Temp\pip-7eq1kj18-build\

E:\DecoraterBotUtils>

output without pip:

E:\DecoraterBotUtils>python setup.py install .
E:\python360\lib\distutils\dist.py:261: UserWarning: Unknown distribution option
: 'bugtrack_url'
  warnings.warn(msg)
error in DecoraterBotUtils setup command: 'install_requires' must be a string or
 list of strings containing valid project/version requirement specifiers; Invali
d requirement, parse error at "'+https:/'"

When entering the get_requirements and executing it directly in python's interactive mode:

E:\DecoraterBotUtils>python
Python 3.6.1+ (heads/3.6:33a5568f69, Apr 27 2017, 00:35:08) [MSC v.1900 32 bit (
Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> def get_requirements():
...     """
...     lists the requirements to install.
...     """
...     requirements = []
...     try:
...         with open('requirements.txt') as f:
...             requirements = f.read().splitlines()
...     except Exception as ex:
...         with open('DecoraterBotUtils.egg-info\requires.txt') as f:
...             requirements = f.read().splitlines()
...     return requirements
...
>>> get_requirements()
['regex', 'aioredis', 'colorama', 'pycares', 'discord.py', 'aiohttp', 'PyNacl',
'cchardet', 'cffi', 'multidict', 'yarl', 'discord.webhooks', 'TinyURL3', 'consol
echange', 'git+https://github.com/AraHaan/dbapi.git', 'youtube_dl']
>>>

In interactive mode it works as expected (without executing setuptools) but in pip for some reason it fails when it should not fail. Unless setuptools cannot process the vcs's properly that pip gladly supports and is able to take in and process just fine.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure using the supplied requirements.txt and setup.py, then trace setuptools validation of install_requires and its handling of the git+https requirement. Compare the behavior with pip's documented VCS requirements; done means the reported package installs successfully or the supported limitation is clearly established with a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, python
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.