[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [HTCondor-users] virtualenv, pip and htcondor (python)



Lukasz:

I had to solve the same problem. Unfortunately, no pip-based installation yet although that would facilitate portability on the grid. Here is my solution which you could adapt. The paths are for Debian and RHEL6-derived platforms and the interpreter is /usr/bin/python:

try:
 import htcondor
 import classad
except ImportError:
 import imp
 paths_to_try = ['/usr/lib/python2.6/dist-packages/',
  '/usr/lib/python2.7/dist-packages/',
  '/usr/lib64/python2.6/dist-packages/',
  '/usr/lib64/python2.7/dist-packages/']
 try:
  f1, filename1, desc1 = imp.find_module('htcondor', paths_to_try)
  f2, filename2, desc2 = imp.find_module('classad', paths_to_try)
  htcondor = imp.load_module('htcondor', f1, filename1, desc1)
  classad = imp.load_module('classad', f2, filename2, desc2)
 except ImportError:
  print 'I looked really hard, could not find the HTCondor Python bindings!'
  sys.exit(EXIT_CODES['invalid'])
 finally:
  if f1:
   f1.close()
  if f2:
   f2.close()

--
Tom Downes
Associate Scientist and Data CenterÂManager
Center for Gravitation, Cosmology and Astrophysics
University of Wisconsin-Milwaukee
414.229.2678

On Fri, Jul 10, 2015 at 5:46 AM, L Kreczko <L.Kreczko@xxxxxxxxxxxxx> wrote:
Dear all,

I am currently trying to use the htcondor python bindings in our code, but I could not find a good way to make this possible.

The setup:
The experiment framework sets up a separate python version (2.7) that is newer than the OS default. On top of that our code uses virtualenv (https://github.com/pypa/virtualenv) that allows you to create an isolated python environment.

While the htcondor python bindings are available for the OS python (2.6) they are not for anything above.

So, is it possible to setup htcondor via pip or similar?

A possible solution is to symlink the OS libraries to the virtualenv installation, but there must be a better way than this:
ln -s /usr/lib64/python2.6/site-packages/htcondor.so external/vpython/lib/python2.7/site-packages/htcondor.so
ln -s /usr/lib64/python2.6/site-packages/classad.so external/vpython/lib/python2.7/site-packages/classad.so

Cheers,
Luke

--
*********************************************************
 Dr Lukasz Kreczko     ÂÂ
 Research Assistant


 University of Bristol

 HH Wills Physics Lab
 University of Bristol
 Tyndall Avenue
 Bristol
 BS8 1TL


 +44 (0)117 928 8724Â
*********************************************************

_______________________________________________
HTCondor-users mailing list
To unsubscribe, send a message to htcondor-users-request@xxxxxxxxxxx with a
subject: Unsubscribe
You can also unsubscribe by visiting
https://lists.cs.wisc.edu/mailman/listinfo/htcondor-users

The archives can be found at:
https://lists.cs.wisc.edu/archive/htcondor-users/