Skip to content
Advertisement

Pip install multiple extra dependencies of a single package via requirement file

Some package, such as DVC allow you to install extra dependencies to use additional features: to install a single extra dependency, whether by command line or in a requirements.txt, you simply use brackets:

# requirements.txt
dvc[s3]

pip install -r requirements.txt

But how can you install multiple extra dependencies of a single package ? There is of course the possibility to create multiple lines

# requirements.txt
dvc[s3]
dvc[gs]

However this seems a bit unelegant to me, as if I want to specify a version, I have to make sure that both line use the same.

Would it be possible to do that on a single line ? I have found no reference to a specific syntax, and have already tried dvc[s3][gs] and dvc[gs, s3], to no avail.

Advertisement

Answer

Of course, I found the solution right after posting, you just have to remove the space after the comma:

# requirements.txt
dvc[s3,gs]

pip install -r requirements.txt

Works fine

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement