1

Specifically I want to install a wheel file that has extras_require defined.
I can install the package directly with pip install mypackage[myextradependency].

But if I create a wheel file out of it, it does not allow me to do pip install mypackage-1.0-py2.py3-none-any.whl[myextradependency] and gives me a url syntax error. It seems like I am using the wrong syntax, but I was unable to find the correct syntax on the documentation.

I am trying to install the wheel on a databricks job cluster started via Azure data factory. Therefor I do not have access to additional pip commands.

The exact error message is Could not parse URI. Please double check your input.

Thanks for your help

jugi
  • 622
  • 7
  • 15

3 Answers3

2

I would suggest, that you download the .whl files with the extra dependencies and then install all .whl files you downloaded. Thus you will be able to install the extra dependencies as wheel files.
e.g.:

mkdir whls && cd whls
pip download mypackage[myextradependency]
pip install *
cellularegg
  • 152
  • 2
  • 10
1

Use single quotes around the wheel filename and option(s):

pip install 'mypackage.whl[myextradependency]'

Duplicate stackoverflow question: How to pip install with wheel specifying extras?

  • Then flag it as a duplicate. Don't post other SO quesitons/answers as new answers. – Trenton McKinney Aug 27 '21 at 20:55
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. – Trenton McKinney Aug 27 '21 at 20:55
0

I've the same kind of problem as the OP and the suggested answer does not really answer to the question, since not dealing with a wheel file but with a published package.

To elaborate on the use case I feel the OP has, I want to test the wheel locally before publication by installing it with "pip install <wheel_file_path>" in a sandbox ephemeral virtual env. The problem is: how the "myextradependency" option can be included in the command?

Side note: this kind of option is not intended to specify dependencies but installation options, such as additional features. So "myextradependency" should be "myinstalloption" in a more general way, knowing that it can be referred to in the extras_require section, but also in the entry_points one for installing CLI scripts for instance.

Back to the topic, using the square brackets after the wheel path (in a way similar to what we would have done in the package name form of the command) does not work since this is taken as a part of the path and obviously fails.

Is this possible (and how) or is it supposed to work with the package name based syntax of the pip install command only and not with other forms or the pip install command? I've read pip's documentation from cover to cover but couldn't find any relevant information.

Eric PASCUAL
  • 109
  • 1
  • 8