Page MenuHomePhabricator

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

Description

$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 http://0.0.0.0:5000/ (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/run.py", line 120, in main
    run_web()
  File "/vagrant/wikimetrics/wikimetrics/run.py", line 16, in run_web
    app.run(host=app.config.get('SERVER_HOST'), port=app.config.get('SERVER_PORT'))
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 772, in run
    run_simple(host, port, self, **options)
  File "/usr/local/lib/python2.7/dist-packages/werkzeug/serving.py", line 622, in run_simple
    reloader_type)
  File "/usr/local/lib/python2.7/dist-packages/werkzeug/_reloader.py", line 269, in run_with_reloader
    reloader.run()
  File "/usr/local/lib/python2.7/dist-packages/werkzeug/_reloader.py", line 159, in run
    for filename in chain(_iter_module_files(), self.extra_files):
  File "/usr/local/lib/python2.7/dist-packages/werkzeug/_reloader.py", line 70, in _iter_module_files
    for package_path in getattr(module, '__path__', ()):
  File "/usr/lib/python2.7/dist-packages/six.py", line 116, in __getattr__
    _module = self._resolve()
  File "/usr/lib/python2.7/dist-packages/six.py", line 105, in _resolve
    return _import_module(self.mod)
  File "/usr/lib/python2.7/dist-packages/six.py", line 76, in _import_module
    __import__(name)
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-apt                     0.9.3.5ubuntu1
python-apt-common              0.9.3.5ubuntu1
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-apt                    0.9.3.5ubuntu1
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-software-properties    0.92.37.3
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

12,14c12,14
< python-apport                  2.14.1-0ubuntu3.6
< python-apt                     0.9.3.5
< python-apt-common              0.9.3.5
---
> python-apport                  2.14.1-0ubuntu3.7
> python-apt                     0.9.3.5ubuntu1
> python-apt-common              0.9.3.5ubuntu1
43,44c43
< python-problem-report          2.14.1-0ubuntu3.6
< python-py                      1.4.20-1
---
> python-problem-report          2.14.1-0ubuntu3.7
52d50
< python-tox                     1.6.0-1
57,58c55
< python-urllib3                 1.7.1-1build1
< python-virtualenv              1.11.4-1
---
> python-urllib3                 1.7.1-1ubuntu0.1
61c58
< python-yaml                    3.10-4build4
---
> python-yaml                    3.10-4ubuntu0.1
67,68c64,65
< python3-apport                 2.14.1-0ubuntu3.6
< python3-apt                    0.9.3.5
---
> python3-apport                 2.14.1-0ubuntu3.7
> python3-apt                    0.9.3.5ubuntu1
71c68
< python3-distupgrade            1:0.220.6
---
> python3-distupgrade            1:0.220.7
76c73
< python3-problem-report         2.14.1-0ubuntu3.6
---
> python3-problem-report         2.14.1-0ubuntu3.7
78c75
< python3-software-properties    0.92.37.2
---
> python3-software-properties    0.92.37.3
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
/usr/local/lib/python2.7/dist-packages/urllib3/packages/six.py
180:    MovedModule("winreg", "_winreg"),

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

This horrible patch makes things work:

$ diff -uw /usr/lib/python2.7/dist-packages/six.py-orig /usr/lib/python2.7/dist-packages/six.py
--- /usr/lib/python2.7/dist-packages/six.py-orig        2015-02-19 23:16:09.317662663 +0000
+++ /usr/lib/python2.7/dist-packages/six.py     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