Difference between revisions of "Install latest BSDDB"

From Gramps
Jump to: navigation, search
m (format)
m (Gramps)
(10 intermediate revisions by 4 users not shown)
Line 1: Line 1:
Some people have encountered bugs in GRAMPS which are due to the database not working well.  
+
Some people have encountered bugs in Gramps which are due to the database not working well.  
  
 
Installing the latest version of the BSDDB database tends to solve the problem.
 
Installing the latest version of the BSDDB database tends to solve the problem.
 +
 +
'''This guide is for version {{version}} of Gramps, for earlier versions, you need to manually change python files!'''
  
 
== Why install latest version ? ==
 
== Why install latest version ? ==
Some errors have happened in the past outside of GRAMPS, with the BSDDB database format GRAMPS uses. See eg: [http://www.gramps-project.org/bugs/view.php?id=110 Bug # 110], [http://www.gramps-project.org/bugs/view.php?id=814 Bug # 814]
+
Some errors have happened in the past outside of Gramps, with the BSDDB database format Gramps uses. See Bugs: {{bug|110}} and {{bug|814}}
  
 
It can be expected that recompiling BSDDB could solve the problem. However, if BSDDB needs to be recompiled, one can as well install the latest version.
 
It can be expected that recompiling BSDDB could solve the problem. However, if BSDDB needs to be recompiled, one can as well install the latest version.
Line 10: Line 12:
 
Furthermore, the people of pybsddb recommend doing a local compile if the use of BSDDB is critical.  
 
Furthermore, the people of pybsddb recommend doing a local compile if the use of BSDDB is critical.  
  
For genealogists needing GRAMPS this could be considered true.
+
For genealogists needing Gramps this could be considered true.
  
 
== Before you begin: BACKUP ==
 
== Before you begin: BACKUP ==
Take a backup of your genealogical data before you do this. Remember, you should backup data of GRAMPS in .gramps format, and keep that somewhere save (GRDB format is NOT a good backup format!).
+
Take a backup of your genealogical data before you do this. Remember, you should backup data of Gramps in .gramps format, and keep that somewhere save (GRDB format is NOT a good backup format!).
  
 
== Obtaining latest BSDDB version ==
 
== Obtaining latest BSDDB version ==
 
=== BSDDB core from Sleepycat (Oracle) ===
 
=== BSDDB core from Sleepycat (Oracle) ===
 
Go to http://www.oracle.com/technology/software/products/berkeley-db/db/index.html  
 
Go to http://www.oracle.com/technology/software/products/berkeley-db/db/index.html  
and download latest libdb code, unpack. Read in the downloaded code the file docs/index.html on how to configure and make the code. For Linux:
+
and download latest libdb code without encryption (eg Berkeley DB 5.1.19.NC.tar.gz ), unpack. You need to create an Oracle ID for this, but it is OSS software. Read in the downloaded code the file docs/index.html on how to configure and make the code. For Linux:
  
  cd /build_unix
+
  cd build_unix
 
  ../dist/configure
 
  ../dist/configure
 
  make
 
  make
Line 26: Line 28:
  
 
=== Python BSDDB interface ===
 
=== Python BSDDB interface ===
Next, go to http://pybsddb.sourceforge.net  
+
Next, go to [http://www.jcea.es/programacion/pybsddb.htm pybsddb] ([http://pybsddb.sourceforge.net ]).
Download <code>bsddb3-4.5.0.tar.gz</code> (version at the time of writing), unpack and go in the created directory. Run <code>python setup.py</code>, this should find your installed bsddb3 returning something like:
+
Download the version compatible with the downloaded bsddb version, eg [http://pypi.python.org/pypi/bsddb3/5.1.1 bsddb3 5.1.1] is tested with 4.2 and 5.1. Unpack and go in the created directory. Run <code>python setup.py</code>, this should find your installed bsddb3 returning something like:
  
  Found BerkeleyDB 4.5 installation.
+
  Found Berkeley DB 5.1 installation.
  include files in /usr/local/BerkeleyDB.4.5/include
+
  include files in /usr/local/BerkeleyDB.5.1/include
  library files in /usr/local/BerkeleyDB.4.5/lib
+
  library files in /usr/local/BerkeleyDB.5.1/lib
  library name is libdb-4.5
+
  library name is libdb-5.1
  
 
Now run <code>python setup.py build</code> to make the package, and lastly install it with <pre>sudo python setup.py install</pre> which installs bsddb3.
 
Now run <code>python setup.py build</code> to make the package, and lastly install it with <pre>sudo python setup.py install</pre> which installs bsddb3.
Note: you need libpython2.5-devel to build.
+
Note: you need libpython2.x-devel to build this, with x your version of python.
You can test with python test.py, but that does not work on my AMD64
+
 
 +
As a test, run
 +
 
 +
python
 +
>>> import bsddb3
 +
>>> bsddb3.__version__
 +
'5.1.1'
 +
>>> bsddb3.db.version()
 +
(5, 1, 19)
 +
 
 +
=== Make Gramps use bsddb3===
 +
In version {{stable_branch}}, you can make Gramps use the bsddb3 package by setting a config key.  
 +
For this, open the ini file:
 +
 
 +
~/.gramps/gramps{{stable_branch}}/gramps.ini
 +
 
 +
and look for the line
 +
 
 +
;;use-bsddb3=False
  
=== Remove old BSDDB and replace with new in GRAMPS===
+
Change this line into
* Go into the GRAMPS directory
 
* Open the following files:
 
/gramps-2.2.8/src/DbLoader.py
 
/gramps-2.2.8/src/Editors/_EditFamily.py
 
/gramps-2.2.8/src/GrampsDb/_GrampsBSDDB.py
 
/gramps-2.2.8/src/GrampsDb/_GrampsDbBase.py
 
/gramps-2.2.8/src/GrampsDb/_GrampsDBCallback.py
 
/gramps-2.2.8/src/GrampsDb/_ReadGedcom.py
 
/gramps-2.2.8/src/GrampsLogger/_ErrorReportAssistant.py
 
/gramps-2.2.8/src/plugins/Leak.py
 
  
* In these files, look up the line
+
  use-bsddb3=True
  import bsddb
 
:Change this line into
 
import bsddb3
 
  
'''The above requires further testing!!!'''
+
If you now start Gramps, bsddb3 will be used.
  
== Test ==
 
You should now have GRAMPS use the latest BSDDB version. Test if all works
 
  
 
== External Link ==
 
== External Link ==
Line 65: Line 70:
 
*[http://docs.python.org/library/bsddb.html bsddb — Interface to Berkeley DB library — Python v2.6.1 documentation]
 
*[http://docs.python.org/library/bsddb.html bsddb — Interface to Berkeley DB library — Python v2.6.1 documentation]
 
*[http://pybsddb.sourceforge.net/ref/intro/data.html Berkeley DB Reference Guide: An introduction to data management]
 
*[http://pybsddb.sourceforge.net/ref/intro/data.html Berkeley DB Reference Guide: An introduction to data management]
*[[Database Formats]] - GRAMPS
+
*[[Database Formats]] - Gramps
  
 
[[Category:Developers/General]]
 
[[Category:Developers/General]]

Revision as of 21:56, 24 January 2013

Some people have encountered bugs in Gramps which are due to the database not working well.

Installing the latest version of the BSDDB database tends to solve the problem.

This guide is for version 5.2.1 of Gramps, for earlier versions, you need to manually change python files!

Why install latest version ?

Some errors have happened in the past outside of Gramps, with the BSDDB database format Gramps uses. See Bugs: 110 and 814

It can be expected that recompiling BSDDB could solve the problem. However, if BSDDB needs to be recompiled, one can as well install the latest version.

Furthermore, the people of pybsddb recommend doing a local compile if the use of BSDDB is critical.

For genealogists needing Gramps this could be considered true.

Before you begin: BACKUP

Take a backup of your genealogical data before you do this. Remember, you should backup data of Gramps in .gramps format, and keep that somewhere save (GRDB format is NOT a good backup format!).

Obtaining latest BSDDB version

BSDDB core from Sleepycat (Oracle)

Go to http://www.oracle.com/technology/software/products/berkeley-db/db/index.html and download latest libdb code without encryption (eg Berkeley DB 5.1.19.NC.tar.gz ), unpack. You need to create an Oracle ID for this, but it is OSS software. Read in the downloaded code the file docs/index.html on how to configure and make the code. For Linux:

cd build_unix
../dist/configure
make
sudo make install

Python BSDDB interface

Next, go to pybsddb ([1]). Download the version compatible with the downloaded bsddb version, eg bsddb3 5.1.1 is tested with 4.2 and 5.1. Unpack and go in the created directory. Run python setup.py, this should find your installed bsddb3 returning something like:

Found Berkeley DB 5.1 installation.
 include files in /usr/local/BerkeleyDB.5.1/include
 library files in /usr/local/BerkeleyDB.5.1/lib
 library name is libdb-5.1

Now run python setup.py build to make the package, and lastly install it with

sudo python setup.py install

which installs bsddb3.

Note: you need libpython2.x-devel to build this, with x your version of python.

As a test, run

python
>>> import bsddb3
>>> bsddb3.__version__
'5.1.1'
>>> bsddb3.db.version()
(5, 1, 19)

Make Gramps use bsddb3

In version 52, you can make Gramps use the bsddb3 package by setting a config key. For this, open the ini file:

~/.gramps/gramps52/gramps.ini

and look for the line

;;use-bsddb3=False

Change this line into

use-bsddb3=True

If you now start Gramps, bsddb3 will be used.


External Link

Information on BSDDB (Python "bindings" for Oracle Berkeley DB)