Last modified: 2014-07-25 06:59:38 UTC
Created attachment 14657 [details] Detailed walktrough to reproduce the bug Steps to reproduce: * get pywikibot from http://tools.wmflabs.org/pywikibot/core.tar.gz * tar extract that file * create a virtualenv (e.g. pywikibottest) * workon that virtualenv * install the package following install instructions (basically python setup.py install) Import of pywikibot fails. See attachment for details.
Seems to work for me: $ virtualenv bug61783 $ source bug61783/bin/activate $ curl http://tools.wmflabs.org/pywikibot/core.tar.gz | tar xvz $ cd core $ python setup.py install $ python Python 2.7.3 (default, Sep 26 2013, 20:03:06) [GCC 4.6.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import pywikibot >>> The path looks comparable: ['', '/home/valhallasw/bug61783/bin', '/home/valhallasw/bug61783/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg', '/home/valhallasw/bug61783/local/lib/python2.7/site-packages/pip-1.1-py2.7.egg', '/home/valhallasw/bug61783/local/lib/python2.7/site-packages/Pywikipediabot-2.0b1-py2.7.egg', '/home/valhallasw/bug61783/local/lib/python2.7/site-packages/httplib2-0.8_pywikibot1-py2.7.egg', '/home/valhallasw/bug61783/lib/python2.7', '/home/valhallasw/bug61783/lib/python2.7/plat-linux2', '/home/valhallasw/bug61783/lib/python2.7/lib-tk', '/home/valhallasw/bug61783/lib/python2.7/lib-old', '/home/valhallasw/bug61783/lib/python2.7/lib-dynload', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-linux2', '/usr/lib/python2.7/lib-tk', '/home/valhallasw/bug61783/local/lib/python2.7/site-packages', '/home/valhallasw/bug61783/local/lib/python2.7/site-packages/IPython/extensions'] except for the slightly different distribute version... What version of setuptools have you installed? Anything newer than 1.1.6 (which is what ez_setup.py specifies)?
I'm seeing the same issue if I move out of the source directory before executing Python. If I run from the core directory it simply imports it from './pywikibot', which of course is successful. Python version: 2.7.3 virtualenv version: 1.7.1.2 So after 'python setup.py install' I do: cd .. python Python 2.7.3 (default, Feb 27 2014, 19:58:35) [GCC 4.6.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import pywikibot Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named pywikibot This happens even though the pywikibot modules appears to be in the path: >>> import sys >>> sys.path ['', '/export/scratch/morten/bug61783/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg', '/export/scratch/morten/bug61783/local/lib/python2.7/site-packages/pip-1.1-py2.7.egg', '/export/scratch/morten/bug61783/local/lib/python2.7/site-packages/Pywikipediabot-2.0b1-py2.7.egg', '/export/scratch/morten/bug61783/local/lib/python2.7/site-packages/httplib2-0.8_pywikibot1-py2.7.egg', (rest omitted for brevity)]
Change 121535 had a related patch set uploaded by Merlijn van Deen: Bug 61783: also install root pywikibot package https://gerrit.wikimedia.org/r/121535
Change 121535 merged by jenkins-bot: Bug 61783: also install root pywikibot package https://gerrit.wikimedia.org/r/121535
I was not able to use pywikibot in a virtualenv (installed using `pip install pywikibot` as in directions here: https://bugzilla.wikimedia.org/show_bug.cgi?id=65176) until I put a copy of user-config.py in my home directory. Once I added user-config.py to my home directory, `import pywikibot` ran without error in the interpreter.