Repository: pypa/pip

Issue:
"Requirement not upgraded as not directly required" for packages that are up-to-date
* Pip version: 10.0.0
* Python version: 2.7.14
* Operating system: Ubuntu 17.10

### Description:

When I run `pip install -U <package>` for some package (e.g. ansible), pip outputs a lot of messages like

```
Requirement not upgraded as not directly required: jinja2 in /home/mg/.venv/lib/python2.7/site-packages (from ansible) (2.10)
Requirement not upgraded as not directly required: PyYAML in /home/mg/.venv/lib/python2.7/site-packages (from ansible) (3.12)
Requirement not upgraded as not directly required: paramiko in /home/mg/.venv/lib/python2.7/site-packages (from ansible) (2.4.1)
Requirement not upgraded as not directly required: cryptography in /home/mg/.venv/lib/python2.7/site-packages (from ansible) (2.2.2)
Requirement not upgraded as not directly required: setuptools in /home/mg/.venv/lib/python2.7/site-packages (from ansible) (39.0.1)
Requirement not upgraded as not directly required: MarkupSafe>=0.23 in /home/mg/.venv/lib/python2.7/site-packages (from jinja2->ansible) (1.0)
Requirement not upgraded as not directly required: pynacl>=1.0.1 in /home/mg/.venv/lib/python2.7/site-packages (from paramiko->ansible) (1.2.1)
Requirement not upgraded as not directly required: pyasn1>=0.1.7 in /home/mg/.venv/lib/python2.7/site-packages (from paramiko->ansible) (0.4.2)
Requirement not upgraded as not directly required: bcrypt>=3.1.3 in /home/mg/.venv/lib/python2.7/site-packages (from paramiko->ansible) (3.1.4)
Requirement not upgraded as not directly required: cffi>=1.7; platform_python_implementation != "PyPy" in /home/mg/.venv/lib/python2.7/site-packages (from cryptography->ansible) (1.11.5)
Requirement not upgraded as not directly required: enum34; python_version < "3" in /home/mg/.venv/lib/python2.7/site-packages (from cryptography->ansible) (1.1.6)
Requirement not upgraded as not directly required: idna>=2.1 in /home/mg/.venv/lib/python2.7/site-packages (from cryptography->ansible) (2.6)
Requirement not upgraded as not directly required: asn1crypto>=0.21.0 in /home/mg/.venv/lib/python2.7/site-packages (from cryptography->ansible) (0.24.0)
Requirement not upgraded as not directly required: six>=1.4.1 in /home/mg/.venv/lib/python2.7/site-packages (from cryptography->ansible) (1.11.0)
Requirement not upgraded as not directly required: ipaddress; python_version < "3" in /home/mg/.venv/lib/python2.7/site-packages (from cryptography->ansible) (1.0.19)
Requirement not upgraded as not directly required: pycparser in /home/mg/.venv/lib/python2.7/site-packages (from cffi>=1.7; platform_python_implementation != "PyPy"->cryptography->ansible) (2.18)
```

This makes me think these packages are outdated and would've been upgraded if I'd asked for --upgrade-strategy=eager, so then I try to `pip install -U ipaddress` (for example), and then I'm surprised by

```
Requirement already up-to-date: ipaddress in /home/mg/.venv/lib/python2.7/site-packages (1.0.22)
```

Would you mind omitting these "Requirement not upgraded ..." messages for requirements that are already up-to-date?  And if that's not possible (because pip didn't reach to PyPI to check for the current version of that requirement), then would you mind rephrasing the message so it's less confusing?


Discussion:
> would you mind rephrasing the message so it's less confusing?

I would suggest "Requirement not considered for upgrade as not directly required: ...".

(I wish I could come up with something shorter, but I'm stumped.)
"Transitive requirement satisfied:"?
It's not a transitive dependency: you're directly asking pip to upgrade `ipaddress`, and it's already up-to-date.
We're talking about the "Requirement not upgraded as not directly required" messages.

The "Requirement already up-to-date" one is perfectly fine.
`Requirement already satisfied, not updated: req`?
> Requirement already satisfied, not updated: req

Happy to accept a PR for this. :)

If nobody wants to take it, I'd like to give it a go. Seems like a simple 1st issue.
@amorison Sure! Go ahead. :)
**Requirement already satisfied: req** ?
There is no point in 'not updated' part.
There is. It's been actively chosen (based on, the upgrade strategy) to not be upgraded as it was not explicitly requested by the user to be upgraded.

Now, that you point it out, it does not communicate the information in the right way.

"Requirement already installed, not checking version: " would be better wording, if we want to make it terse.

/cc @amorison

Resolving patch:
diff --git a/src/pip/_internal/resolve.py b/src/pip/_internal/resolve.py
--- a/src/pip/_internal/resolve.py
+++ b/src/pip/_internal/resolve.py
@@ -160,7 +160,7 @@ def _check_skip_installed(self, req_to_install):
 
         if not self._is_upgrade_allowed(req_to_install):
             if self.upgrade_strategy == "only-if-needed":
-                return 'not upgraded as not directly required'
+                return 'already satisfied, skipping upgrade'
             return 'already satisfied'
 
         # Check for the possibility of an upgrade.  For link-based


Test patch:
diff --git a/tests/functional/test_install_upgrade.py b/tests/functional/test_install_upgrade.py
--- a/tests/functional/test_install_upgrade.py
+++ b/tests/functional/test_install_upgrade.py
@@ -53,6 +53,10 @@ def test_only_if_needed_does_not_upgrade_deps_when_satisfied(script):
         (script.site_packages / 'simple-2.0-py%s.egg-info' % pyversion)
         not in result.files_deleted
     ), "should not have uninstalled simple==2.0"
+    assert (
+        "Requirement already satisfied, skipping upgrade: simple"
+        in result.stdout
+    ), "did not print correct message for not-upgraded requirement"
 
 
 def test_only_if_needed_does_upgrade_deps_when_no_longer_satisfied(script):