Skip to main content
Adding some more examples and context as this answer did help me.
Source Link

So the issue I had was that my actual workspace was:

MyProject |- .venv // <- My Python Virtual Environment |- test.py 

My Python Virtual Environment was in my Project folder so when I run the command

pipreqs ./ 

it is looking at all the dependencies of all the files in the folder (including my virtual environment) and that is why it was generating a weird requirements.txt file.

To fix this, I used the option --ignore of pipreqs:

pipreqs ./ --ignore .venv 

And the generated requirements.txt is:

selenium==3.141.0 

You may also want to ignore other folders that are causing issues like this:

pipreqs --ignore bin,etc,include,lib,lib64,.venv 

The --force tag will also overwrite the existing requirements.txt

So the issue I had was that my actual workspace was:

MyProject |- .venv // <- My Python Virtual Environment |- test.py 

My Python Virtual Environment was in my Project folder so when I run the command

pipreqs ./ 

it is looking at all the dependencies of all the files in the folder (including my virtual environment) and that is why it was generating a weird requirements.txt file.

To fix this, I used the option --ignore of pipreqs:

pipreqs ./ --ignore .venv 

And the generated requirements.txt is:

selenium==3.141.0 

So the issue I had was that my actual workspace was:

MyProject |- .venv // <- My Python Virtual Environment |- test.py 

My Python Virtual Environment was in my Project folder so when I run the command

pipreqs ./ 

it is looking at all the dependencies of all the files in the folder (including my virtual environment) and that is why it was generating a weird requirements.txt file.

To fix this, I used the option --ignore of pipreqs:

pipreqs ./ --ignore .venv 

And the generated requirements.txt is:

selenium==3.141.0 

You may also want to ignore other folders that are causing issues like this:

pipreqs --ignore bin,etc,include,lib,lib64,.venv 

The --force tag will also overwrite the existing requirements.txt

Source Link
Valentin Vignal
  • 8.6k
  • 4
  • 47
  • 99

So the issue I had was that my actual workspace was:

MyProject |- .venv // <- My Python Virtual Environment |- test.py 

My Python Virtual Environment was in my Project folder so when I run the command

pipreqs ./ 

it is looking at all the dependencies of all the files in the folder (including my virtual environment) and that is why it was generating a weird requirements.txt file.

To fix this, I used the option --ignore of pipreqs:

pipreqs ./ --ignore .venv 

And the generated requirements.txt is:

selenium==3.141.0