Build on Windows

This page is for Microsoft Windows users who want to contribute to the development of
MusicBrainz Picard
or for other reasons want to be able to run Picard from source code.
It explains how to install the 3rd party software needed to run from source
and also to build the Picard for Windows installer executable.

Requirements

Picard development (i.e. Github's master branch) is now focused on Picard version 2,
which uses Python 3 and PyQt5.
However if you need to test something in Picard version 1,
then a separate branch 1.4.x is available to run and this uses Python 2 and PqQt4.
Instructions for building each environment are provided below.

Python for Picard version 1

Python 2.7.x

Python should add itself to your %PATH% environment variable,
but if not add both the Python install directory and its scripts subdirectory to %PATH%

Python 2 packages

You need need the following additional python packages to run Picard version 1 from source:

PyQt 4.10 or later

libdiscid

discid

Mutagen 1.22 or later

You need to install PyQt4 and libdiscid manually.

PyQt4 - Riverbank Computing (authors of PyQt) no longer maintains an installation executable for the latest versions of PyQt.
The most recent Windows installer, for PyQt v4.11.4, is suitable for Picard v1 and can be downloaded and run from SourceForge
https://sourceforge.net/projects/pyqt/files/PyQt4/PyQt-4.11.4/.

The easiest way to install Mutagen and discid is using PIP.
PIP is included as standard in Python 2.7.9 or later - so this is a good reason to upgrade if you
already have an earlier version of Python 2.7 installed.
Alternatively you can install PIP separately on earlier versions or install the above packages manually.

Assuming that you want to use PIP, open an Administrator command prompt, navigate to the Picard source directory and type:

pip2 install Mutagen>=1.22
pip2 install discid

Note: If you get an error message "'pip2' is not recognized as an internal or external command, operable program or batch file." try fixing this with:

python -m ensurepip --default-pip

Running Picard From Source

Chromaprint

If you want to run the Acoustid Scan function when running Picard from source, then you need to install
the Chromaprint fpcalc program into your Picard source directory.

NSIS 2.46

Visual C++

Picard will run from source using a python version of the Levenshtein Distance fuzzy string comparison,
however to build the C version for inclusion in the executable package you will need to download and install the
Microsoft C++ compiler suitable for the version of Picard / Python you are building for:

Visual C++

Before you can build the Python executable and installer, you need to build the astrcmp C extension and
language internationalisation.
Start the VS console using "Visual Studio 2008 Command Prompt" or "Visual C++ 2015 MSBuild Command Prompt",
go to the Picard source directory and run these commands:

python setup.py build_ext -i
python setup.py build_locales -i

Then you need to copy the following files from Visual Studio to
to the source code directory, so that py2exe can find them:

The setup is installer\picard-setup-x.x.exe and an executable for your system is dist\picard.exe, which
you can use to create a desktop shortcut.

Known Issues

It is possible that the resulting picard.exe does not show the proper file icon.
This is probably a bug of py2exe on Vista.
You can fix the icon with the tool
Resource Hacker or any other tool, that
can edit the resources in executables.

Support

If these instructions do not work, please research and try to solve the problem yourself -
and report the issue and answer in the
Metabrainz Ticketing system under PICARD-WEBSITE
and by submitting a PR against the
Picard-Website Github Repository.
If you are unable to resolve the issue after research and need further help,
please use IRC freenode/#metabrainz to request help from the development community.