bndr / pipreqs

pipreqs - Generate pip requirements.txt file based on imports of any project. Looking for maintainers to move this project forward.
Apache License 2.0
6.38k stars 388 forks source link

Not adding all required packages that are used in the Django project #278

Open kushal-h opened 3 years ago

kushal-h commented 3 years ago

In my project along with Django package, I have installed other packages ie. django-crispy-forms and so on. However, when I use the pipreqs only the Django package is added but not other required packages.

alan-barzilay commented 3 years ago

Hi! could you provide a minimum example that I can use to reproduce this error?

kushal-h commented 3 years ago

HI,

The problem is as follows.

In my Django project, I have used packages like "django-crispy-forms==1.12.0", "psycopg2==2.8.6", "django-helpdesk==0.2.23" and so on. When I used pipreqs command in requirements.txt only django "Django==2.2.24" is added but not the rest as mentioned above.

Best, Kushal H

On Wed, Sep 15, 2021 at 7:12 AM Alan Barzilay @.***> wrote:

Hi! could you provide a minimum example that I can use to reproduce this error?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bndr/pipreqs/issues/278#issuecomment-919630313, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANPG6UQGVYNCD2RHHZPQR5TUB72WTANCNFSM5D7MQP2A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

jai-dewani commented 3 years ago

Hey @kushal-h, if you could maybe share the project structure for us to get a better idea or if the project is open source then feel free to share the project repo link, this would help us a lot in understanding what is the exact problem.

Thanks :)

Actionb commented 2 years ago

Link to an example repo: https://github.com/Actionb/pipreqsdjango

Installing the requirements in an empty venv, and then calling pipreqs ./ --print doesn't show the psycopg2==2.8.5 requirement. psycopg2 itself isn't imported or used in the project, so I can hazard a guess why it wouldn't show up. But the module must be installed if you want to use PostgreSQL as the database.

Martin1458 commented 2 years ago

Have you found the solution?

matthewsheeran commented 1 year ago

Yep: dj_database_url==1.0.0 Django==4.0 django_restful_admin==1.1.3 - djangorestframework==3.14.0 + drf_spectacular==0.24.2

It's adding in the new drf_spectacular but now dropping djangorestframework for my own project.

"from rest_framework import serializers" is mostly definitely in my source along with some actual template serializer code.

MichaelGatesDev commented 7 months ago

On a related note, this project does not require a user to import anything in Python to use. As a result, it is not detected by this tool.