Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 547928 - python or python-dateutil: _winreg gets into symbols causing ImportError
Summary: python or python-dateutil: _winreg gets into symbols causing ImportError
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Python Gentoo Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-27 19:40 UTC by Martin Mokrejš
Modified: 2015-05-06 12:05 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
files matching winreg substring (_winreg.txt,19.57 KB, text/plain)
2015-04-27 19:40 UTC, Martin Mokrejš
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Mokrejš 2015-04-27 19:40:00 UTC
Created attachment 402120 [details]
files matching winreg substring

I use pychecker to check my python code. Recently, it started to print ImportError during importing itself or its required modules this:


$ pychecker mytool.py 
Processing module mytool (mytool.py)...
warning: couldn't find real module for class <class 'cElementTree.ParseError'> (module name: cElementTree)
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)
warning: couldn't find real module for class <type 'mtrand.RandomState'> (module name: mtrand)
warning: couldn't find real module for class <type 'cntr.Cntr'> (module name: cntr)
  ImportError: No module named _winreg


The warnings have always been there as far as I remember.



Here is strace output of the above command with last files accessed befoore winreg appears.


[pid 25950] open("/usr/lib64/python2.7/site-packages/dateutil/tzwin.py", 
[pid 25950] read(12, "-packages/dateutil/tzwin.pyt\10\0\0\0"..., 4096) = 2646
[pid 25950] stat("_winreg", 0x7fff048f75c0) = -1 ENOENT (No such file or directory)


[pid 25950] open("/usr/lib64/python2.7/cgi.py", O_RDONLY) = 5
[pid 25950] stat("_winreg", 0x7fff048f7e60) = -1 ENOENT (No such file or directory)
[pid 25950] open("_winreg.so", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid 25950] open("_winregmodule.so", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid 25950] open("_winreg.py", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid 25950] open("_winreg.pyc", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid 25950] stat("_winreg", 0x7fff048f7e60) = -1 ENOENT (No such file or directory)
[pid 25950] open("_winreg.so", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid 25950] open("_winregmodule.so", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid 25950] open("_winreg.py", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid 25950] open("_winreg.pyc", O_RDONLY) = -1 ENOENT (No such file or directory)


[pid 25950] open("/usr/lib64/python2.7/lib-tk/ttk.py", O_RDONLY) = 3
[pid 25950] stat("_winreg", 0x7fff048f8dc0) = -1 ENOENT (No such file or directory)
[pid 25950] open("_winreg.so", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid 25950] open("_winregmodule.so", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid 25950] open("_winreg.py", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid 25950] open("_winreg.pyc", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid 25950] stat("_winreg", 0x7fff048f8dc0) = -1 ENOENT (No such file or directory)
[pid 25950] open("_winreg.so", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid 25950] open("_winregmodule.so", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid 25950] open("_winreg.py", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid 25950] open("_winreg.pyc", O_RDONLY) = -1 ENOENT (No such file or directory)


[pid 25950] write(2, "  ImportError: ", 15  ImportError: ) = 15
[pid 25950] write(2, "No module named _winreg\n", 24No module named _winreg
) = 24

# equery belongs /usr/lib64/python2.7/site-packages/dateutil/tzwin.py
 * Searching for /usr/lib64/python2.7/site-packages/dateutil/tzwin.py ... 
dev-python/python-dateutil-2.4.2 (/usr/lib64/python2.7/site-packages/dateutil/tzwin.py)
# equery belongs /usr/lib64/python2.7/lib-tk/ttk.py
 * Searching for /usr/lib64/python2.7/lib-tk/ttk.py ... 
dev-lang/python-2.7.9-r2 (/usr/lib64/python2.7/lib-tk/ttk.py)
# equery belongs /usr/lib64/python2.7/cgi.py
 * Searching for /usr/lib64/python2.7/cgi.py ... 
dev-lang/python-2.7.9-r2 (/usr/lib64/python2.7/cgi.py)
#


Clues? Is this a python issue or from dev-python/python-dateutil or else?


Will attach output from:

find /usr/lib* -type f | while read f; do grep -H _winreg $f; done
Comment 1 Mike Gilbert gentoo-dev 2015-04-27 19:51:43 UTC
What's in mtool.py?
Comment 2 Martin Mokrejš 2015-04-27 20:15:22 UTC
Here are the imports:

import faulthandler
import gc
import sys, os, datetime
import glob
import re
import tempfile
from subprocess import Popen, PIPE, call
from StringIO import StringIO
from optparse import OptionParser
from itertools import izip, imap, ifilter, chain
import difflib
import colorsys
from random import uniform
from operator import itemgetter
from textwrap import wrap
from math import ceil
import matplotlib
import pylab
import numpy as np
from Bio import SeqIO
from Bio.Seq import Seq, reverse_complement
from Bio.Alphabet import generic_dna
from decimal import Decimal
import copy
        import gdbm
        import bsddb3
        import bsddb
    from Bio import SearchIO
    from Bio import __version__ as _biopython_version
    from distutils.version import StrictVersion
        from Bio.SeqIO.FastaIO import FastaWriter
    from Bio import SearchIO
Comment 3 Martin Mokrejš 2015-04-27 20:36:49 UTC
OK, "import pylab" is the source of the error.

# emerge -pv matplotlib

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R    ] dev-python/matplotlib-1.4.3::gentoo  USE="cairo examples fltk gtk tk wxwidgets -doc -excel -gtk3 -latex -pyside -qt4 -qt5 {-test}" PYTHON_TARGETS="python2_7 -python3_3 -python3_4" 0 KiB

#


I use python 2.7.
Comment 4 Martin Mokrejš 2015-04-27 20:42:12 UTC
$ 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)
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
$
Comment 5 Justin Lecher (RETIRED) gentoo-dev 2015-05-06 10:37:10 UTC
I see the same, though I don't know what it is.
Comment 6 Justin Lecher (RETIRED) gentoo-dev 2015-05-06 11:59:02 UTC
+*six-1.9.0-r1 (06 May 2015)
+
+  06 May 2015; Justin Lecher <jlec@gentoo.org> +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
+


So this one was a six problem. I still see additional import problems. How about you?
Comment 7 Martin Mokrejš 2015-05-06 12:04:21 UTC
I also asked at

[Matplotlib-users] ImportError: No module named _winreg

and the only hint I received is from Thomas Caswell:

<quote>
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.
</quote>

I think it is either due to recent six package update or matplotlib. I cannot test now on my live system.
Comment 8 Justin Lecher (RETIRED) gentoo-dev 2015-05-06 12:05:28 UTC
(In reply to Martin Mokrejš from comment #7)
> I think it is either due to recent six package update or matplotlib. I
> cannot test now on my live system.

It was in six which I backported the fix for in six-1.9.0-r1.