Skip to content

Instantly share code, notes, and snippets.

@ThijsvdLaar
Last active August 29, 2015 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ThijsvdLaar/f7e662000d70df110498 to your computer and use it in GitHub Desktop.
Save ThijsvdLaar/f7e662000d70df110498 to your computer and use it in GitHub Desktop.
Issues encountered while getting Infer.NET up and running with IronPython

When trying to get Infer.net up and running with IronPython I encountered several issues. In this gist I will explain step by step how I got Infer.NET installed, in case anyone else encounters similar problems.

MS .NET

The first step is to install the Microsoft .NET framework. You can download and install it. The current version of the framework is 4.5. You can additionally install visual studio, but that is not required to work with Infer.NET.

IronPython

Next you need to install IronPython. Make sure you get the .msi install file, because that makes life easier. I set the install directory to C:\IronPython, but I guess you can install it anywhere you like.

You can start the IronPython console from the start menu or the installation directory ipy.exe.

I had the peculiar problem that entering quotes in the IronPython console introduces a ^@ prefix. This is because the qoute character requires an additional tap on the space bar to appear. Easy for entering special characters, but really annoying when programming. You can circumvent this feature by altering your keyboard layout. Go the control panel and click on Region and Language. Go to the Keyboards and Languages tab and press Change Keyboards.... Press Add..., select English (Unites States), and tick the US box. Press OK and Apply. Now you should immediately see a quote character when you press the key.

If you're unfamiliar with IronPython, then you can work through the basic tutorial file Tutorial.htm in the Tutorial directory within your installation dir.

Infer.NET

Now you're all set to download Infer.NET. Download the zip and unpack it in a directory of your choosing.

To make IronPython work well with Infer.NET you need to open the location of your Infer.NET and copy the source\wrappers\IronPython directory to [IronPython install dir]\Lib\site-packages. Now open the __init__.py file in your favourite editor and replace the assignment of infernetpackagedir with infernetpackagedir = "C:\\Infer.NET\\Bin" (where you need to replace C:\\InferNET with your own Infer.NET directory). Now rename this package directory from IronPython to InferNet.

Now when open you IronPython console and type import InferNet, you're good to go. You can take a look at this tutorial under the InferNet Package section to get started. Make sure you run the console with administrator privileges, because it writes to disk.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment