4

I'm new to Python and I'm trying to install web2py in a virtualenv. I'm running a 32 bit python 2.7.3 installation on a 64 bit Windows 7.

From what I read, this should be the process:

  • install virtualenv (done)
  • create the virtualenv (done)
  • install pywin32 in that env (I've read it needs to be installed before the web2py installation)
  • install web2py in that env

First and foremost: is that right? If so, then...

I tried installing pywin32 through

'''easy_install pywin32-218.win32-py2.7.exe'''

It went fine. Then, I checked the virtual environment's site-packages for a pywin32 folder and it was there, but I couldn't import it into python ('''ther's no module pywin32'''). The environment was definitely active (I double-checked).

As a test, without using virtualenv, I double-click-installed the pywin32 binary (downloaded the 32 bit version for python 2.7 -- pywin32-218.win32-py2.7.exe) but got an error at the end:

'''close failed in file object destructor:

sys.excepthook is missing

lost sys.stderr'''

I downloaded the file again (could be corrupted), tried installing it again but got the same result.

Could anybody guide me or point me to a step-by-step install of pywin32 (if necessary) and then web2py for windows 7? I'd really appreciate it.

bernardo.g
  • 826
  • 1
  • 12
  • 27

2 Answers2

1

its a bug: http://sourceforge.net/tracker/?func=detail&aid=3402824&group_id=78018&atid=551954, workaround here : http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/rev/a64d8ac23e61 similar to this: Error installing and running pywin32 2.7

Community
  • 1
  • 1
samaras
  • 235
  • 4
  • 20
  • I will try the approach described in your links (installing the binaries with a different account - not the Administrator account) to see if I can install it in my 'main' Python installation, but I would still like to be able to install pywin32 (and, later, web2py) in a virtualenv. Could anybody help? Thanks in advance! – bernardo.g Nov 29 '12 at 13:58
0

In my experience, the command easy_install pywin32-218.win32-py2.7.exe under an active virtualenv works fine.

To test the installation of pywin32, from python you can try:

from win32api import GetVersionEx
print GetVersionEx()

Obtaining something similar to (windows major version, minor version, build number, platform id, additional informations):

(6, 1, 7601, 2, 'Service Pack 1')

You cannot import module pywin32 because it doesn't exist.

After the installation of pywin32, you can install web2py under the active virtualenv (I tested it until to opening the admin interface, no guarantee after this :-):

  • download the source code from http://www.web2py.com/init/default/download
  • unzip it to ...\virtualenvdir\Lib\site-packages\ (obtaining: ...\virtualenvdir\Lib\site-packages\web2py\...)
  • cd to ...\virtualenvdir\Lib\site-packages\web2py
  • start the web2py server: python web2py.py

At the date, I couldn't install web2py using pip. First of all, it grabs an old version of web2py from PyPy. When I tryed to use this version of web2py I got an error ImportError: No module named .... The same using pip on a copy of the web2py source file.

ldfa
  • 28
  • 5