[[howto:desktop:install-zim-0-70-or-later-in-windows]]

Posted 17 July 2019 by Brendan Kidwell

This is an old revision of the document!


Install Zim Desktop Wiki 0.70 or Later in Windows

16 July 2019
Brendan Kidwell

As of the time I'm writing this howto, there is no complete self-installing package of Zim Desktop Wiki 0.70 or later, for Windows. This is due to the Zim project migrating from Python 2 to Python 3 and from GTK 2 to GTK 3. I was the maintainer of the old Zim packages for Windows, and I have not been able to come up with a packaging workflow that works for GTK 3.

As an alternative, I provide instructions here for installing Zim 0.70 or later under Windows using the MSYS2 free software catalog and package manager.

This procedure should work in Windows 7 or any later version of Windows.

Caution: You will need approximately 1GB of disk space to store the MSYS2 environment and all of Zim's dependencies, and a further 8MB for Zim itself. (This figure is for 64-bit Windows systems. 32-bit installations may use a little less for MSYS2 and Zim's dependencies.)

Go to http://www.msys2.org and download the installer appropriate for your system:
64-bit Windows: msys2-x86_64-*.exe
32-bit Windows: msys2-i686-*.exe

Run the installer. In the Installation Folder step, be sure to set the correct drive letter you want to use, if you have more than one hard drive or partition.

Complete the rest of the installation wizard's steps.

Later on, we will need Windows to automatically be able to find executables installed by MSYS2. You need to edit your PATH environment variable.

In the Windows Run command, execute “SystemPropertiesAdvanced.exe” .

Go to Advanced → Environment Variables.

If you are working on your own personal system, choose System variables → Path so that this change applies to all users. If you are working on a shared Windows installation and don't want to affect other users, choose User variables → Path.

Add the following paths to the front/top of the variable. (If you are using an older version of Windows, you may be using a tiny text box instead of a fancy list editor. If you have to edit it as a text string, be sure to separate entries in the list with “;”. You'll probably want to copy and paste into Notepad to edit the string.)

  • C:\msys64\usr\bin
  • C:\msys64\mingw32\bin
  • C:\msys64\mingw64\bin

You will have to modify these added paths to point to your actual MSYS2 installation location if it's not C:\msys64.

I followed GTK 3's Getting Started Page to determine what to install here.

Find MSYS2 MSYS in your Start Menu and open it.

Run the following command to update existing packages:

pacman -Suy

This will take several minutes to run.

You may get a warning saying “terminate MSYS2 without returning to shell and check for updates again.” If you get this warning, click the red X button on the window, then re-open MSYS2 MSYS, and re-enter the command:

pacman -Suy

When that finishes, install Python 3 and GTK 3.

Run the following command to install 64-bit versions of Python 3 and GTK 3:

pacman -S mingw-w64-x86_64-gtk3 mingw-w64-x86_64-python3 mingw-w64-x86_64-python3-gobject

If you are using 32-bit Windows, you should run this command instead:

pacman -S mingw-w32-i686-gtk3 mingw-w32-i686-python3 mingw-w32-i686-python3-gobject

It will take another few minutes for those packages and all their depenencies to install.

Go to https://zim-wiki.org/ , navigate to Downloads, and click Download here.

Find the highest numbered file “zim_*.tar.gz” (it will be near the middle of the list) and download it.

Open the .tar.gz file and navigate into dist → zim-*.tar → zim-*. Some archivers may open the embedded Tar file in a separate window. Keep going until you find the folder with CHANGELOG and LICENSE files, et cetera.

Extract the source files to where you want to install Zim. In my screenshot, I put it in “E:\Work\Apps\ZimDesktopWiki”. I keep all manually installed software in an Apps folder somewhere.

You will need to create two launcher files. One will be a Windows Shortcut file which you can copy into your Start Menu, and the other will be a .cmd script for the Open With command, since a Shortcut will not work correctly for “Open […] with …” a Python program.

Using Windows Exporer, create a new Shortcut in your Apps folder. Have it execute the following command (in the location of the item field):

python3w "E:\Work\Apps\ZimDesktopWiki\zim.py"

Don't forget to fill in the correct path where you extracted Zim in the previous step. Also, did you edit your PATH environment variable? (See earlier in this howto document.)

Next, right-click on the shortcut you created, click Properties, and then Change Icon….

Navigate to and select zim.ico in the Zim source package's icons folder, and click OK. Now the Shortcut should have the correct icon.

Using your favorite text editor, create a new text file in your Apps folder called launch-zim.cmd. Write this script into the file and save it:

launch-zim.cmd
@echo off
 
set PYTHON_EXE="python3w.exe"
:: Don't forget to fix the following path according to where YOU installed Zim:
set ZIM_PY="E:\Work\Apps\ZimDesktopWiki\zim.py"
 
start "" %PYTHON_EXE% %ZIM_PY% %*

Next, navigate to a folder containing a Zim notebook, or if you don't have one, create a new folder with an EMPTY text file called notebook.zim in it.

Right-click on notebook.zim and select Open With, then Choose another App.

Make sure Always use this app to open .zim files is selected, then click More apps and scroll down to Look for another app on this PC.

Navigate to the launch-zim.cmd script you created earlier, and select it.

If Zim opened, close it now. Double-click on the notebook.zim file to be sure that you setup Open With correctly. It should open the chosen Notebook in Zim.

When you try to enable Plugins in Preferences in Zim, you may find a red message saying that a dependency was not found. This is normal; Zim doesn't ship with all the binaries needed for all of its plugins.

To resolve this, you might first try searching in the MSYS2 software catalog, since you already have MSYS2 installed. For the GraphViz example, we would try this:

Open MSYS2 MSYS from the Start Menu. Enter the following command:

pacman -Ss graphviz

Note that we searched for the name of the dependency in all lowercase letters.

Pacman reports that two candidate packages are found. (On 32-bit Windows it will probably only find one.) If Pacman did not find any package matches, you can try again with different search terms. If you still do not find anything, you will need to find a Windows build of the tool you need somewhere else, and install it — this is beyond the scope of this howto document.

If pacman found results, choose the one most relevant for your system. If you are on a 64-bit system, choose the one with “x86_64” in the name if available. Use the following command to install it:

pacman -S mingw-w64-x86_64-graphviz

Fill in the exact name of the package you saw in the search results. Include everything between the “/” and the version number.

After Pacman is done installing the package, you can close Preferences in Zim and re-open Preferences. Navigate to the plugin you were trying to use, and it should now say that the Dependencies are satisfied.

Now you are ready to use the plugin.

To comment on this page, please copy and paste the following into an email and send it to me. Useful and informative comments will be published within a day or two.

To: brendan@glump.net
Subject: Glump.net comment - Install Zim Desktop Wiki 0.70 or Later in Windows

Regarding: https://www.glump.net/howto/desktop/install-zim-0-70-or-later-in-windows
My name: [your name here]
My social media or web site: [optional URL here]
Publish this comment: yes

[your comment here]