1

pip supports installing extra components while installing a Python package from internet, e.g.,

pip install dask[all]
pip install "dask[all] @ git+https://github.com/dask/dask"

However, does it support installing extra components when installing from a local Python package? For example, if I have the dask Python package downloaded to local, how can I install it with specific extra components?

Benjamin Du
  • 1,391
  • 1
  • 17
  • 25
  • Does this answer your question? [Specify extras\_require with pip install -e](https://stackoverflow.com/questions/30239152/specify-extras-require-with-pip-install-e) – jidicula Mar 09 '21 at 01:56

2 Answers2

1

I've just figured it out.

pip3 install "dsutil[cv] @ file:///home/dclong/dsutil-0.54.1-py3-none-any.whl"
Benjamin Du
  • 1,391
  • 1
  • 17
  • 25
1

Yes, you can install extras from a local package. If they're defined in the package's setup.py file in the extras_require dictionary, then you can install them with pip install ."[extra1, extra2]". For example, if you have the following in your setup.py:

extras_require={
        'docs': ["sphinx>=1.6", "sphinx_rtd_theme>=0.2.4", "sphinx-click"],
        'dev': ["pre-commit>=2.10.0"]
    },

you can install the docs and dev extras with pip install ".[docs, dev]" when you're in the directory containing setup.py (you'd use the path to the directory containing setup.py in the place of . otherwise).

jidicula
  • 3,454
  • 1
  • 17
  • 38