pipx icon indicating copy to clipboard operation
pipx copied to clipboard

Install a .whl file containing console entry point

Open johnthagen opened this issue 4 years ago • 3 comments

How would this feature be useful?

If a user creates a .whl file that contains an entry_point console_script, normally they can run:

(venv) $ pip install myproject-0.1.0-py3-none-any.whl

And then those entry points are available within the virtual environment.

But when I try to do something similar with pipx:

$ pipx install myproject-0.1.0-py3-none-any.whl                               
Fatal error from pip prevented installation. Full pip output in file:
    ~/.local/pipx/logs/cmd_2021-03-02_14.39.35_pip_errors.log

Some possibly relevant errors from pip install:
    ERROR: Could not find a version that satisfies the requirement myproject-0-1-0-py3-none-any-whl
    ERROR: No matching distribution found for myproject-0-1-0-py3-none-any-whl

Error installing myproject-0-1-0-py3-none-any-whl.

It seems like the .whl file name is being normalized into a PyPI name?

Describe the solution you'd like

Be able to run

$ pipx install myproject-0.1.0-py3-none-any.whl

And it installs the package into the pipx environment, making the console entry points available in the PATH.

johnthagen avatar Mar 02 '21 19:03 johnthagen

Digging deeper into the docs, I realized that pipx needs to see the ./ in the file name to treat it as a file.

This works:

$ pipx install ./myproject-0.1.0-py3-none-any.whl   

johnthagen avatar Mar 02 '21 19:03 johnthagen

I will leave this open in case pipx maintainers want to fix this to match pip's behaviour.

It seems like the . in the file name (e.g. .whl) could be something to key off of.

johnthagen avatar Mar 02 '21 19:03 johnthagen

Technically myproject-0.1.0-py3-none-any.whl can be a valid project name, although obviously it’s hard to imagine anyone doing it in practice. pip’s logic includes several special cases to be “helpful”, and I would be fully supportive if pipx chooses to either replicate them or not.

uranusjr avatar Mar 02 '21 19:03 uranusjr