Table of Contents

KInterbasDB Installation Guide - Source Distribution

Note: You might prefer to install a pre-compiled binary distribution of KInterbasDB if one is available for your platform.

Steps:

  1. Satisfy the Dependencies
  2. Compile KInterbasDB
  3. Install KInterbasDB
  4. Test Your KInterbasDB Installation
 
Shortcut for the Experienced and Impatient:
(decompress KInterbasDB into temp_dir)
cd temp_dir
python setup.py build
python setup.py install
python -c "import kinterbasdb"
(delete temp_dir)
Then hit the Usage Guide.

Step 1: Satisfy the Dependencies

KInterbasDB requires a valid combination of the dependencies in the list below.

Detailed instructions on how to install each dependency are beyond the scope of this document; consult the dependency distributor for installation instructions.

Satisfying the dependencies is not difficult! For mainstream operating systems--including Windows and Linux--easily installable binary distributions are available for all of KInterbasDB's dependencies (see the download links below).

Dependencies:

  1. Operating System and C Compiler - one of:
  2. Database - one of:
  3. Python [download here] 2.3 or later

  4. eGenix.com mx Extensions for Python, version 2.0.1 or later [download here]

    By default, KInterbasDB uses the DateTime module of the eGenix.com mx Extensions to represent date and time values, as recommended by the Python DB API Specification.

    However, it is not strictly necessary to use the mx.DateTime module to handle dates and times. See this FAQ.


Step 2: Compile KInterbasDB

Once you have successfully installed the dependencies, you may proceed with the installation of KInterbasDB itself.

Beginning with version 3.0, KInterbasDB has full support for the distutils, the standard facility for Python package distribution and installation. Full instructions for using the distutils are available here, but you can skip them unless you have an otherwise insoluble problem.

Open a command prompt, change to the directory where you decompressed the kinterbasdb source distribution, and type:
python setup.py build

The installation script, setup.py, will attempt to automatically detect the information needed by the C compiler; then it will invoke the distutils to perform the actual compilation. If you installed automatic distributions of the dependencies that place themselves in standard locations (on UNIX-style operating systems) or record their locations in the system registry (on Windows), the compilation should proceed without incident.

On Windows, compilers other than Microsoft Visual C++ usually require some library conversion to work with Python or Firebird. With Firebird 1.5 and MinGW or Firebird 1.0 and Borland C++, setup.py will perform this conversion automatically. If the automatic conversion fails, ensure that your compiler is installed properly (especially that its bin directory is in your PATH). For more information, see the compiler-specific notes in this document, as well as the Section 6.2.2 of the Python standard library documentation on "Installing Python Modules".

If setup.py raises no errors and its output concludes with something like "Creating library...", then you are ready to proceed to the next step.

If you receive an error message, examine its contents and then consult the following table:

Error Message Header Explanation
LIBRARY AUTODETECTION ERROR

The setup script was unable to automatically find one or more files needed for the compilation process, such as a library needed by the C compiler.

Using a text editor, you will need to manually specify the relevant paths in the manual_config section of the setup configuration file, setup.cfg (in the root directory of the KInterbasDB source distribution). Uncomment the item in question and provide a value appropriate to your system. Save the newly modified setup.cfg, then repeat the compilation step.

If manually specifying the library paths fails to solve the problem:
- Your C compiler or linker may not be properly configured.
- You may have a corrupt or incomplete installation of one or more KInterbasDB dependencies.


Note for non-Windows platforms:
If the compiler indicates that it cannot find the include file Python.h, this probably means that you have the user-oriented Python package installed, but not the developer-oriented package that would enable you to compile C extensions.

For example, RedHat-derived distributions such as Fedora split the core Python distribution into python-x.y.z, python-devel-x.y.z, and python-docs-x.y.z packages. You'll need to install the python-devel-x.y.z package in order to compile KInterbasDB.

The use of C extensions to Python is quite common, so Python repackagers such as Linux distributions should include the files necessary to compile C extensions in their basic Python package. The Python core developers have noticed these repackaging mistakes and complained about them, but apparently without effect.

COMPILER CONFIGURATION ERROR

The setup script could not function because of the current configuration of your compiler. The error message should provide details about what went wrong, and perhaps a suggestion of how to fix the problem.

If you are not using the standard compiler for your platform, consult the compiler-specific notes.

LIBRARY CONVERSION ERROR

The setup script's attempt to convert libraries intended for use with Microsoft Visual C++ into a format compatible with your compiler was not successful.

Consult the compiler-specific notes in this document, as well as Section 6.2.2 of the Python standard library documentation on "Installing Python Modules".

PYTHON SYSTEM ERROR

Your Python installation is outdated, lacks some crucial modules, or is otherwise inadequate. The error message will indicate what your options are, which may include installing a more recent Python version, compiling additional C extension modules for your current Python version, or editing setup.cfg to manually specify library paths, thus relieving setup.py of the burden of detecting them.

KINTERBASDB DISTRIBUTION ERROR

The setup script cannot find a file that was supposed to be included with the KInterbasDB source distribution. Try downloading the KInterbasDB source distribution again and decompressing it into a fresh temporary directory, then repeat the compilation step.

LIBRARY MANUAL SPECIFICATION ERROR

One of the library paths specified in setup.cfg is not valid. Verify the location of the library, then edit setup.cfg to reflect the correct path.

If you had no particular reason to manually specify the library path in the first place, try commenting out that entry in setup.cfg, then repeat the compilation step and let the setup script attempt to automatically detect the location of the library.

If the problem persists after you have followed the advice in the error message itself and in the table above, visit the KInterbasDB Forum and report your problem.

Compiler-Specific Notes


Step 3: Install KInterbasDB

During this step, the setup script moves the KInterbasDB package (including the newly compiled C extensions) to the standard package directory of your Python installation so that Python will be able to import kinterbasdb and import kinterbasdb.services

In addition to the Python code and shared library files actually used by the Python interpreter, the setup script typically installs some supporting files, such as documentation. Depending on your system configuration, these supporting files may be placed in the same directory or a different directory from the files used by the Python interpreter.

Run the following command:
python setup.py install

The setup script will install KInterbasDB, listing each file it installs.

Errors during this step are rare because compilation (the finicky part of this process) has already taken place; installation is really just a matter of copying files. However, there will be file system permission errors if the Python installation directory is not writable by the user running the setup script. If you encounter such an error, try one of the following:
- Log in as a user who has the required file system permissions and repeat the installation step.
- Manually copy the directory build/lib.platform-pyver/kinterbasdb (which contains the Python modules and compiled library files created during the compilation step) to a directory in your PYTHONPATH. This approach will not install the supporting files, but they are for the benefit of the programmer rather than the Python interpreter anyway.


Step 4: Test Your KInterbasDB Installation

KInterbasDB has an extensive test suite (snapshots here), but it is not really intended for routine public use.

To verify that KInterbasDB is installed properly, switch to a directory other than the temporary directory into which you decompressed the source distribution (to avoid conflict between the copy of kinterbasdb in that directory and the copy placed under the standard Python site-packages directory), then verify the importability of your KInterbasDB installation by issuing the following command:
python -c "import kinterbasdb as k; print k.__version__"

If the import attempt does not encounter any errors and the version number is what you expected, you are finished. Next, consider reading the KInterbasDB Usage Guide.

You should not encounter any errors at this stage since you have already completed the compilation and installation steps successfully. If you do, please report them to the KInterbasDB Forum.


Table of Contents