Why Does My Inkscape Need to Install Python?

Inkscape is a popular free, open-source vector software compatible with various operating systems, including macOS, Linux, and Windows. Python is a programming language that is used for a variety of applications.

Inkscape prompts you to install Python because its extensions are written in Python. Extensions allow you to use basic scripting to automate repetitive drawing jobs. You can load a python script in the dialog box to make any shape appear on your canvas.

Since Inkscape version 0.46, the software contains the python package needed to run the extension system. If you want Inkscape to function properly or use the application’s extensions, you will need to install the correct version of Python. Keep reading for a layout of the installation process.

How to Install Python for Inkscape on Your Operating System

Before installing Inkscape, you may want to check your computer and see if you already have Python. Python may have been downloaded with another application you have used in the past. If you already have the correct python version for Inkscape, you can bypass installing it with the package manager.

If you do not have Python installed, you can download it directly from the Python website or use the package manager that came with Inkscape.

Installing Python may look a bit different, depending on your operating system. For example, most Linux distributions have Python pre-installed in the system. Therefore, you may need to check if all the features you need for Inkscape extensions are available in your distro’s package. Let’s look at the criteria and process for each operating system.

Installing Python for Windows

Unlike Linux, Windows does’nt include a pre-installed version of Python. CPython has made a Windows installer for every release of the programming language for many years. Python 3.10 supports versions of Windows form 8.1 and newer. Python 3.8 supports Windows 7.

A few installers are available for Windows, including the full installer, the Microsoft Store package, the nuget.org packages, and the embeddable package. Each package addresses your specific needs, whether you want the complete experience or looking for a pared-down version to embed in a larger application.

For Inkscape, you may only need the embeddable package. For that, you can use the package manager that comes with Inkscape. If you want to install the full version, go to the Python website and select the installer for Windows. Use the following instructions:

  1. Start the Install for the appropriate version of Python for Windows, 32-or-64-bit version.
  2. Choose Install Now or Customization
  3. If you choose to Install Now, Python will install directly into your user directory
  4. If you choose Customization, Python will install into the Program Files directory, and will allow you to select optional features during the installation.
  5. In versions of Python before 3.6, you would need your administrator to activate “Enable Win32 Long Paths” policy to avoid getting an error message for path lengths longer than 260 characters.

Installing Python for macOS

macOS users have Python 2.7 pre-installed since version 10.8. However, some versions of Inkscape don’t work properly with Python 2 and need version 3. If that is the case, you’ll find a ‘universal binary’ build of Python via Apple that is intended to run natively on Mac’s new Intel and legacy PPC CPUs.

You might be better off just installing Python 3 directly from the Python website. Just be aware that you’ll have two different installers on your computer, and both are functional. Make sure your paths and usages are accordant with what you want to do.

  1. Start the Install of the appropriate version of Python for macOS, a 32-or-64-bit version.
  2. Choose Install Now or Customization
  3. If you choose to Install Now, Python will install directly into your user directory
  4. If you choose Customization, Python will install into the Program Files directory, and will allow you to select optional features during the installation.

Installing Python for Linux

Since Python is already pre-installed on Linux operating systems, if you need additional features, not available, you can build Python from the source. You can use OpenBSD, FreeBSD, or OpenSolaris to compile the latest version of Python. Each of these options will require a different command.

  • FreeBSD command: pkg install Python 3
  • OpenBSD command: pkg_add -r python

pkg_add

  • OpenSolaris Command: pkgutil -i python27

How to Use Python in Inkscape

To get started, we need to install the Python plugin for Inkscape. This can be done from the Inkscape Preferences dialog (Edit > Preferences). Under the “System” tab, there is an option to “Enable Python support for extensions and scripts”. Check this box and restart Inkscape.

Once Python is enabled, we can access the Python console from the ” Extensions ” menu. Here, we can type Python commands and see the results in real time.

Inkscape 1.0 made the previous extension system obsolete. You need two files to create an Inkscape extension: a .inx or XML file and a .py or Python script. The .inx file contains the location and description of the extension.

In the Python script, you bring in Inkscape’s Python extension module via ‘import inkex’ to access the sub-modules for text, shapes, and other elements.

Two key factors to remember with how an extension works are the main function and class. You define the main function that calls a class you define. Within that class, you have modules inherited from inkex that you can manipulate with your own code.

Lines 17 and 18 define the main function, and Line 7 defines the class. You can also see in Line 4 where inkex was imported to access the sub-module elements. This example is extremely basic and gets more complex as you learn and add your own code to define your element further.

Conclusion

Inkscape can get a little complex when using extensions for repetitive drawing jobs if you are unfamiliar with programming languages. For those seeking an easier way to do graphic design, we recommend a online-based graphic design tool, like Placeit.