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-audit -r requirements.txt with "-r base.txt" in txt file fails #587

Closed
hugoalvarado opened this issue Mar 31, 2023 · 3 comments
Closed
Labels
bug-candidate Might be a bug. question Further information is requested

Comments

@hugoalvarado
Copy link

Bug description

Using a requirements.txt with nested includes like "-r base.txt" the file with pip-audit generated an error:
No such file or directory: '/tmp/base.txt'

Reproduction steps

Create 2 txt files, base.txt and local.txt.

base.txt contents:

django==4.0.10

local.txt contents:

-r base.txt 

run:

pip-audit -r ./local.txt

Expected behavior

All packages from both base.txt and local.txt are checked.

Screenshots and logs

ERROR:pip_audit._virtual_env:internal pip failure: ERROR: Could not open requirements file: [Errno 2] No such file or directory: '/var/folders/p6/7fr29jj169j_25jgx524j2f80000gn/T/base.txt'

ERROR:pip_audit._cli:Failed to install packages: ['/var/folders/p6/7fr29jj169j_25jgx524j2f80000gn/T/tmpjg4piseq/bin/python', '-m', 'pip', 'install', '--index-url', 'https://pypi.org/simple/', '--dry-run', '--report', '/var/folders/p6/7fr29jj169j_25jgx524j2f80000gn/T/tmp79gy3y2f', '-r', '/var/folders/p6/7fr29jj169j_25jgx524j2f80000gn/T/tmpuzbucuum']

Platform information

  • OS name and version: macos Ventura 13.2.1 (22D68)
  • pip-audit version (pip-audit -V): pip-audit 2.5.2
  • Python version (python -V or python3 -V): Python 3.9.14
  • pip version (pip -V or pip3 -V): pip 22.0.4
@hugoalvarado hugoalvarado added the bug-candidate Might be a bug. label Mar 31, 2023
@hugoalvarado hugoalvarado changed the title pip-audit -r requirements.txt with "-r base.txt" in req file fails pip-audit -r requirements.txt with "-r base.txt" in txt file fails Mar 31, 2023
@woodruffw
Copy link
Member

Hi @hugoalvarado!

It looks like you're running pip-audit 2.5.2, when the latest version is 2.5.4. Could you please upgrade and see if you're still seeing this behavior?

In particular, 2.5.4 contains a related fix to how we handle nested requirement files:

https://github.com/pypa/pip-audit/releases/tag/v2.5.4

@woodruffw woodruffw added the question Further information is requested label Mar 31, 2023
@hugoalvarado
Copy link
Author

Thanks @woodruffw - looks like this has been resolved 🥳

❯ pip freeze | grep audit
pip_audit==2.5.4

❯ pip-audit -r requirements.txt
No known vulnerabilities found

@woodruffw
Copy link
Member

Glad to hear it, and thanks again for reporting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-candidate Might be a bug. question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants