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-compile fails if output file already exists #484

Closed
jredwards opened this issue Apr 4, 2017 · 4 comments
Closed

pip-compile fails if output file already exists #484

jredwards opened this issue Apr 4, 2017 · 4 comments

Comments

@jredwards
Copy link

jredwards commented Apr 4, 2017

Given a requirements.in file which consists only of the line:

-e ..

(that is, pull in requirements from the setup.py file one folder up from my requirements.in file)

The first pip-compile run works fine. The second one throws an error. If I delete the file that was generated by the first run, it will work again. There are no permissions issues (tried it with full perms on the file to check).

Environment Versions
  1. os: OSX 10.11.6
  2. python version: 2.7
  3. pip version: 9.0.1
  4. pip-tools version: 1.8.2
Steps to replicate
  1. pip-compile -v -o requirements.txt
    SUCCESS
  2. pip-compile -v -o requirements.txt
    FAILURE
Expected result

An updated (or identical) requirements.txt file

Actual result
Traceback (most recent call last):
  File "/Users/<username>/.virtualenvs/<virtualenv>/bin/pip-compile", line 11, in <module>
    sys.exit(cli())
  File "/Users/<username>/.virtualenvs/<virtualenv>/lib/python2.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/Users/<username>/.virtualenvs/<virtualenv>/lib/python2.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/Users/<username>/.virtualenvs/<virtualenv>/lib/python2.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/<username>/.virtualenvs/<virtualenv>/lib/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/Users/<username>/.virtualenvs/<virtualenv>/lib/python2.7/site-packages/piptools/scripts/compile.py", line 131, in cli
    key = key_from_req(ireq.req)
  File "/Users/<username>/.virtualenvs/<virtualenv>/lib/python2.7/site-packages/piptools/utils.py", line 41, in key_from_req
    key = req.name
AttributeError: 'NoneType' object has no attribute 'name'
@davidovich
Copy link
Contributor

This issue should be fixed in the (unreleased) 1.9.0. Can you check that your use case is covered on the master branch? Thanks.

see #477

@jredwards
Copy link
Author

jredwards commented Apr 4, 2017

@davidovich

My use case appears to be broken entirely in the master branch (i.e. it does not work even if the output file does not exist).

I ran the same command on the same .in file.

Here is the version, according to pip-compile --version:

pip-compile, version 1.8.3.dev23-ng62d85ea

Here is my output:

pip-compile -v requirements.in -o requirements.txt
Using indexes:
  https://pypi.python.org/simple
Traceback (most recent call last):
  File "/Users/<username>/.virtualenvs/<virtualenv>/bin/pip-compile", line 9, in <module>
    load_entry_point('pip-tools==1.8.3.dev23-ng62d85ea', 'console_scripts', 'pip-compile')()
  File "/Users/<username>/.virtualenvs/<virtualenv>/lib/python2.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/Users/<username>/.virtualenvs/<virtualenv>/lib/python2.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/Users/<username>/.virtualenvs/<virtualenv>/lib/python2.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/<username>/.virtualenvs/<virtualenv>/lib/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/Users/<username>/workspace/Local/cloned/pip-tools/piptools/scripts/compile.py", line 183, in cli
    primary_packages = {key_from_req(ireq.req) for ireq in constraints if not ireq.constraint}
  File "/Users/<username>/workspace/Local/cloned/pip-tools/piptools/scripts/compile.py", line 183, in <setcomp>
    primary_packages = {key_from_req(ireq.req) for ireq in constraints if not ireq.constraint}
  File "/Users/<username>/workspace/Local/cloned/pip-tools/piptools/utils.py", line 44, in key_from_req
    key = req.name
AttributeError: 'NoneType' object has no attribute 'name'

@jredwards
Copy link
Author

jredwards commented Apr 4, 2017

...revising this comment. It looks like this was broken in 1.8.0 the same way it is broken in 1.8.2.

It was broken in a slightly different way in 1.8.1.

It worked in 1.7.0

@davidovich
Copy link
Contributor

OK, this was introduced by 5bf5b97

Will fix and add a test.

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 a pull request may close this issue.

2 participants