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

pip-sync errors when merging multiple requirements.txt files that point at the same editable install #1710

Closed
vivster7 opened this issue Oct 28, 2022 · 4 comments · Fixed by #1802
Labels
bug Something is not working

Comments

@vivster7
Copy link

pip-sync raises an AttributeError: 'NoneType' object has no attribute 'specifier' error when you try and run it with multiple requirements files that each include an editable install for the same package.

Environment Versions

  1. OS Type: Linux
  2. Python version: Python 3.9.11
  3. pip version: pip 22.3
  4. pip-tools version: pip-compile, version 6.9.0

Steps to replicate

  1. Create a setup.py, dev_requirements.in, requirements.in file
# setup.py
from setuptools import find_packages, setup
setup(name="a", version="0.0.1", packages=find_packages())

# dev_requirements.in
-e file:.

# requirements.in
-e file:.
  1. Run pip-compile
pip-compile requirements.in
pip-compile dev_requirements.in
  1. Run pip-sync
pip-sync requirements.in  dev_requirements.in

Expected result

I expected the editable package to install once. Similar to running pip install -r requirements.txt -r dev_requirements.txt

Actual result

pip-sync raised an error
Full stack trace

➜  scratch pip-sync  requirements.txt dev_requirements.txt 
Traceback (most recent call last):
  File "/home/vivek/.pyenv/versions/3.9.11/bin/pip-sync", line 8, in <module>
    sys.exit(cli())
  File "/home/vivek/.pyenv/versions/3.9.11/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/home/vivek/.pyenv/versions/3.9.11/lib/python3.9/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/home/vivek/.pyenv/versions/3.9.11/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/vivek/.pyenv/versions/3.9.11/lib/python3.9/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/home/vivek/.pyenv/versions/3.9.11/lib/python3.9/site-packages/piptools/scripts/sync.py", line 146, in cli
    merged_requirements = sync.merge(requirements, ignore_conflicts=force)
  File "/home/vivek/.pyenv/versions/3.9.11/lib/python3.9/site-packages/piptools/sync.py", line 115, in merge
    if ireq.specifier != existing_ireq.specifier:
  File "/home/vivek/.pyenv/versions/3.9.11/lib/python3.9/site-packages/pip/_internal/req/req_install.py", line 245, in specifier
    return self.req.specifier
AttributeError: 'NoneType' object has no attribute 'specifier'

...

@atugushev
Copy link
Member

Alas, can't reproduce the bug. Could you show the pip --version output? This does look like you're using some old pip version.

@atugushev atugushev added the needs reproduce Need to reproduce an issue label Nov 3, 2022
@vivster7
Copy link
Author

vivster7 commented Nov 7, 2022

➜  /src git:(main) pip --version
pip 22.3 from /home/vivek/.pyenv/versions/3.9.11/envs/chrono/lib/python3.9/site-packages/pip (python 3.9)

Would it help if I pushed a Docker image with the repro in it?

@richafrank
Copy link
Contributor

I was able to reproduce this, with the above versions, as well as on MacOS with Python 3.8.12 | pip 22.3.1 | pip-tools main, as well as Python 3.10.6.

@atugushev would be good to see if the tests I add fail for you too without the fix.

@richafrank
Copy link
Contributor

(Added tests and fix in PR)

@atugushev atugushev added bug Something is not working and removed needs reproduce Need to reproduce an issue labels Feb 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is not working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants