[ome-users] global name 'Image' is not defined?

Chris Allan callan at lifesci.dundee.ac.uk
Mon Aug 15 14:03:03 BST 2011


I assume you've compiled up your own version of Ice against that Python version then as well?

I can't believe that your system would be working at all if you weren't using Python 2.6 unless somehow Python 2.4 is being used in the background and you also have Ice installed (potentially via ZeroC's Yum repositories?). A few things to check and try:

 * Verify that the OMERO.web Python worker processes are actually using Python 2.6
 * Install PIL using your system Python 2.4 and see if the problem goes away
 * Modify the line of code directly in /srv/OMERO.server-Beta-4.3.1/lib/python/omeroweb/webclient/webclient_gateway.py to try:

from PIL import Image
...

-Chris

On 15 Aug 2011, at 13:51, Leon Kolchinsky wrote:

> Sure,
> 
> This is RHEL5.7 and it has python2.4.3 as a default, but I've installed separate python instance 2.6
> 
> Here is how I've installed python:
> NEW Python2.6 and modules installation:
> ---------------------------------------
> 1. Add EPEL repository to the system.
> 
> # python -V
> # wget http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
> # rpm -ivh epel-release-5-4.noarch.rpm
> 
> 2. Disable this repository (no joke), otherwise it tries always to update stuff and will break other python packages!
> Edit the file /etc/yum.repos.d/epel.repo and set everywhere “enabled=0
> 
> # yum install gcc httpd-devel rpm-build atlas-devel blas-devel gcc-gfortran gcc-c++ httpd
> # yum install hdf5 hdf5-devel lzo bzip2 lzo-devel bzip2-libs bzip2-devel
> # yum install python26-setuptools python26 python26-devel python26-distribute python26-libs python26-simplejson mod_python26 --enablerepo=epel
> # easy_install-2.6 pip
> # pip-2.6 install virtualenv
> 
> 2.1. Omero python scripts using "#!/usr/bin/env python" to find python executable.
> So to work around this issue and point Omero to python2.6 we'll do:
> 
> [root at vera144 srv]# ln -s /usr/bin/python2.6 /usr/local/bin/python
> [root at vera144 srv]# export PATH=/usr/local/bin:$PATH
> 
> 4. Install python modules via pip:
> [root at vera144 srv]# export PATH=/usr/local/bin:$PATH
> no need to install this one - (# yum install freetype freetype-devel libpng libpng-devel libjpeg libjpeg-devel jpeg jpeg-devel)
> # yum install libjpeg-devel zlib-devel freetype-devel libpng libpng-devel
> 
> [root at vera144 srv]# pip install Distutils2
> [root at vera144 srv]# pip install PIL
> [root at vera144 srv]# pip install numpy
> [root at vera144 srv]# pip install Cython
> [root at vera144 srv]# pip search numexpr
> [root at vera144 srv]# pip install -U http://www.pytables.org/svn/pytables/trunk
> # pip install matplotlib
> [root at vera144 srv]# pip install django
> 
> That's it.
> 
> I've even tried to reinstall PIL from source:
> 
> [root at vera144 Imaging-1.1.7]# wget http://effbot.org/downloads/Imaging-1.1.7.tar.gz
> [root at vera144 Imaging-1.1.7]# tar -xvzf Imaging-1.1.7.tar.gz
> [root at vera144 Imaging-1.1.7]# cd Imaging-1.1.7
> [root at vera144 Imaging-1.1.7]# python setup.py install
> 
> 
> But I'm still getting this error:
> 
> Mon, 15 Aug 2011 13:37:29 webclient_gateway ERROR    Traceback (most recent call last):
>   File "/srv/OMERO.server-Beta-4.3.1/lib/python/omeroweb/webclient/webclient_gateway.py", line 687, in getExperimenterPhoto
>     photo = self.getExperimenterDefaultPhoto()
>   File "/srv/OMERO.server-Beta-4.3.1/lib/python/omeroweb/webclient/webclient_gateway.py", line 778, in getExperimenterDefaultPhoto
>     img = Image.open(settings.DEFAULT_USER)
> NameError: global name 'Image' is not defined
> 
> Mon, 15 Aug 2011 13:37:30 views-feedback ERROR    handler500: Server error
> Mon, 15 Aug 2011 13:37:30 views-feedback ERROR    Traceback (most recent call last):
> 
>   File "/srv/omeroserver/lib/python/django/core/handlers/base.py", line 92, in get_response
>     response = callback(request, *callback_args, **callback_kwargs)
> 
>   File "/srv/omeroserver/lib/python/omeroweb/webclient/views.py", line 165, in wrapped
>     return f(request, *args, **kwargs)
> 
>   File "/srv/omeroserver/lib/python/omeroweb/webclient/views.py", line 2366, in myphoto
>     photo = conn.getExperimenterPhoto()
> 
>   File "/srv/OMERO.server-Beta-4.3.1/lib/python/omeroweb/webclient/webclient_gateway.py", line 690, in getExperimenterPhoto
>     photo = self.getExperimenterDefaultPhoto()
> 
>   File "/srv/OMERO.server-Beta-4.3.1/lib/python/omeroweb/webclient/webclient_gateway.py", line 778, in getExperimenterDefaultPhoto
>     img = Image.open(settings.DEFAULT_USER)
> 
> NameError: global name 'Image' is not defined
> 
> 
> But I can import Image from command line:
> 
> [omero at vera144 ~]$ python
> Python 2.6.5 (r265:79063, Feb 28 2011, 21:55:45)
> [GCC 4.1.2 20080704 (Red Hat 4.1.2-50)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import Image
> >>>
> 
> 
> Here are my diagnostic messages:
> [omero at vera144 ~]$ /srv/omeroserver/bin/omero admin diagnostics
> 
> ================================================================================
> OMERO Diagnostics 4.3.1-6d4b8c61-b2602
> ================================================================================
> 
> Commands:   java -version                  1.6.0     (/usr/bin/java)
> Commands:   python -V                      2.6.5     (/usr/local/bin/python -- 2 others)
> Commands:   icegridnode --version          3.3.1     (/opt/Ice-3.3.1/bin/icegridnode)
> Commands:   icegridadmin --version         3.3.1     (/opt/Ice-3.3.1/bin/icegridadmin)
> Commands:   psql --version                 9.0.3     (/srv/PostgresPlus/9.0SS/bin/psql)
> 
> Server:     icegridnode                    running
> Server:     Blitz-0                        active (pid = 30320, enabled)
> Server:     DropBox                        active (pid = 30618, enabled)
> Server:     FileServer                     active (pid = 30331, enabled)
> Server:     Indexer-0                      active (pid = 30336, enabled)
> Server:     MonitorServer                  active (pid = 30351, enabled)
> Server:     OMERO.Glacier2                 active (pid = 30343, enabled)
> Server:     OMERO.IceStorm                 active (pid = 30350, enabled)
> Server:     PixelData-0                    active (pid = 30338, enabled)
> Server:     Processor-0                    active (pid = 30339, enabled)
> Server:     Tables-0                       active (pid = 30340, enabled)
> Server:     TestDropBox                    inactive (enabled)
> 
> Log dir:    /srv/omeroserver/var/log       exists
> 
> Log files:  Blitz-0.log                    10.0 MB       errors=3    warnings=249
> Log files:  DropBox.log                    25.0 KB       errors=14   warnings=12
> Log files:  FileServer.log                 2.0 KB
> Log files:  Indexer-0.log                  75.0 KB       errors=7    warnings=12
> Log files:  MonitorServer.log              9.0 KB        errors=0    warnings=5
> Log files:  OMEROweb.log                   206.0 KB      errors=190  warnings=146
> Log files:  PixelData-0.log                16.0 KB       errors=7    warnings=3
> Log files:  Processor-0.log                15.0 KB       errors=1    warnings=13
> Log files:  Tables-0.log                   1.0 KB
> Log files:  TestDropBox.log                n/a
> Log files:  master.err                     4.0 KB
> Log files:  master.out                     0.0 KB
> Log files:  Total size                     11.19 MB
> 
> Parsing Blitz-0.log:[line:98] => Server restarted <=
> Parsing Blitz-0.log:[line:10390] => Server restarted <=
> Parsing Blitz-0.log:[line:18613] => Server restarted <=
> Parsing Blitz-0.log:[line:53397] => Server restarted <=
> Parsing Blitz-0.log:[line:55026] => Server restarted <=
> Parsing Blitz-0.log:[line:61481] => Server restarted <=
> Parsing Blitz-0.log:[line:65245] => Server restarted <=
> 
> Environment:OMERO_HOME=(unset)
> Environment:OMERO_NODE=(unset)
> Environment:OMERO_MASTER=(unset)
> Environment:PATH=/usr/local/bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/opt/Ice-3.3.1:/opt/Ice-3.3.1/bin:/srv/PostgresPlus/9.0SS/bin:/srv/PostgresPlus/9.0SS/pgbouncer/bin:/srv/PostgresPlus/9.0SS/pgAdmin3/bin:/srv/omeroserver/bin
> Environment:ICE_HOME=/opt/Ice-3.3.1
> Environment:LD_LIBRARY_PATH=/opt/Ice-3.3.1/lib64:/usr/lib64:/srv/PostgresPlus/9.0SS/pgAdmin3/lib:/srv/PostgresPlus/9.0SS/pgAgent/lib:/srv/PostgresPlus/9.0SS/lib:
> Environment:DYLD_LIBRARY_PATH=/opt/Ice-3.3.1/lib64:/usr/lib64:
> 
> OMERO data dir: '/srv/omerodata/omero.144'      Exists? True    Is writable? True
> OMERO.web status... [RUNNING] (PID 3637)
> 
> What seems to be the problem?
> 
> Leon Kolchinsky
> 
> 
> 
> On Mon, Aug 15, 2011 at 22:32, Chris Allan <callan at lifesci.dundee.ac.uk> wrote:
> Couple things:
> 
> "You need to install the Python Imaging Library. Get it at http://www.pythonware.com/products/pil/"
> 
> Have you got that anywhere in your OMEROweb.log?
> 
> Could you give us some idea about your deployment platform? Is this RHEL6? Have you compiled your own Python? Could you give us the output of "bin/omero admin diagnostics"?
> 
> -Chris
> 
> On 15 Aug 2011, at 13:12, Leon Kolchinsky wrote:
> 
> > Hello Wiil,
> >
> > I've reinstalled PIL using pip:
> >
> > # pip install -U PIL
> >     PIL 1.1.7 SETUP SUMMARY
> >     --------------------------------------------------------------------
> >     version       1.1.7
> >     platform      linux2 2.6.5 (r265:79063, Feb 28 2011, 21:55:45)
> >                   [GCC 4.1.2 20080704 (Red Hat 4.1.2-50)]
> >     --------------------------------------------------------------------
> >     *** TKINTER support not available
> >     --- JPEG support available
> >     --- ZLIB (PNG/ZIP) support available
> >     --- FREETYPE2 support available
> >     *** LITTLECMS support not available
> >     --------------------------------------------------------------------
> >     To add a missing option, make sure you have the required
> >     library, and set the corresponding ROOT variable in the
> >     setup.py script.
> >
> >     To check the build, run the selftest.py script.
> >     changing mode of build/scripts-2.6/pilprint.py from 644 to 755
> >     changing mode of build/scripts-2.6/pilfont.py from 644 to 755
> >     changing mode of build/scripts-2.6/pilconvert.py from 644 to 755
> >     changing mode of build/scripts-2.6/pilfile.py from 644 to 755
> >     changing mode of build/scripts-2.6/pildriver.py from 644 to 755
> >     changing mode of /usr/bin/pilprint.py to 755
> >     changing mode of /usr/bin/pilfont.py to 755
> >     changing mode of /usr/bin/pilconvert.py to 755
> >     changing mode of /usr/bin/pilfile.py to 755
> >     changing mode of /usr/bin/pildriver.py to 755
> > Successfully installed PIL
> > Cleaning up...
> >
> >
> > The problem still persists ;(
> > When I login to webclient I'm getting this in the OMEROweb.log while clicking on "My account" link:
> >
> > Mon, 15 Aug 2011 13:09:36 blitz_gateway INFO     created connection (uuid=d6f0a2b2-c22c-4969-9849-2435fa7dcecb)
> > Mon, 15 Aug 2011 13:09:36 views-admin  INFO     Have connection as Guest
> > Mon, 15 Aug 2011 13:09:36 views-admin  INFO     Client version: '4.3.1-6d4b8c61-b2602'; Server version: '4.3.1-6d4b8c61-b2602'
> > Mon, 15 Aug 2011 13:09:36 webgateway   INFO     getBlitzConnection(host=vera144.its.mydomain.edu.au, port=4064, ssl=False, username=myuser)
> > Mon, 15 Aug 2011 13:09:36 blitz_gateway INFO     created connection (uuid=5bcc0d30-76d1-48bb-8bdb-f8df778497da)
> > Mon, 15 Aug 2011 13:09:41 omero.util.UpgradeCheck INFO     no update needed
> > Mon, 15 Aug 2011 13:09:41 utils        ERROR    Up to date.
> >
> > Mon, 15 Aug 2011 13:09:42 blitz_gateway INFO     created connection (uuid=5bcc0d30-76d1-48bb-8bdb-f8df778497da)
> > Mon, 15 Aug 2011 13:09:42 blitz_gateway INFO     created connection (uuid=5bcc0d30-76d1-48bb-8bdb-f8df778497da)
> > Mon, 15 Aug 2011 13:09:59 webclient_gateway ERROR    Traceback (most recent call last):
> >   File "/srv/OMERO.server-Beta-4.3.1/lib/python/omeroweb/webclient/webclient_gateway.py", line 687, in getExperimenterPhoto
> >     photo = self.getExperimenterDefaultPhoto()
> >   File "/srv/OMERO.server-Beta-4.3.1/lib/python/omeroweb/webclient/webclient_gateway.py", line 778, in getExperimenterDefaultPhoto
> >     img = Image.open(settings.DEFAULT_USER)
> > NameError: global name 'Image' is not defined
> >
> > Mon, 15 Aug 2011 13:10:00 views-feedback ERROR    handler500: Server error
> > Mon, 15 Aug 2011 13:10:00 views-feedback ERROR    Traceback (most recent call last):
> >
> >   File "/srv/omeroserver/lib/python/django/core/handlers/base.py", line 92, in get_response
> >     response = callback(request, *callback_args, **callback_kwargs)
> >
> >   File "/srv/omeroserver/lib/python/omeroweb/webclient/views.py", line 165, in wrapped
> >     return f(request, *args, **kwargs)
> >
> >   File "/srv/omeroserver/lib/python/omeroweb/webclient/views.py", line 2366, in myphoto
> >     photo = conn.getExperimenterPhoto()
> >
> >   File "/srv/OMERO.server-Beta-4.3.1/lib/python/omeroweb/webclient/webclient_gateway.py", line 690, in getExperimenterPhoto
> >     photo = self.getExperimenterDefaultPhoto()
> >
> >   File "/srv/OMERO.server-Beta-4.3.1/lib/python/omeroweb/webclient/webclient_gateway.py", line 778, in getExperimenterDefaultPhoto
> >     img = Image.open(settings.DEFAULT_USER)
> >
> > NameError: global name 'Image' is not defined
> >
> > Any idea how to fix it?
> >
> > Cheers,
> > Leon Kolchinsky
> >
> >
> >
> > On Mon, Aug 15, 2011 at 15:09, Will Moore <will at lifesci.dundee.ac.uk> wrote:
> > Hi,
> >
> >  This looks like a failure to import PIL (python imaging library).
> >
> > You should be seeing in your log (var/lob/OMERO-web.log) something like this:
> > "You need to install the Python Imaging Library. Get it at http://www.pythonware.com/products/pil/"
> >
> > There are also some mentions on our install pages of how to install PIL.
> > Although it's not really needed in this case (default user photo is not critical) you will find that various other features of the webclient are also dependent on PIL.
> >
> >   Will.
> >
> >
> > On 15 Aug 2011, at 02:11, Leon Kolchinsky wrote:
> >
> >> Hello,
> >>
> >> I'm getting those messages from the system while new users log into Omero web client.
> >> Any tips on how to fix it or if it's OK, how to stop those messages?
> >>
> >> Traceback (most recent call last):
> >>
> >>  File "/srv/omeroserver/lib/python/django/core/handlers/base.py", line 92, in get_response
> >>    response = callback(request, *callback_args, **callback_kwargs)
> >>
> >>  File "/srv/omeroserver/lib/python/omeroweb/webclient/views.py", line 165, in wrapped
> >>    return f(request, *args, **kwargs)
> >>
> >>  File "/srv/omeroserver/lib/python/omeroweb/webclient/views.py", line 2366, in myphoto
> >>    photo = conn.getExperimenterPhoto()
> >>
> >>  File "/srv/OMERO.server-Beta-4.3.1/lib/python/omeroweb/webclient/webclient_gateway.py", line 690, in getExperimenterPhoto
> >>    photo = self.getExperimenterDefaultPhoto()
> >>
> >>  File "/srv/OMERO.server-Beta-4.3.1/lib/python/omeroweb/webclient/webclient_gateway.py", line 778, in getExperimenterDefaultPhoto
> >>    img = Image.open(settings.DEFAULT_USER)
> >>
> >> NameError: global name 'Image' is not defined
> >>
> >>
> >> <WSGIRequest
> >> GET:<QueryDict: {}>,
> >> POST:<QueryDict: {}>,
> >> COOKIES:{'__utma': '192312886.1704004095.1303085135.1312265964.1313025486.33',
> >>  '__utmz': '192312886.1312265964.32.21.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=mydomain%20eResearch',
> >>  'sessionid': '9ce727d572e0871b3d042549a2a582f7'},
> >> META:{'DOCUMENT_ROOT': '/var/www/html',
> >>  'GATEWAY_INTERFACE': 'CGI/1.1',
> >>  'HTTP_ACCEPT': '*/*',
> >>  'HTTP_ACCEPT_ENCODING': 'gzip, deflate',
> >>  'HTTP_ACCEPT_LANGUAGE': 'en-us',
> >>  'HTTP_CONNECTION': 'keep-alive',
> >>  'HTTP_COOKIE': 'sessionid=9ce727d572e0871b3d042549a2a582f7; __utma=175132154.1224947860.1303083934.1309411927.1313033085.5; __utmz=175132154.1306203174.3.2.utmccn=(organic)|utmcsr=google|utmctr=it+service+desk+mydomain|utmcmd=organic; __utmz=192312886.1312265964.32.21.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=mydomain%20eResearch; __utma=192312886.1704004095.1303085135.1312265964.1313025486.33',
> >>  'HTTP_HOST': 'vera144.its.mydomain.edu.au',
> >>  'HTTP_REFERER': 'http://vera144.its.mydomain.edu.au/webclient/upload_myphoto/',
> >>  'HTTP_USER_AGENT': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/534.50 (KHTML, like Gecko) Version/5.1 Safari/534.50',
> >>  'PATH': '/sbin:/usr/sbin:/bin:/usr/bin',
> >>  'PATH_INFO': u'/webclient/myphoto/',
> >>  'PATH_TRANSLATED': '/srv/omeroserver/var/omero.fcgi/webclient/myphoto/',
> >>  'QUERY_STRING': '',
> >>  'REMOTE_ADDR': '130.194.148.244',
> >>  'REMOTE_PORT': '49846',
> >>  'REQUEST_METHOD': 'GET',
> >>  'REQUEST_URI': '/webclient/myphoto/',
> >>  'SCRIPT_FILENAME': '/srv/omeroserver/var/omero.fcgi',
> >>  'SCRIPT_NAME': u'',
> >>  'SERVER_ADDR': '130.194.245.189',
> >>  'SERVER_ADMIN': 'root at localhost',
> >>  'SERVER_NAME': 'vera144.its.mydomain.edu.au',
> >>  'SERVER_PORT': '80',
> >>  'SERVER_PROTOCOL': 'HTTP/1.1',
> >>  'SERVER_SIGNATURE': '<address>Apache/2.2.3 (Red Hat) Server at vera144.its.mydomain.edu.au Port 80</address>\n',
> >>  'SERVER_SOFTWARE': 'Apache/2.2.3 (Red Hat)',
> >>  'wsgi.errors': <flup.server.fcgi_base.TeeOutputStream object at 0x1d1cc890>,
> >>  'wsgi.input': <flup.server.fcgi_base.InputStream object at 0x1d1cc410>,
> >>  'wsgi.multiprocess': True,
> >>  'wsgi.multithread': False,
> >>  'wsgi.run_once': False,
> >>  'wsgi.url_scheme': 'http',
> >>  'wsgi.version': (1, 0)}>
> >>
> >>
> >> Cheers,
> >> Leon Kolchinsky
> >>
> >> _______________________________________________
> >> ome-users mailing list
> >> ome-users at lists.openmicroscopy.org.uk
> >> http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-users
> >
> > William Moore
> > Wellcome Trust Centre for Gene Regulation & Expression
> > College of Life Sciences
> > MSI/WTB/JBC Complex
> > University of Dundee
> > Dow Street
> > Dundee  DD1 5EH
> > United Kingdom
> >
> > Phone 01382 386364
> > http://openmicroscopy.org
> >
> >
> >
> >
> >
> >
> > _______________________________________________
> > ome-users mailing list
> > ome-users at lists.openmicroscopy.org.uk
> > http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-users
> 
> 




More information about the ome-users mailing list