<p>your <code>bsddb</code> module was either not installed or not properly linked during the Python build.</p>
<p>to fix that we install DB Berkeley properly</p>
<pre><code>sudo apt update
sudo apt install libdb-dev libdb5.3-dev
</code></pre>
<p>then we rebuild</p>
<pre><code>cd Python-2.7.18/
sudo make clean
</code></pre>
<p>we reconfigure</p>
<pre><code>sudo ./configure --enable-optimizations --with-dbmliborder=gdbm:ndbm:bdb
</code></pre>
<p>then finaly we install and build and it should be linked properly</p>
<pre><code>sudo make altinstall
</code></pre>
<p>now it should work</p>
<pre><code>sudo ./configure --enable-optimizations --with-dbmliborder=bdb --with-bdb=/usr/local
sudo make altinstall
</code></pre>

CC BY-SA 4.0
2024-12-14T02:19:36.747Z
2024-12-14T02:19:36.747Z
Saxtheowl
<p>On a Ubuntu 24.04.1 LTS VM I installed Python 2.7.18 via:</p>
<pre><code>wget https://www.python.org/ftp/python/2.7.18/Python-2.7.18.tgz
tar xzf Python-2.7.18.tgz 
cd Python-2.7.18/
sudo ./configure --enable-optimizations
sudo make altinstall
python --version
Python 2.7.18
</code></pre>
<p>pywallet downloaded via:</p>
<pre><code>git clone https://github.com/jackjack-jj/pywallet.git
</code></pre>
<p>Running:</p>
<pre><code>python /home/john/pywallet/pywallet.py --dumpwallet --dumpwithbalance --wallet=/home/john/bitcoin/.bitcoin/wallet.dat
pywallet needs 'bsddb' package to run, please install it
</code></pre>
<p>Verifying Python is correct version:</p>
<pre><code>python --version
Python 2.7.18
</code></pre>
<p>Using Python's -v (verbose) option I see:</p>
<pre><code>import bsddb # directory /usr/local/lib/python2.7/bsddb
# /usr/local/lib/python2.7/bsddb/__init__.pyc matches /usr/local/lib/python2.7/bsddb/__init__.py
import bsddb # precompiled from /usr/local/lib/python2.7/bsddb/__init__.pyc
</code></pre>
<p>The above paths contain bsddb.</p>
<p>bsddb was installed via:</p>
<pre><code>wget https://files.pythonhosted.org/packages/f0/24/92034482656945fc6ceb10551222b43a0ff8d0c87e15839120487820067e/bsddb3-6.2.9.tar.gz
cd bsddb3-6.2.9
sudo pip install -e /home/john/bsddb3/bsddb3-6.2.9 --log /home/john/LOG_FILE 
</code></pre>
<p>The above LOG_FILE shows:</p>
<pre><code>Successfully installed bsddb3
</code></pre>
<p>I needed to use the <code>pip install -e</code> because pip was producing errors on the SSL/TLS front.</p>
<p>When I test (import bsddb):</p>
<pre><code>python
Python 2.7.18 (default, Dec  7 2024, 14:38:44) 
[GCC 13.2.0] on linux2
Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.
&gt;&gt;&gt; import bsddb
Traceback (most recent call last):
  File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;
  File &quot;/usr/local/lib/python2.7/bsddb/__init__.py&quot;, line 67, in &lt;module&gt;
    import _bsddb
ImportError: No module named _bsddb
&gt;&gt;&gt; 
</code></pre>
<p>Looks like bsddb isn't installed correctly, any ideas?</p>

<wallet><python>
pywallet needs 'bsddb' package to run, please install it
John Mac
# pywallet needs 'bsddb' package to run, please install it

(Asked by: username_0 on 2024-12-07)

On a Ubuntu 24.04.1 LTS VM I installed Python 2.7.18 via:
wget https://www.python.org/ftp/python/2.7.18/Python-2.7.18.tgz
tar xzf Python-2.7.18.tgz 
cd Python-2.7.18/
sudo ./configure --enable-optimizations
sudo make altinstall
python --version
Python 2.7.18

pywallet downloaded via:
git clone https://github.com/jackjack-jj/pywallet.git

Running:
python /home/john/pywallet/pywallet.py --dumpwallet --dumpwithbalance --wallet=/home/john/bitcoin/.bitcoin/wallet.dat
pywallet needs 'bsddb' package to run, please install it

Verifying Python is correct version:
python --version
Python 2.7.18

Using Python's -v (verbose) option I see:
import bsddb # directory /usr/local/lib/python2.7/bsddb
# /usr/local/lib/python2.7/bsddb/__init__.pyc matches /usr/local/lib/python2.7/bsddb/__init__.py
import bsddb # precompiled from /usr/local/lib/python2.7/bsddb/__init__.pyc

The above paths contain bsddb.
bsddb was installed via:
wget https://files.pythonhosted.org/packages/f0/24/92034482656945fc6ceb10551222b43a0ff8d0c87e15839120487820067e/bsddb3-6.2.9.tar.gz
cd bsddb3-6.2.9
sudo pip install -e /home/john/bsddb3/bsddb3-6.2.9 --log /home/john/LOG_FILE 

The above LOG_FILE shows:
Successfully installed bsddb3

I needed to use the pip install -e because pip was producing errors on the SSL/TLS front.
When I test (import bsddb):
python
Python 2.7.18 (default, Dec  7 2024, 14:38:44) 
[GCC 13.2.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import bsddb
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/local/lib/python2.7/bsddb/__init__.py", line 67, in 
    import _bsddb
ImportError: No module named _bsddb
>>> 

Looks like bsddb isn't installed correctly, any ideas?

**Tags:** wallet, python


---

## 1 answers

### Answer by username_1 on 2024-12-14. Score: 1

your bsddb module was either not installed or not properly linked during the Python build.
to fix that we install DB Berkeley properly
sudo apt update
sudo apt install libdb-dev libdb5.3-dev

then we rebuild
cd Python-2.7.18/
sudo make clean

we reconfigure
sudo ./configure --enable-optimizations --with-dbmliborder=gdbm:ndbm:bdb

then finaly we install and build and it should be linked properly
sudo make altinstall

now it should work
sudo ./configure --enable-optimizations --with-dbmliborder=bdb --with-bdb=/usr/local
sudo make altinstall


---

