voxel51 / eta

ETA: Extensible Toolkit for Analytics
https://voxel51.com
Apache License 2.0
29 stars 13 forks source link

Handle multiple requirement options #505

Closed brimoor closed 3 years ago

brimoor commented 3 years ago

The eta.core.utils.ensure_package() method allows for multiple choice requirement strings like tensorflow-gpu|tensorflow>2, which means "either tensorflow-gpu or tensorflow>2 must be installed".

This PR supports the same syntax for eta.core.utils.install_package(), which fixes https://github.com/voxel51/fiftyone/issues/919.

import eta.core.utils as etau                                                                                                                                                

# previously failed; now works
etau.install_package("tensorflow|torch")
***** Requirement 'tensorflow|torch' has multiple options. We're going to install the first one: 'tensorflow' *****
...
Requirement already satisfied: tensorflow in /Users/Brian/dev/env/eta3/lib/python3.6/site-packages (2.4.0)