Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pip freeze for packages installed with --target

I would like to use for a small Python project this way of managing dependent modules: http://blog.zoomeranalytics.com/pip-install-t/

In brief, I would do:

cd myproject

pip install --target ./pip-libs --upgrade -r requirements.txt

then add ./pip-libs to PYTHONPATH and run my script.

This seems but I like to use use pip freeze and it does not allow me to do anything like

pip freeze --target pip-libs

to see packages installed in the folder. Of course, I can take a look inside but what is a standard way to show packages installed in a folder with --target? The only way I can think of is doing ls of pip-libs and then playing with grep, awk... Does not seem right.

I am not sure if there is a way, maybe it's not a good idea or I should request such functionality for pip.

Python 2.7.9.

like image 564
BartoszGo Avatar asked Jul 03 '15 15:07

BartoszGo


People also ask

How do I freeze pip requirements?

The most common command is pip freeze > requirements. txt , which records an environment's current package list into requirements. txt. If you want to install the dependencies in a virtual environment, create and activate that environment first, then use the Install from requirements.

Does pip freeze show dependencies?

pip freeze might seem very useful initially but it can mess up your project because of the following reasons: It dumps all the libraries installed in your project including dependencies and sub-dependencies in the requirements. txt file. It still misses out on the libraries that are not installed using pip.

How do you list all pip installed packages?

To do so, we can use the pip list -o or pip list --outdated command, which returns a list of packages with the version currently installed and the latest available. On the other hand, to list out all the packages that are up to date, we can use the pip list -u or pip list --uptodate command.


1 Answers

Bit late to the party, but I ran in to the same issue and this seemed to solve it.

pip freeze --path ./pip-libs > requirements.txt
like image 132
davo777 Avatar answered Oct 07 '22 00:10

davo777