23

I built quickfix engine (http://www.quickfixengine.org/) for one of my tasks and also built in python support for it.

Unfortunately this is a multi user env and I dont have access to the python installation path. Thus the make install command tries to copy over the files and fails. I managed to comment out the two lines where it tries to do that and the make install completed. Since I cannot put the files there, where can I put the .so file created?

And how do I let python know that it is there? I looked at python.org documentation but it only describes the process for setup.py installations.

Also I tried putting the path for the .so in sys.path, that didnt work. And is there any documents about the anatomy of a python package? Thanks.

nj2237
  • 1,220
  • 3
  • 21
  • 25
Osada Lakmal
  • 891
  • 2
  • 8
  • 22
  • "Also I tried putting the path for the .so in sys.path, that didnt work." Have you tried importing the extension module from a script (or interactive session) in the same directory as the `.so` file for the extension? – gotgenes Feb 10 '11 at 03:57

2 Answers2

18

I'm going to assume compiling the QuickFix package does not produce a setup.py file, but rather only compiles the Python bindings and relies on make install to put them in the appropriate place.

In this case, a quick and dirty fix is to compile the QuickFix source, locate the Python extension modules (you indicated on your system these end with a .so extension), and add that directory to your PYTHONPATH environmental variable e.g., add

export PYTHONPATH=~/path/to/python/extensions:PYTHONPATH

or similar line in your shell configuration file.

A more robust solution would include making sure to compile with ./configure --prefix=$HOME/.local. Assuming QuickFix knows to put the Python files in the appropriate site-packages, when you do make install, it should install the files to ~/.local/lib/pythonX.Y/site-packages, which, for Python 2.6+, should already be on your Python path as the per-user site-packages directory.

If, on the other hand, it did provide a setup.py file, simply run

python setup.py install --user

for Python 2.6+.

gotgenes
  • 38,661
  • 28
  • 100
  • 128
2

Here is the official FAQ on installing Python Modules: http://docs.python.org/install/index.html

There are some tips which might help you.

  • yes, i had a look at it. But the issue is it describes how to install something that came packaged as a python module (something to be installed by using setup.py). It does not tell you how to install some library that left a .so around. :( – Osada Lakmal Feb 08 '11 at 13:05
  • Here are some other ideas http://dubroy.com/blog/so-you-want-to-install-a-python-package/. Seems like the solution for you might be pip (http://pypi.python.org/pypi/pip). – Please treat your mods well. Feb 08 '11 at 13:14