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

Update setup.py to be compatible with pipenv #24789

Merged
merged 1 commit into from
Jul 13, 2023

Conversation

georgiemathews
Copy link
Contributor

@georgiemathews georgiemathews commented Jul 12, 2023

What does this PR do?

This enables installing transformers from source using pipenv.
Currently installing transformers through pipenv via a git source is blocked by this issue: pypa/pipenv#5167 (comment)

Installation will fail with:

AttributeError: 'Subscript' object has no attribute 's'

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a Github issue or the forum? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines, and
    here are tips on formatting docstrings.
  • Did you write any new necessary tests?

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

@sgugger

Copy link
Collaborator

@sgugger sgugger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused. install_requires is already a list as seen on line 415.

@georgiemathews
Copy link
Contributor Author

georgiemathews commented Jul 13, 2023

I'm confused. install_requires is already a list as seen on line 415.

Thanks for taking a look @sgugger!

It seems to be a requirementslib bug that occurs when one of the items in the list of dependencies is declared with a string interpolation..

I'm not sure why using the list constructor fixes the bug. This is the behavior when installing transformers through pipenv without the bugfix:

$ pipenv install git+https://github.com/huggingface/transformers#egg=transformers
Installing git+https://github.com/huggingface/[email protected]#egg=transformers...
Resolving
git+https://github.com/huggingface/[email protected]#egg=transformers...
✘ Locking Failed!
Traceback (most recent call last):
  ...
  File "/home/gmathews/.local/lib/python3.8/site-packages/pipenv/vendor/requirementslib/models/setup_info.py", line 659, in _find_install_requires
    return [el.s for el in variable.elts]
  File "/home/gmathews/.local/lib/python3.8/site-packages/pipenv/vendor/requirementslib/models/setup_info.py", line 659, in <listcomp>
    return [el.s for el in variable.elts]
AttributeError: 'Subscript' object has no attribute 's'

Copy link
Collaborator

@sgugger sgugger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok then, still very weird. Thanks for the fix!

@sgugger sgugger merged commit 0866705 into huggingface:main Jul 13, 2023
@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint.

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 this pull request may close these issues.

3 participants