Repository: jazzband/pip-tools

Issue:
No handlers could be found for logger "pip.vcs.git"
Looks like logging is not totally set up. I get this when `pip-compile` wit VCS links:

```
No handlers could be found for logger "pip.vcs.git"
```



Discussion:
FWIW, this issue came up for me about the same time that I added a `-e` requirement to a github repository (starting with `git+git://`).

Has this been since in recent releases?

Note to contributors: Try to reproduce by causing a failure with a git repo on `pip`'s side.
I'm still seeing this message each time I run my upgrade script.
@ryanhiebert Could you give me your upgrade script, as well as a `requirements.in` to reproduce?
I may have been mis-remembering what I was seeing. I can't confirm the bug myself ATM.
Alright, closing this for now. If anyone comes up with this again, we'll reopen.
Hi, I add the issue myself running pip-compile with git urls indeed. 
The format of the github urls is: `-e git+ssh://git@github.com/<user>/<repo>.git@<tag>#egg=<egg>`, if it can help?

Also, I get `No handlers could be found for logger "pip.req.req_install"`
Did anyone figure this out? @cancan101 ??
Hello @koleror,

> Hi, I add the issue myself running pip-compile with git urls indeed.
> The format of the github urls is: `-e git+ssh://git@github.com/<user>/<repo>.git@<tag>#egg=<egg>`, if it can help?
> 
> Also, I get `No handlers could be found for logger "pip.req.req_install"`

I cannot reproduce it locally. Is this issue still on, @koleror?

```bash
echo "-e git+ssh://git@github.com/jazzband/pip-tools.git@master#egg=pip-tools" | pip-compile - -vo- > /dev/null
Using indexes:
  https://pypi.org/simple

                          ROUND 1
Current constraints:
  pip-tools from git+ssh://****@github.com/jazzband/pip-tools.git@master#egg=pip-tools (from -r /var/folders/4x/rz_w89dx1z3bydfd6qpdjn_h0000gn/T/tmpflyl5zxs (line 1))

Finding the best candidates:
  found candidate -e git+ssh://git@github.com/jazzband/pip-tools.git@master#egg=pip-tools (constraint was <any>)

Finding secondary dependencies:

New dependencies found in this round:
  adding ['click', '>=6', '[]']
  adding ['six', '', '[]']
Removed dependencies in this round:
------------------------------------------------------------
Result of round 1: not stable

                          ROUND 2
Current constraints:
  click>=6 (from pip-tools->-r /var/folders/4x/rz_w89dx1z3bydfd6qpdjn_h0000gn/T/tmpflyl5zxs (line 1))
  pip-tools from git+ssh://****@github.com/jazzband/pip-tools.git@master#egg=pip-tools (from -r /var/folders/4x/rz_w89dx1z3bydfd6qpdjn_h0000gn/T/tmpflyl5zxs (line 1))
  six (from pip-tools->-r /var/folders/4x/rz_w89dx1z3bydfd6qpdjn_h0000gn/T/tmpflyl5zxs (line 1))

Finding the best candidates:
  found candidate click==7.0 (constraint was >=6)
  found candidate -e git+ssh://git@github.com/jazzband/pip-tools.git@master#egg=pip-tools (constraint was <any>)
  found candidate six==1.12.0 (constraint was <any>)

Finding secondary dependencies:
  click==7.0                requires -
  six==1.12.0               requires -
------------------------------------------------------------
Result of round 2: stable, done

#
# This file is autogenerated by pip-compile
# To update, run:
#
#    pip-compile --output-file=- -
#
-e git+ssh://git@github.com/jazzband/pip-tools.git@master#egg=pip-tools
click==7.0
six==1.12.0
```

I am still seeing this with (`pip-compile --version`: `pip-compile, version 4.2.0`)
Actually I am seeing a slightly different error:

```
No handlers could be found for logger "pip._internal.vcs.git"
Traceback (most recent call last):
  File "/Users/anton/.pyenv/versions/dn-campaign/bin/pip-compile", line 8, in <module>
    sys.exit(cli())
  File "/Users/anton/.pyenv/versions/2.7.16/envs/dn-campaign/lib/python2.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/Users/anton/.pyenv/versions/2.7.16/envs/dn-campaign/lib/python2.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/Users/anton/.pyenv/versions/2.7.16/envs/dn-campaign/lib/python2.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/anton/.pyenv/versions/2.7.16/envs/dn-campaign/lib/python2.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/Users/anton/.pyenv/versions/2.7.16/envs/dn-campaign/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/Users/anton/.pyenv/versions/2.7.16/envs/dn-campaign/lib/python2.7/site-packages/piptools/scripts/compile.py", line 358, in cli
    results = resolver.resolve(max_rounds=max_rounds)
  File "/Users/anton/.pyenv/versions/2.7.16/envs/dn-campaign/lib/python2.7/site-packages/piptools/resolver.py", line 168, in resolve
    has_changed, best_matches = self._resolve_one_round()
  File "/Users/anton/.pyenv/versions/2.7.16/envs/dn-campaign/lib/python2.7/site-packages/piptools/resolver.py", line 263, in _resolve_one_round
    their_constraints.extend(self._iter_dependencies(best_match))
  File "/Users/anton/.pyenv/versions/2.7.16/envs/dn-campaign/lib/python2.7/site-packages/piptools/resolver.py", line 339, in _iter_dependencies
    for dependency in self.repository.get_dependencies(ireq):
  File "/Users/anton/.pyenv/versions/2.7.16/envs/dn-campaign/lib/python2.7/site-packages/piptools/repositories/pypi.py", line 272, in get_dependencies
    download_dir, ireq, wheel_cache
  File "/Users/anton/.pyenv/versions/2.7.16/envs/dn-campaign/lib/python2.7/site-packages/piptools/repositories/pypi.py", line 231, in resolve_reqs
    results = resolver._resolve_one(reqset, ireq)
  File "/Users/anton/.pyenv/versions/2.7.16/envs/dn-campaign/lib/python2.7/site-packages/pip/_internal/legacy_resolve.py", line 365, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "/Users/anton/.pyenv/versions/2.7.16/envs/dn-campaign/lib/python2.7/site-packages/pip/_internal/legacy_resolve.py", line 295, in _get_abstract_dist_for
    req, self.require_hashes, self.use_user_site, self.finder,
  File "/Users/anton/.pyenv/versions/2.7.16/envs/dn-campaign/lib/python2.7/site-packages/pip/_internal/operations/prepare.py", line 258, in prepare_editable_requirement
    req, self.req_tracker, finder, self.build_isolation,
  File "/Users/anton/.pyenv/versions/2.7.16/envs/dn-campaign/lib/python2.7/site-packages/pip/_internal/operations/prepare.py", line 49, in _get_prepared_distribution
    abstract_dist.prepare_distribution_metadata(finder, build_isolation)
  File "/Users/anton/.pyenv/versions/2.7.16/envs/dn-campaign/lib/python2.7/site-packages/pip/_internal/distributions/source/legacy.py", line 39, in prepare_distribution_metadata
    self.req.prepare_metadata()
  File "/Users/anton/.pyenv/versions/2.7.16/envs/dn-campaign/lib/python2.7/site-packages/pip/_internal/req/req_install.py", line 563, in prepare_metadata
    self.metadata_directory = metadata_generator(self)
  File "/Users/anton/.pyenv/versions/2.7.16/envs/dn-campaign/lib/python2.7/site-packages/pip/_internal/operations/generate_metadata.py", line 124, in _generate_metadata_legacy
    command_desc='python setup.py egg_info',
  File "/Users/anton/.pyenv/versions/2.7.16/envs/dn-campaign/lib/python2.7/site-packages/pip/_internal/utils/subprocess.py", line 242, in call_subprocess
    raise InstallationError(exc_msg)
pip._internal.exceptions.InstallationError: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
```

And also this:

```
No handlers could be found for logger "pip.subprocessor"
Traceback (most recent call last):
  File "/Users/anton/.pyenv/versions/dn-campaign/bin/pip-compile", line 8, in <module>
    sys.exit(cli())
  File "/Users/anton/.pyenv/versions/2.7.16/envs/dn-campaign/lib/python2.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/Users/anton/.pyenv/versions/2.7.16/envs/dn-campaign/lib/python2.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/Users/anton/.pyenv/versions/2.7.16/envs/dn-campaign/lib/python2.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/anton/.pyenv/versions/2.7.16/envs/dn-campaign/lib/python2.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/Users/anton/.pyenv/versions/2.7.16/envs/dn-campaign/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/Users/anton/.pyenv/versions/2.7.16/envs/dn-campaign/lib/python2.7/site-packages/piptools/scripts/compile.py", line 358, in cli
    results = resolver.resolve(max_rounds=max_rounds)
  File "/Users/anton/.pyenv/versions/2.7.16/envs/dn-campaign/lib/python2.7/site-packages/piptools/resolver.py", line 168, in resolve
    has_changed, best_matches = self._resolve_one_round()
  File "/Users/anton/.pyenv/versions/2.7.16/envs/dn-campaign/lib/python2.7/site-packages/piptools/resolver.py", line 263, in _resolve_one_round
    their_constraints.extend(self._iter_dependencies(best_match))
  File "/Users/anton/.pyenv/versions/2.7.16/envs/dn-campaign/lib/python2.7/site-packages/piptools/resolver.py", line 339, in _iter_dependencies
    for dependency in self.repository.get_dependencies(ireq):
  File "/Users/anton/.pyenv/versions/2.7.16/envs/dn-campaign/lib/python2.7/site-packages/piptools/repositories/pypi.py", line 272, in get_dependencies
    download_dir, ireq, wheel_cache
  File "/Users/anton/.pyenv/versions/2.7.16/envs/dn-campaign/lib/python2.7/site-packages/piptools/repositories/pypi.py", line 231, in resolve_reqs
    results = resolver._resolve_one(reqset, ireq)
  File "/Users/anton/.pyenv/versions/2.7.16/envs/dn-campaign/lib/python2.7/site-packages/pip/_internal/legacy_resolve.py", line 365, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "/Users/anton/.pyenv/versions/2.7.16/envs/dn-campaign/lib/python2.7/site-packages/pip/_internal/legacy_resolve.py", line 295, in _get_abstract_dist_for
    req, self.require_hashes, self.use_user_site, self.finder,
  File "/Users/anton/.pyenv/versions/2.7.16/envs/dn-campaign/lib/python2.7/site-packages/pip/_internal/operations/prepare.py", line 258, in prepare_editable_requirement
    req, self.req_tracker, finder, self.build_isolation,
  File "/Users/anton/.pyenv/versions/2.7.16/envs/dn-campaign/lib/python2.7/site-packages/pip/_internal/operations/prepare.py", line 49, in _get_prepared_distribution
    abstract_dist.prepare_distribution_metadata(finder, build_isolation)
  File "/Users/anton/.pyenv/versions/2.7.16/envs/dn-campaign/lib/python2.7/site-packages/pip/_internal/distributions/source/legacy.py", line 39, in prepare_distribution_metadata
    self.req.prepare_metadata()
  File "/Users/anton/.pyenv/versions/2.7.16/envs/dn-campaign/lib/python2.7/site-packages/pip/_internal/req/req_install.py", line 563, in prepare_metadata
    self.metadata_directory = metadata_generator(self)
  File "/Users/anton/.pyenv/versions/2.7.16/envs/dn-campaign/lib/python2.7/site-packages/pip/_internal/operations/generate_metadata.py", line 124, in _generate_metadata_legacy
    command_desc='python setup.py egg_info',
  File "/Users/anton/.pyenv/versions/2.7.16/envs/dn-campaign/lib/python2.7/site-packages/pip/_internal/utils/subprocess.py", line 242, in call_subprocess
    raise InstallationError(exc_msg)
pip._internal.exceptions.InstallationError: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
```
@antonagestam could you paste `requirements.in`? I'll check.
I've got the `pip.subprocessor` variant with the following requirements.in

```
Cohen >= 0.7.4

# For https://github.com/lobocv/eventdispatcher/commit/b238ee18fa511c54090c21c7801564edd0dd95ef#diff-3e88a25682c0094a8dfc3cabbaa05dcb to fix clock issue
# The < 1.9.5 is because of https://github.com/lobocv/eventdispatcher/issues/2
eventdispatcher >= 1.9.0,<1.9.5

pip-tools

axiom
tagpy
netifaces
twisted

# Because last release is very broken. See https://github.com/inducer/tagpy/issues/5
-e git+https://github.com/inducer/tagpy.git#egg=tagpy
```

Like the one from https://github.com/palfrey/parochial currently, but with the Twisted version lockdown removed. Incidentally, it works with `twisted < 15` and every value up to `< 19` but not `< 20` so might have something to do with Twisted 19.x?
I think I've finally figured this one out.
Due to how we import `pip` internals, the builtin `logging` module configuration is never properly done.

It should be pretty straightforward to fix, and help give a bit more details from pip logger when we hit some odd failure cases. I'll open up a MR soon.

Resolving patch:
diff --git a/piptools/logging.py b/piptools/logging.py
--- a/piptools/logging.py
+++ b/piptools/logging.py
@@ -1,8 +1,14 @@
 # coding: utf-8
 from __future__ import absolute_import, division, print_function, unicode_literals
 
+import logging
+
 from . import click
 
+# Initialise the builtin logging module for other component using it.
+# Ex: pip
+logging.basicConfig()
+
 
 class LogContext(object):
     def __init__(self, verbosity=0):


Test patch: