Page MenuHomePhabricator

Wikimetrics-web startup fails on Ubuntu 14.04 MediaWiki-Vagarnt due to _winreg load failure
Closed, DeclinedPublic


$sudo -u wikimetrics wikimetrics --mode web \
  --db-config /etc/wikimetrics/db_config.yaml 
  --queue-config /etc/wikimetrics/queue_config.yaml \
  --web-config /etc/wikimetrics/web_config.yaml
 * Running on (Press CTRL+C to quit)
 * Restarting with stat
Traceback (most recent call last):
  File "/usr/local/bin/wikimetrics", line 9, in <module>
    load_entry_point('wikimetrics==0.0.1', 'console_scripts', 'wikimetrics')()
  File "/vagrant/wikimetrics/wikimetrics/", line 120, in main
  File "/vagrant/wikimetrics/wikimetrics/", line 16, in run_web'SERVER_HOST'), port=app.config.get('SERVER_PORT'))
  File "/usr/local/lib/python2.7/dist-packages/flask/", line 772, in run
    run_simple(host, port, self, **options)
  File "/usr/local/lib/python2.7/dist-packages/werkzeug/", line 622, in run_simple
  File "/usr/local/lib/python2.7/dist-packages/werkzeug/", line 269, in run_with_reloader
  File "/usr/local/lib/python2.7/dist-packages/werkzeug/", line 159, in run
    for filename in chain(_iter_module_files(), self.extra_files):
  File "/usr/local/lib/python2.7/dist-packages/werkzeug/", line 70, in _iter_module_files
    for package_path in getattr(module, '__path__', ()):
  File "/usr/lib/python2.7/dist-packages/", line 116, in __getattr__
    _module = self._resolve()
  File "/usr/lib/python2.7/dist-packages/", line 105, in _resolve
    return _import_module(self.mod)
  File "/usr/lib/python2.7/dist-packages/", line 76, in _import_module
ImportError: No module named _winreg

Related Objects

Event Timeline

bd808 raised the priority of this task from to Needs Triage.
bd808 updated the task description. (Show Details)
bd808 added subscribers: bd808, kevinator, ori.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptFeb 19 2015, 10:28 PM

Installed python system packages:

$ dpkg -l|grep ^ii|awk '{printf "%-30s %s\n", $2, $3}'|grep python
dh-python                      1.20140128-1ubuntu8
libpython-dev:amd64            2.7.5-5ubuntu3
libpython-stdlib:amd64         2.7.5-5ubuntu3
libpython2.7:amd64             2.7.6-8
libpython2.7-dev:amd64         2.7.6-8
libpython2.7-minimal:amd64     2.7.6-8
libpython2.7-stdlib:amd64      2.7.6-8
libpython3-stdlib:amd64        3.4.0-0ubuntu2
libpython3.4-minimal:amd64     3.4.0-2ubuntu1
libpython3.4-stdlib:amd64      3.4.0-2ubuntu1
python                         2.7.5-5ubuntu3
python-apport                  2.14.1-0ubuntu3.7
python-chardet                 2.0.1-2build2
python-cheetah                 2.4.4-3.fakesyncbuild1
python-colorama                0.2.5-0.1ubuntu1
python-configobj               4.7.2+ds-5build1
python-crypto                  2.6.1-4build1
python-dbus                    1.2.0-2build2
python-dbus-dev                1.2.0-2build2
python-debian                  0.1.21+nmu2ubuntu2
python-dev                     2.7.5-5ubuntu3
python-distlib                 0.1.8-1
python-gdbm                    2.7.5-1ubuntu1
python-gi                      3.12.0-1ubuntu1
python-html5lib                0.999-2
python-httplib2                0.8-2build1
python-json-pointer            1.0-2build1
python-jsonpatch               1.3-4
python-keyring                 3.5-1
python-launchpadlib            1.10.2+ds-2
python-lazr.restfulclient      0.13.3-1build1
python-lazr.uri                1.0.3-1build1
python-minimal                 2.7.5-5ubuntu3
python-nose                    1.3.1-2
python-oauth                   1.0.1-3build2
python-openssl                 0.13-2ubuntu6
python-pam                     0.4.2-13.1ubuntu3
python-pip                     1.5.4-1
python-pkg-resources           3.3-1ubuntu1
python-prettytable             0.7.2-2ubuntu2
python-problem-report          2.14.1-0ubuntu3.7
python-pycurl                  7.19.3-0ubuntu3
python-requests                2.2.1-1ubuntu0.1
python-secretstorage           2.0.0-1ubuntu1.1
python-serial                  2.6-1build1
python-setuptools              3.3-1ubuntu1
python-simplejson              3.3.1-1ubuntu6
python-six                     1.5.2-1
python-twisted-bin             13.2.0-1ubuntu1
python-twisted-core            13.2.0-1ubuntu1
python-twisted-names           13.2.0-1ubuntu1
python-twisted-web             13.2.0-1ubuntu1
python-urllib3                 1.7.1-1ubuntu0.1
python-wadllib                 1.3.2-2build1
python-xapian                  1.2.16-2ubuntu1
python-yaml                    3.10-4ubuntu0.1
python-zope.interface          4.0.5-1ubuntu4
python2.7                      2.7.6-8
python2.7-dev                  2.7.6-8
python2.7-minimal              2.7.6-8
python3                        3.4.0-0ubuntu2
python3-apport                 2.14.1-0ubuntu3.7
python3-commandnotfound        0.3ubuntu12
python3-dbus                   1.2.0-2build2
python3-distupgrade            1:0.220.7
python3-gdbm:amd64             3.4.0-0ubuntu1
python3-gi                     3.12.0-1ubuntu1
python3-minimal                3.4.0-0ubuntu2
python3-newt                   0.52.15-2ubuntu5
python3-problem-report         2.14.1-0ubuntu3.7
python3-pycurl                 7.19.3-0ubuntu3
python3-update-manager         1:0.196.12
python3.4                      3.4.0-2ubuntu1
python3.4-minimal              3.4.0-2ubuntu1

I ran the same on my working version, and here's the diff:

$> diff my.pythons bug.pythons

< python-apport                  2.14.1-0ubuntu3.6
< python-apt           
< python-apt-common    
> python-apport                  2.14.1-0ubuntu3.7
> python-apt           
> python-apt-common    
< python-problem-report          2.14.1-0ubuntu3.6
< python-py                      1.4.20-1
> python-problem-report          2.14.1-0ubuntu3.7
< python-tox                     1.6.0-1
< python-urllib3                 1.7.1-1build1
< python-virtualenv              1.11.4-1
> python-urllib3                 1.7.1-1ubuntu0.1
< python-yaml                    3.10-4build4
> python-yaml                    3.10-4ubuntu0.1
< python3-apport                 2.14.1-0ubuntu3.6
< python3-apt          
> python3-apport                 2.14.1-0ubuntu3.7
> python3-apt          
< python3-distupgrade            1:0.220.6
> python3-distupgrade            1:0.220.7
< python3-problem-report         2.14.1-0ubuntu3.6
> python3-problem-report         2.14.1-0ubuntu3.7
< python3-software-properties
> python3-software-properties
bd808 added a comment.EditedFeb 19 2015, 11:16 PM
< python-urllib3                 1.7.1-1build1
> python-urllib3                 1.7.1-1ubuntu0.1
$ ack _winreg /usr/local/lib/python2.7/dist-packages/urllib3
180:    MovedModule("winreg", "_winreg"),

Commenting out line 180 of urllib3/packages/ doesn't change the error message.

This horrible patch makes things work:

$ diff -uw /usr/lib/python2.7/dist-packages/ /usr/lib/python2.7/dist-packages/
--- /usr/lib/python2.7/dist-packages/        2015-02-19 23:16:09.317662663 +0000
+++ /usr/lib/python2.7/dist-packages/     2015-02-19 23:15:27.129660800 +0000
@@ -73,7 +73,10 @@

 def _import_module(name):
     """Import module, returning the module after the last dot."""
+    try:
-     __import__(name)
+        __import__(name)
+    except Exception, e:
+        return name
     return sys.modules[name]

That's a hack and not a fix though

bd808 triaged this task as Normal priority.Feb 19 2015, 11:34 PM

I'm fairly confident that the error is related to that urllib3 version difference but I'm out of time for messing with it for now.

mforns closed this task as Declined.Mar 26 2019, 2:07 PM
mforns added a subscriber: mforns.

Declining because Wikimetrics is being discontinued. See: T211835.

Restricted Application added a project: Analytics. · View Herald TranscriptMar 26 2019, 2:07 PM