Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to install all python modules at once using pip?

I would like to install all available modules for Python 2.7.12 using a single pip command. Is there a way to do this without having to specify every single package name?

like image 459
rsnaveen Avatar asked Aug 15 '16 20:08

rsnaveen


People also ask

How do I download all Python modules at once?

You can install from a requirement file: pip install -r requirements. txt . You can also list all installed packages and put it in a requirement file: pip freeze > requirement. txt .

Can you install multiple packages with pip?

To pip install more than one Python package, the packages can be listed in line with the same pip install command as long as they are separated with spaces. Here we are installing both scikit-learn and the statsmodel package in one line of code. You can also upgrade multiple packages in one line of code.


2 Answers

I highly recommend against doing this - the overwhelmingly supported best practice is to use a requirements.txt file, listing the packages you want to install specifically.

You then install it with pip install -r requirements.txt and it installs all the packages for your project.

This has several benefits:

  • Repeatability by installing only the required packages
  • Conciseness

However, if you really do want to install ALL python packages (note that there are thousands), you can do so via the following:

pip search * | grep ")[[:space:]]" | cut -f1 -d" "

I strongly recommend against this as it's likely to do horrible things to your system, as it will attempt to install every python package (and why it's in spoiler tags).

like image 142
enderland Avatar answered Oct 12 '22 07:10

enderland


This is a terrible idea, but you could always use autoinstaller, which will automatically download packages via pip if you don't have them installed.

like image 35
Wayne Werner Avatar answered Oct 12 '22 09:10

Wayne Werner