We're Hiring!

Using a custom Python installation

Having a problem deploying OMERO? Please ask new questions at https://forum.image.sc/tags/omero
Please note:
Historical discussions about OMERO. Please look for and ask new questions at https://forum.image.sc/tags/omero

The OMERO.server installation documentation begins here and you can find OMERO.web deployment documentation here.

Using a custom Python installation

Postby rguha » Fri May 27, 2011 12:48 am

Hi, I'm in the process of installing OMERO 4.2 and the system python (/usr/bin/python) is 2.4. However I also have Python 2.6 installed separately - is it possible to indicate during installation that this version of Python be employed (and not the system version)?
rguha
 
Posts: 16
Joined: Thu May 26, 2011 1:04 pm

Re: Using a custom Python installation

Postby jmoore » Fri May 27, 2011 6:09 am

There are several ways to go about doing this, only one of which is OMERO specific:

  • If the Python 2.6 executable is also named "python", then you should be able to add that to the front of your PATH environment variable to have it used, since OMERO simply looks for the first "python" executable. You may also need to modify your PYTHONPATH variable.
  • However, on most systems, the secondary python is named "python26" (or similar), in which case you could use virtualenv to setup a secondary Python installation. We have used this in several different cases with success, typically on CentOS boxes. (See listing 1 below)
  • Finally, if you would rather make the change to OMERO itself, you can modify which executable it looks for in the etc/grid/templates.xml file. Unfortuantely, this is copied in several places, so you'll have to replace all instances of exe="python" with the correct executable. You can use a variable to only have to make the change once, e.g. exe="${PYTHON}". I'll add the variable now to OMERO 4.3 to prevent other users from having to make the same change.

Hope that helps.
~Josh

Listing 1:
Code: Select all
$ python --version
Python 2.6.6
$ virtualenv --python=python2.5 /tmp/my_python2.5
Running virtualenv with interpreter /opt/local/bin/python2.5
New python executable in /tmp/my_python2.5/bin/python
Installing setuptools............................done.
$ source /tmp/my_python2.5/bin/activate
(my_python2.5) $ python --version
Python 2.5.5

User avatar
jmoore
Site Admin
 
Posts: 1591
Joined: Fri May 22, 2009 1:29 pm
Location: Germany

Re: Using a custom Python installation

Postby rguha » Fri May 27, 2011 11:54 am

Thanks a lot!
rguha
 
Posts: 16
Joined: Thu May 26, 2011 1:04 pm

Re: Using a custom Python installation

Postby jmoore » Fri May 27, 2011 11:59 am

Glad to help. Let us know if you have any problems, or what you think works the best.

Cheers,
~Josh.
User avatar
jmoore
Site Admin
 
Posts: 1591
Joined: Fri May 22, 2009 1:29 pm
Location: Germany


Return to Installation and Deployment

Who is online

Users browsing this forum: No registered users and 1 guest