Repository: pypa/pip

Issue:
no-binary / no-use-wheel mismatch
`--no-binary` still installs a wheel if this is a non-binary wheel. So `--no-binary` is not an 1:1 replacement for `--no-use-wheel` and therefore the latter shouldn't be marked as deprecated.

See #1891 why `--no-use-wheel` is still an important option.



Discussion:
> `--no-binary` still installs a wheel if this is a non-binary wheel.

Do you have an example ?

With pip 7.1.2, `pip install django --no-binary django` downloads and installs the .tar.gz (and not the non-binary wheel) just like with `--no-use-wheel`.

> (...) if this is a non-binary wheel.

Am I missing something or from pip's point of view there's either source package (sdist) or binary package (wheel) so there's no such thing like _non-binary wheel_?

```
>pip --version
pip 7.1.2 from C:\Python27\lib\site-packages (python 2.7)

>pip install --no-binary all pytest
Collecting pytest
  Using cached pytest-2.8.2-py2.py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): py>=1.4.29 in c:\python27\lib\site-packages (from pytest)
Requirement already satisfied (use --upgrade to upgrade): colorama in c:\python27\lib\site-packages (from pytest)
Installing collected packages: pytest
Successfully installed pytest-2.8.2
```

The correct syntax is `pip install --no-binary :all: pytest` :smiley:

:)

BTW, I thought this was just some emphasis issue in the docs, maybe you should better format this to make it clear the colons should be included.

@schlamar PR/improvements are welcome :)

This is currently documented here: https://pip.pypa.io/en/stable/reference/pip_install/#install-no-binary
or when running `pip install --help`:

``````
--no-binary <format_control>
                          Do not use binary packages. Can be supplied multiple times, and each time adds to the existing value. Accepts either :all: to disable all binary packages, :none: to empty the set,
                          or one or more package names with commas between them. Note that some packages are tricky to compile and may fail to install when this option is used on them.```
``````

Maybe add an example using `--no-binary :all:` syntax in one of the examples https://pip.pypa.io/en/stable/reference/pip_install/#examples ?

@piotr-dobrogost 

> Am I missing something or from pip's point of view there's either source package (sdist) or binary package (wheel) so there's no such thing like non-binary wheel?

Yes, pip makes no difference between pure python wheels and the other wheels except of course when matching the compatibility tags.

This really needs an example as pointed out by @schlamar , i thought the same thing that :all: was just to emphasize and noticed binary still being install. Inline example would be best.
/request-tag docs

Can this be reopened again, to track the relevant documentation update?
I get tricked by this all the time. I write:

     `pip install -r requirements.txt --no-binary --no-cache-dir`

The `--no-cache-dir` gets read as the argument to `--no-binary`, and pip goes and does exactly what I didn't want. 
Oh man @honnibal. You just cracked my problem. I wrote `pip install --no-binary --user <packages>` and then was totally confused as to why I was seeing:

```
Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/local/lib/python3.6/dist-packages'
Consider using the `--user` option or check the permissions.
```

I wasn't expecting `--no-binary` to take an argument :(
> I wasn't expecting --no-binary to take an argument :(

Yeah. I now think it might be useful to have pip abort if `--no-binary/--only-binary` gets an argument that starts with a `-`. This is essentially an invalid PEP440 name IIUC and would cover users who do something like this.

Thoughts @pypa/pip-committers?

That sounds like a good idea. It won't catch every issue (`pip install --no-binary mypkg` is also a common error) but there's no harm and it will help.
@pfmoore I would like to help with this, but I am not 100% sure where I am supposed to do the check. Would the `_handle_no_binary` and `_handle_only_binary` functions in `cmdoptions.py` be the right place?
Hi! Is this issue still reproducible or was it fixed in #5847?
IMO the help message can still be made clearer. Quoting from above:

> […] I thought the same thing that :all: was just to emphasize and noticed binary still being install[ed]. Inline example would be best.

Maybe adding quotes would help, e.g.:

```
Do not use binary packages. Can be supplied multiple times, and each time adds to the
existing value. Accepts either ":all:" to disable all binary packages, ":none:" to empty
the set, or […].
```
how can the help message be accessed??

Based on the views above, I think what we need to do is to emphasize the existence of colons and provide some examples.
I'll make a PR later.

Resolving patch:
diff --git a/src/pip/_internal/cli/cmdoptions.py b/src/pip/_internal/cli/cmdoptions.py
--- a/src/pip/_internal/cli/cmdoptions.py
+++ b/src/pip/_internal/cli/cmdoptions.py
@@ -475,12 +475,12 @@ def no_binary():
         "--no-binary", dest="format_control", action="callback",
         callback=_handle_no_binary, type="str",
         default=format_control,
-        help="Do not use binary packages. Can be supplied multiple times, and "
-             "each time adds to the existing value. Accepts either :all: to "
-             "disable all binary packages, :none: to empty the set, or one or "
-             "more package names with commas between them (no colons). Note "
-             "that some packages are tricky to compile and may fail to "
-             "install when this option is used on them.",
+        help='Do not use binary packages. Can be supplied multiple times, and '
+             'each time adds to the existing value. Accepts either ":all:" to '
+             'disable all binary packages, ":none:" to empty the set (notice '
+             'the colons), or one or more package names with commas between '
+             'them (no colons). Note that some packages are tricky to compile '
+             'and may fail to install when this option is used on them.',
     )
 
 
@@ -491,12 +491,12 @@ def only_binary():
         "--only-binary", dest="format_control", action="callback",
         callback=_handle_only_binary, type="str",
         default=format_control,
-        help="Do not use source packages. Can be supplied multiple times, and "
-             "each time adds to the existing value. Accepts either :all: to "
-             "disable all source packages, :none: to empty the set, or one or "
-             "more package names with commas between them. Packages without "
-             "binary distributions will fail to install when this option is "
-             "used on them.",
+        help='Do not use source packages. Can be supplied multiple times, and '
+             'each time adds to the existing value. Accepts either ":all:" to '
+             'disable all source packages, ":none:" to empty the set, or one '
+             'or more package names with commas between them. Packages '
+             'without binary distributions will fail to install when this '
+             'option is used on them.',
     )
 
 


Test patch: