ImportError: No module named _winreg

Thomas Caswell wrote:

winreg looks like it is for programmatic access to the windows registry which mpl uses to find fonts in windows (https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/font_manager.py#L173).

I suspect this is a problem with pychecker being too enthusiastic about checking imports.

FYI:

+*six-1.9.0-r1 (06 May 2015)

···

+
+ 06 May 2015; Justin Lecher <jlec@...1211...> +files/six-1.9.0-winreg.patch,
+ +six-1.9.0-r1.ebuild, metadata.xml, six-9999.ebuild:
+ Backport fix for windows only modules, bug #547928
+

https://bugs.gentoo.org/show_bug.cgi?id=547928

Tom

On Tue, Apr 28, 2015, 08:14 Martin MOKREJŠ <mmokrejs@…287… <mailto:mmokrejs@…287…>> wrote:

    Hi Thomas,
        thank you for your thoughts. But numpy is installed:

    $ python
    Python 2.7.9 (default, Apr 10 2015, 16:21:10)
    [GCC 4.9.2] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
     >>> import pylab
     >>> import numpy
     >>>

    Probably you are right that the warnings (reported only by pychecker) are coming from numpy. They appear with *either* of:

    import pylab
    import numpy
    import matplotlib

    But, what I really asked for was where does the _winreg come from? It happens only with any of "import pylab" or "import matplotlib".

    Martin

    Thomas Caswell wrote:
     > Those look like they are coming up out of numpy. I am not familiar with gentoo, but it looks like numpy is not in the dependencies list.
     >
     > Tom
     >
     > On Mon, Apr 27, 2015, 16:59 Martin MOKREJŠ <mmokrejs@…287… <mailto:mmokrejs@…287…> <mailto:mmokrejs@…287…>> wrote:
     >
     > Hi,
     > I use dev-python/matplotlib-1.4.3 and I suspect this is a recent regression in it. Can anybody reproduce this?
     >
     > $ pychecker test.py
     > Processing module test (test.py)…
     > warning: couldn't find real module for class <class 'fftpack.error'> (module name: fftpack)
     > warning: couldn't find real module for class <class 'lapack_lite.LapackError'> (module name: lapack_lite)
     > warning: couldn't find real module for class <type 'mtrand.RandomState'> (module name: mtrand)
     > ImportError: No module named _winreg
     > warning: couldn't find real module for class <type 'cntr.Cntr'> (module name: cntr)
     >
     > Warnings…
     >
     > test.py:3: Imported module (pylab) not used
     > $ cat test.py
     > #! /usr/bin/python
     >
     > import pylab
     > $