Single command in python to install relevant modules from a package.json like file
yes there is an command for doing that , once you want to deploy you can generate the package file using the following command:
pip freeze > requirements.txt
and whenever you want to install the packages from same file use:
pip install -r requirements.txt
you can find more info about freeze here
I would use pipenv instead of pip. pipenv automatically generate Pipfile and Pipfile.lock that is far superior to requirements.txt
install pipenv and setting it for your project
pip install --user pipenv
cd yourproject
pipenv install package1 package2 ...
to install packages from Pipfile is as simple as
pipenv install
Read more: https://pipenv.kennethreitz.org/
Update: hello to poetry
I have recently moved from pipenv to poetry because poetry has everything pipenv offers and much more. It is end-to-end, as it includes building and publishing of your project to pypi.
installing poetry
curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python
and set .poetry/bin in your path.
poetry new yourproject
cd yourproject
poetry add packagename
Like pipenv this generate pyproject.toml file that context all your requirements. Like Pipenv, to install your depence
poetry install
See more: https://poetry.eustace.io/docs/
See Python packaging war: Pipenv vs. Poetry for short review of these awesome packages
You can do a
pip freeze > requirements.txt
In the local machine. And in the server,
pip install -r requirements.txt
This installs all the dependencies