mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-16 18:34:54 -06:00
Use commit 0e1e780fd6f18ce93119061e36a4fca9711bc020 Excluded multibuild folder, as this caused git issues
89 lines
3.5 KiB
Plaintext
89 lines
3.5 KiB
Plaintext
Installing the ert-python code
|
|
==============================
|
|
There is currently no functionality provided to install the ert python
|
|
code in a way which ensures that it automagically works; however the
|
|
required manual process is quite simple. Essentially you need to
|
|
install the python package ert/ in a location where the python
|
|
interpreter can find it, and the shared libraries must be installed so
|
|
that the runtime linker can find them.
|
|
|
|
Installing the python modules
|
|
-----------------------------
|
|
The package directory ert/ and all it's subdirectories must be
|
|
installed somewhere where your python interpreter will find it. That
|
|
is either in one of the default locations[1], or you can put it
|
|
in an arbitrary location and subsequently update your PYTHONPATH
|
|
environment variable to contain the directory where you put the ert/
|
|
directory.
|
|
|
|
[1]: To find out what your default locations are you can run the
|
|
following code in an interactive python shell:
|
|
|
|
>>> import sys
|
|
>>> print sys.path
|
|
|
|
All the python modules should be installed as world readable; for a
|
|
minor performance gain it is possible to bytecompile during the
|
|
install with a small python script based on the compile function in
|
|
the py_compile module.
|
|
|
|
Installing the shared libraries
|
|
-------------------------------
|
|
The ctypes module is based on the dlopen() system call to open the shared
|
|
libecl.so. The final dlopen() call is not passed any path information, i.e. the
|
|
runtime linker must be able to locate the shared libraries based solely on the
|
|
normal runtime linking conventions. This means that you have two alternatives
|
|
when installing the shared libraries:
|
|
|
|
1. Install all the libraries in one of the standard library locations
|
|
like /usr/local/lib.
|
|
|
|
2. Install the libraries in an arbitrary directory, and then
|
|
subsequently update the LD_LIBRARY_PATH variable to point to this
|
|
directory.
|
|
|
|
The shared libraries you will need is 'libecl.so'
|
|
|
|
The test environment
|
|
--------------------
|
|
In the test/ directory there are two small shell scripts local_bash
|
|
and local_csh which will modify the current shell (i.e. local_xxx
|
|
should be sourced) so that the tests in the test/ directory can
|
|
be run on the source distribution. These two shell scripts illustrate
|
|
the necessary modifications to PYTHONPATH and LD_LIBRARY_PATH when
|
|
installing in non-standard locations.
|
|
|
|
Problems
|
|
--------
|
|
Apart from normal bugs there are two possible problems when installing
|
|
ert-python:
|
|
|
|
1. The python interpreter can not find the ert package. In this case
|
|
the error will be something like this:
|
|
|
|
>>> import ert
|
|
Traceback (most recent call last):
|
|
File "<stdin>", line 1, in <module>
|
|
ImportError: No module named ert
|
|
|
|
The ert/ directory is not located in the right place, or the
|
|
PYTHONPATH variable has not been updated correctly.
|
|
|
|
2. The runtime linker can not find one of the shared libraries:
|
|
|
|
import ert.ecl.ecl_grid
|
|
Traceback (most recent call last):
|
|
File "<stdin>", line 1, in <module>
|
|
File "ert/ecl/ecl_grid.py", line 30, in <module>
|
|
from ert.util.tvector import DoubleVector # Requires merging of typemaps ....
|
|
File "ert/util/tvector.py", line 46, in <module>
|
|
import libutil
|
|
File "ert/util/libutil.py", line 31, in <module>
|
|
clib.load("libg2c.so.0")
|
|
File "ert/cwrap/clib.py", line 49, in load
|
|
raise ImportError( error_msg )
|
|
ImportError: Sorry - failed to load shared library:libg2c.so.0
|
|
|
|
Tried in:
|
|
You might need to update your LD_LIBRARY_PATH variable
|