Repository: pypa/pip

Issue:
RuntimeWarning: Config variable 'Py_DEBUG' is unset
When I run pip (any argument) I get the following message:

```
c:\Program Files\Python34\Scripts>pip --version
c:\progra~1\python34\lib\site-packages\pip\pep425tags.py:89: RuntimeWarning: Config variable 'Py_DEBUG' is unset, Python ABI tag may be incorrect
  warn=(impl == 'cp')):
c:\progra~1\python34\lib\site-packages\pip\pep425tags.py:93: RuntimeWarning: Config variable 'WITH_PYMALLOC' is unset, Python ABI tag may be incorrect
  warn=(impl == 'cp')):
pip 8.0.0 from c:\progra~1\python34\lib\site-packages (python 3.4)
```

I think something is wrong.



Discussion:
Important to cite that I am running it on Windows, and I just upgraded to the 8.0.0 with `pip install -U pip`.

Also hitting this on Windows. Issue 3075 looks relevant.

Is it causing an error, or just printing spurious warnings?

Just the warnings. It appear to be working as expected.

Okay, that much is good then! This will be because of the new, attempted emulation of SOABI support in pip 8.0. It may be need to adjusted for Windows.

Great. I have no idea what is SOABI, so... :sweat_smile: 

Both Anaconda Python 3.4, & Python.org 3.5 x64 give this:

```
From sysconfig:
Py_DEBUG: None
WITH_PYMALLOC: None
Py_UNICODE_SIZE: None
From headers:
Error getting Py_DEBUG
WITH_PYMALLOC: 1
Error getting Py_UNICODE_SIZE
```

from this

``` python
import sysconfig
print('From sysconfig:')
for k in 'Py_DEBUG', 'WITH_PYMALLOC', 'Py_UNICODE_SIZE':
    try:
        print(k + ': ' + repr(sysconfig.get_config_var(k)))
    except:
        print('Error getting %s' % k)

print('From headers:')
h_file = sysconfig.get_config_h_filename()
conf_vars = sysconfig.parse_config_h(open(h_file))
for k in 'Py_DEBUG', 'WITH_PYMALLOC', 'Py_UNICODE_SIZE':
    try:
        print(k + ': ' + repr(conf_vars[k]))
    except:
        print('Error getting %s' % k)
```

@zooba do you know what would be the nicest way to find if a python is a debug build on Windows, and/or have any comments for the rest of this? [pep425tags.get_abi_tag](https://github.com/pypa/pip/blob/develop/pip/pep425tags.py#L78) is the function trying to find this information

I guess the main question is whether we can actually rely on those variables being defined or if we have to just treat undefined as a false. It appears that we're not going to be able to detect the difference between undefined and false and we should just remove the warning?

Maybe it could simply be switched to a debug log ?

That seems like a reasonable thing to do.


Resolving patch:
diff --git a/pip/pep425tags.py b/pip/pep425tags.py
--- a/pip/pep425tags.py
+++ b/pip/pep425tags.py
@@ -5,6 +5,7 @@
 import sys
 import warnings
 import platform
+import logging
 
 try:
     import sysconfig
@@ -13,6 +14,10 @@
     import distutils.sysconfig as sysconfig
 import distutils.util
 
+
+logger = logging.getLogger(__name__)
+
+
 _osx_arch_pat = re.compile(r'(.+)_(\d+)_(\d+)_(.+)')
 
 
@@ -69,8 +74,8 @@ def get_flag(var, fallback, expected=True, warn=True):
     val = get_config_var(var)
     if val is None:
         if warn:
-            warnings.warn("Config variable '{0}' is unset, Python ABI tag may "
-                          "be incorrect".format(var), RuntimeWarning, 2)
+            logger.debug("Config variable '%s' is unset, Python ABI tag may "
+                         "be incorrect", var)
         return fallback()
     return val == expected
 


Test patch: