Show pageOld revisionsBacklinksBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ~~META: creator = Brendan Kidwell &date created = 2019-07-17 &date updated = 2019-07-17 ~~ {{tag>zim windows}} ~~DISCUSSION~~ ====== Install Zim Desktop Wiki 0.70 or Later in Windows ====== 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.) ===== 0. Upgrading From a Previous Version ===== **Are you upgrading from a version before 0.69?** You should uninstall Zim completely using the appropriate item in your Add / Remove Programs screen or by deleting application folder -- depending on how you installed it originally. **Are you upgrading from version 0.70 or later?** If you have already installed 0.70 or later using the procedure in **this howto document**, you just need to repeat step 4 below; you can skip the other steps. ===== 1. Install MSYS2 ===== 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 {{::msys2-installer.png?direct&600|}} 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. {{::msys2-installation-folder.png?direct&400}} Complete the rest of the installation wizard's steps. ===== 2. Edit PATH Environment Variable ===== Later on, we will need Windows to automatically be able to find executables installed by MSYS2. You need to edit your <wrap sym>PATH</wrap> environment variable. In the Windows Run command, execute "''SystemPropertiesAdvanced.exe''" . {{::run-system-prop.png?direct&300}} Go to <wrap nav>Advanced -> Environment Variables</wrap>. {{::env-var.png?direct&400}} If you are working on your own personal system, choose <wrap nav>System variables -> Path</wrap> 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 <wrap nav>User variables -> Path</wrap>. 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 <wrap file>C:\msys64</wrap>. {{::edit-env-var.png?direct&400}} ===== 3. Install Zim Prerequisites ===== I followed [[https://pygobject.readthedocs.io/en/latest/getting_started.html|GTK 3's Getting Started Page]] to determine what to install here. Find <wrap nav>MSYS2 MSYS</wrap> in your Start Menu and open it. Run the following command to update existing packages: <code bash> pacman -Suy </code> This will take several minutes to run. {{::pacman-update.png?direct&600|}} 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: <code bash> pacman -Suy </code> {{::pacman-update-warning.png?direct&600|}} When that finishes, install Python 3 and GTK 3. Run the following command to install 64-bit versions of Python 3 and GTK 3: <code bash> pacman -S mingw-w64-x86_64-gtk3 mingw-w64-x86_64-python3 mingw-w64-x86_64-python3-gobject </code> If you are using 32-bit Windows, you should run this command instead: <code bash> pacman -S mingw-w32-i686-gtk3 mingw-w32-i686-python3 mingw-w32-i686-python3-gobject </code> {{::pacman-install-py.png?direct&600|}} It will take another few minutes for those packages and all their depenencies to install. ===== 4. Installing Zim from Source ===== Go to [[https://zim-wiki.org/|https://zim-wiki.org/]] , navigate to Downloads, and click <wrap nav>Download here</wrap>. {{::download-here.png?direct&600|}} Find the highest numbered file "''zim_*.tar.gz''" (it will be near the middle of the list) and download it. {{::tar-gz.png?direct&600|}} Open the .tar.gz file and navigate into <wrap nav>dist -> zim-*.tar -> zim-*</wrap>. 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-from.png?direct&600|}} 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 <wrap file>Apps</wrap> folder somewhere. {{::extract-to.png?direct&600|}} ===== 5. Creating Launcher Files ===== 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. ==== Windows Shortcut ==== Using Windows Exporer, create a new Shortcut in your Apps folder. Have it execute the following command (in the <wrap nav>location of the item</wrap> field): <code text> python3w "E:\Work\Apps\ZimDesktopWiki\zim.py" </code> Don't forget to fill in the correct path where you extracted Zim in the previous step. Also, did you edit your <wrap sym>PATH</wrap> environment variable? (See earlier in this howto document.) {{::new-shortcut.png?direct&600|}} {{::new-shortcut-target.png?direct&600|}} Next, right-click on the shortcut you created, click Properties, and then <wrap nav>Change Icon...</wrap>. {{::edit-shortcut-prop.png?direct&600|}} {{::change-icon.png?direct&600|}} Navigate to and select <wrap file>zim.ico</wrap> in the Zim source package's <wrap file>icons</wrap> folder, and click OK. Now the Shortcut should have the correct icon. {{::change-icon-done.png?direct&600|}} For convenience, you can now copy this <wrap file>Zim Desktop Wiki.lnk</wrap> file into your Start Menu so you can launch it from there. ==== CMD Script ==== Using your favorite text editor, create a new text file in your Apps folder called <wrap file>launch-zim.cmd</wrap>. Write this script into the file and save it: <file text 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% %* </file> 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 <wrap file>notebook.zim</wrap> in it. Right-click on <wrap file>notebook.zim</wrap> and select <wrap nav>Open With</wrap>, then <wrap nav>Choose another App</wrap>. {{::open-with-choose.png?direct&600|}} Make sure <wrap nav>Always use this app to open .zim files</wrap> is selected, then click <wrap nav>More apps</wrap> and scroll down to <wrap nav>Look for another app on this PC</wrap>. {{::open-with-always.png?direct&600|}} Navigate to the <wrap file>launch-zim.cmd</wrap> script you created earlier, and select it. If Zim opened, close it now. Double-click on the <wrap file>notebook.zim</wrap> file to be sure that you setup Open With correctly. It should open the chosen Notebook in Zim. {{::open-with-done.png?direct&600|}} **Zim should be ready to use now!** ===== 6. Installing Dependencies of Zim Plugins ===== 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. {{::dep-failed.png?direct&600|}} 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 <wrap nav>MSYS2 MSYS</wrap> from the Start Menu. Enter the following command: <code bash> pacman -Ss graphviz </code> Note that we searched for the name of the dependency in all lowercase letters. {{::pacman-search.png?direct&600|}} 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: <code bash> pacman -S mingw-w64-x86_64-graphviz </code> Fill in the exact name of the package you saw in the search results. Include everything between the "''/''" and the version number. {{::install-dep.png?direct&600|}} 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. {{::dep-ok.png?direct&600|}} Now you are ready to use the plugin.