Pyrekordbox is available on PyPI:
$ pip install pyrekordbox
Alternatively, it can be installed via GitHub:
$ pip install git+https://github.com/dylanljones/pyrekordbox.git@VERSION
where VERSION
is a branch, tag or release. The project can also be cloned/forked
and installed via
$ python setup.py install
Unlocking the new Rekordbox 6 master.db
database file requires SQLCipher.
The easiest method to install SQLCipher on Windows is to build sqlcipher3 against an amalgamation of the SQLite3 source code.
-
Install Visual Studio Community Edition
Make sure to select all the GCC options (VC++, C++, etc) in the installation process. The following workloads under
Desktop & Mobile
should be sufficient:- Desktop Development with C++
- .NET desktop development
-
Install a prebuilt OpenSSL binary
Choose the latest Win32/Win64 version. Make sure to download the full version, not the light version.
-
Confirm that the
OPENSSL_CONF
environment variable is set properly in environment variablesThis should not be root openssl path (ex:
C:/Program Files/openssl-Win64
), but instead should be the path to the config file, for example:- 32-bit:
C:/Program Files (x86)/openssl-Win32/bin/openssl.cfg
- 64-bit:
C:/Program Files/openssl-Win64/bin/openssl.cfg
The library names of OpenSSL have changed in version 1.1.0 (see this discussion). If you are using a newer version, you can set an environment variable
OPENSSL_LIBNAME
to the name of the library, e.g.libcrypto.lib
. Alternatively, you can modify thesetup.py
script (see step 8 below).You might have to restart Windows for the changes to take effect.
- 32-bit:
-
Copy the openssl folder to the Microsoft Visual Studio 14 VC include directory
The openssl folder can be found here:
- 32-bit:
C:/Program Files (x86)/OpenSSL-Win32/include/openssl
- 64-bit:
C:/Program Files/OpenSSL-Win64/include/openssl
The VC include directory (for any VS version) can be found in the Visual Studio installation directory:
C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include
Confirm the following path exists
.../include/openssl/aes.h
- 32-bit:
-
Download / compile the SQLCipher 3 amalgamation files
Pre-built SQLCipher 3 amalgamation files can be downloaded from this repo. To compile the amalgamation files, follow this tutorial.
-
Clone sqlcipher3 into any directory
git clone https://github.com/coleifer/sqlcipher3
-
Copy amalgamation files to the
sqlcipher3
directoryCopy files
sqlite3.c
andsqlite3.h
from the amalgamation directory from step 5 to the root of thesqlcipher3
directory from step 6. -
Modify the
sqlcipher3/setup.py
script (optional)If building the amalgamation fails and you haven't set the
OPENSSL_LIBNAME
environment variable in step 3, you have to modify thesetup.py
script. Changeopenssl_libname = os.environ.get('OPENSSL_LIBNAME') or 'libeay32.lib'
to
openssl_libname = os.environ.get('OPENSSL_LIBNAME') or 'libcrypto.lib'
-
Build using the amalgamation
cd
into thesqlcipher3
directory and runpython setup.py build_static build
-
Install
sqlcipher3
python setup.py install
You now should have a working sqlcipher3
installation! The directory of the
cloned sqlcipher3
repo can be deleted after installing the package.
Steps 5-10 can be automated using the CLI of pyrekordbox
:
> python3 -m pyrekordbox install-sqlcipher --help
usage: pyrekordbox install-sqlcipher [-h] [-t TMPDIR] [-l CRYPTOLIB] [-q] [-b]
-h, --help show this help message and exit
-t TMPDIR, --tmpdir TMPDIR
Path for storing temporary data (default: '.tmp')
-l CRYPTOLIB, --cryptolib CRYPTOLIB
The name of the OpenSSl crypto libary (default: 'libcrypto.lib')
-b, --buildonly Don't install sqlcipher3, only build the amalgamation
-
Microsoft Visual C++ error
If you are getting an error like
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools"``
and have Visual Studio installed, you might not have all the necessary C/C++ components.
-
LINK error
If you are getting an error like
LINK : fatal error LNK1158: cannot run 'rc.exe'
or
LINK : fatal error LNK1327: failure during running rc.exe
make sure all the necessary C/C++ components are installed and that you have selected the latest Win 10/11 SDK in the Visual Studio installer. If you are still getting the error, follow the suggestions in this StackOverflow post.
For MacOS follow these steps:
- Install Homebrew if you do not have it on your machine.
- Install SQLCipher with
brew install SQLCipher
. - With the python environment you are using to run pyrekordbox active execute the following:
git clone https://github.com/coleifer/sqlcipher3
cd sqlcipher3
SQLCIPHER_PATH=$(brew info sqlcipher | awk 'NR==4 {print $1; exit}'); C_INCLUDE_PATH="$SQLCIPHER_PATH"/include LIBRARY_PATH="$SQLCIPHER_PATH"/lib python setup.py build
SQLCIPHER_PATH=$(brew info sqlcipher | awk 'NR==4 {print $1; exit}'); C_INCLUDE_PATH="$SQLCIPHER_PATH"/include LIBRARY_PATH="$SQLCIPHER_PATH"/lib python setup.py install
Make sure the C_INCLUDE
and LIBRARY_PATH
point to the installed SQLCipher path. It may differ on your machine.
If you are having issues building sqlcipher on M1 Macs you might have to add some symlinks:
ln -s /opt/homebrew/lib/libsqlcipher.a /usr/local/lib/libsqlcipher.a
ln -s /opt/homebrew/include/sqlcipher /usr/local/include/sqlcipher
Alternatively, you can also build sqlcipher3 against an amalgamation (as described above for Windows, steps 5-10).
After the installation SQLCipher-databases can be unlocked via the sqlcipher3
package:
from sqlcipher3 import dbapi2 as sqlite3
conn = sqlite3.connect('test.db')
c = conn.cursor()
c.execute("PRAGMA key='password'")