Skip to content
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

'extras_require' must be a dictionary when using git+ link in extras_require #2048

Open
xkortex opened this issue Mar 27, 2020 · 2 comments
Open

Comments

@xkortex
Copy link

xkortex commented Mar 27, 2020

moved from pypa/pip#7906

I don't know why it says I added a Python 2 label. I don't even see a button to add labels. This is a python 3 thing (well it probably affects both, but I don't care about py2 :) ).

here's the error for quick reference:

def check_extras(dist, attr, value):
"""Verify that extras_require mapping is valid"""
try:
list(itertools.starmap(_check_extra, value.items()))
except (TypeError, ValueError, AttributeError):
raise DistutilsSetupError(
"'extras_require' must be a dictionary whose values are "
"strings or lists of strings containing valid project/version "
"requirement specifiers."
)

Environment1
virtualenv

Environment2
Anaconda virtualenv

My test env:

$ pip freeze
pip             20.0.2
setuptools      46.1.1
wheel           0.34.2
#!/usr/bin/env python 
# setup.py
from setuptools import setup, find_packages

# The link is actually to a client library, I'm using six to demonstrate
setup(
        name="dummy",
        packages=find_packages(),
    extras_require={
        'myextra': ['git+https://github.com/benjaminp/six.git'],
    }
)

Description

pip install "./[myextra]"

or

pip install .

fails with

    ERROR: Complete output from command python setup.py egg_info:
    ERROR: error in dummy setup command: 'extras_require' must be a dictionary whose values are strings or lists of strings containing valid project/version requirement specifiers.
    ----------------------------------------
ERROR: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-req-build-fgmgoxp2/

Expected behavior
successful pip install of my app plus the extras (a client library in this case). I can pip install a git link, and I can install extras_require, but I can't do extras with a git link

How to Reproduce

  1. new virtualenv/container
  2. make a dummy package with the above setup.py
  3. pip install .

Output

Exception information:
Traceback (most recent call last):
  File "/home/ubuntu/.virtualenvs/testdev/lib/python3.6/site-packages/pip/_internal/cli/base_command.py", line 186, in _main
    status = self.run(options, args)
  File "/home/ubuntu/.virtualenvs/testdev/lib/python3.6/site-packages/pip/_internal/commands/install.py", line 331, in run
    resolver.resolve(requirement_set)
  File "/home/ubuntu/.virtualenvs/testdev/lib/python3.6/site-packages/pip/_internal/legacy_resolve.py", line 177, in resolve
    discovered_reqs.extend(self._resolve_one(requirement_set, req))
  File "/home/ubuntu/.virtualenvs/testdev/lib/python3.6/site-packages/pip/_internal/legacy_resolve.py", line 333, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "/home/ubuntu/.virtualenvs/testdev/lib/python3.6/site-packages/pip/_internal/legacy_resolve.py", line 282, in _get_abstract_dist_for
    abstract_dist = self.preparer.prepare_linked_requirement(req)
  File "/home/ubuntu/.virtualenvs/testdev/lib/python3.6/site-packages/pip/_internal/operations/prepare.py", line 516, in prepare_linked_requirement
    req, self.req_tracker, self.finder, self.build_isolation,
  File "/home/ubuntu/.virtualenvs/testdev/lib/python3.6/site-packages/pip/_internal/operations/prepare.py", line 95, in _get_prepared_distribution
    abstract_dist.prepare_distribution_metadata(finder, build_isolation)
  File "/home/ubuntu/.virtualenvs/testdev/lib/python3.6/site-packages/pip/_internal/distributions/sdist.py", line 40, in prepare_distribution_metadata
    self.req.prepare_metadata()
  File "/home/ubuntu/.virtualenvs/testdev/lib/python3.6/site-packages/pip/_internal/req/req_install.py", line 564, in prepare_metadata
    self.metadata_directory = self._generate_metadata()
  File "/home/ubuntu/.virtualenvs/testdev/lib/python3.6/site-packages/pip/_internal/req/req_install.py", line 544, in _generate_metadata
    details=self.name or "from {}".format(self.link)
  File "/home/ubuntu/.virtualenvs/testdev/lib/python3.6/site-packages/pip/_internal/operations/build/metadata_legacy.py", line 118, in generate_metadata
    command_desc='python setup.py egg_info',
  File "/home/ubuntu/.virtualenvs/testdev/lib/python3.6/site-packages/pip/_internal/utils/subprocess.py", line 242, in call_subprocess
    raise InstallationError(exc_msg)
pip._internal.exceptions.InstallationError: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
@sbidoul
Copy link
Member

sbidoul commented Mar 28, 2020

@xkortex can you try this (notice the updated PEP 508 syntax for the direct url requirement):

# setup.py
from setuptools import setup, find_packages

# The link is actually to a client library, I'm using six to demonstrate
setup(
    name="dummy",
    packages=find_packages(),
    extras_require={
        'myextra': ['six @ git+https://github.com/benjaminp/six.git'],
    }
)

@jaraco jaraco removed the Python 2 label May 3, 2020
@jaraco
Copy link
Member

jaraco commented May 3, 2020

I don't know why it says I added a Python 2 label.

Probably you clicked the template for filing issues about the Python 2 warning instead of the blank issue:

image

It's confusing, I know. I've tried to clarify in the template so others don't fall into the same trap.

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

No branches or pull requests

3 participants