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 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt; Processing module test \(test\.py\)\.\.\. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt; warning: couldn&#39;t find real module for class &lt;class &#39;fftpack\.error&#39;&gt; \(module name: fftpack\) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt; warning: couldn&#39;t find real module for class &lt;class &#39;lapack\_lite\.LapackError&#39;&gt; \(module name: lapack\_lite\) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt; warning: couldn&#39;t find real module for class &lt;type &#39;mtrand\.RandomState&#39;&gt; \(module name: mtrand\) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt; ImportError: No module named \_winreg &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt; warning: couldn&#39;t find real module for class &lt;type &#39;cntr\.Cntr&#39;&gt; \(module name: cntr\) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt; Warnings\.\.\. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt; test\.py:3: Imported module \(pylab\) not used &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt; cat test.py
     > #! /usr/bin/python
     >
     > import pylab
     > $