16

Steps to the Reproduce:

  1. Open Visual Studio 2017 (Pro on Windows 10 64-bit)
  2. File > New Project > IronPython Application
  3. Run the default program: print('Hello world')

When I run it, I get the following error:

The environment "IronPython|2.7-32" appears to be incorrectly configured or missing.
You may need to install it or create a virtual environment

Python Error

I went to VS Installer, Individual Components tab, Compilers section, and checked on the Python 2.7 & 3.6 selections, but I'm still getting the problem

KyleMit
  • 30,350
  • 66
  • 462
  • 664
Doug Null
  • 7,989
  • 15
  • 69
  • 148

3 Answers3

18

You need to set up the IronPython 2.7 environment*.
*Currently you cannot do it through the Visual Studio Installer (there isn't an IronPython Package option to install).

  1. You need to download IronPython and install it separately from Github.
  2. After it's installed, you need to select the correct python environment within your VS project.
  3. If the IronPython 2.7 environment is not properly set then you have to do it manually

Hopefully, Microsoft will patch this in the future.

KyleMit
  • 30,350
  • 66
  • 462
  • 664
Geo Angelopoulos
  • 1,037
  • 11
  • 18
  • Why do you need IronPython 2.7 in the first place since there is already Python (3.6 in my case) listed in the "Environment section"? Does debugging require its own IronPython environment? – mins Oct 16 '20 at 15:07
  • Quick comment to note that this solution is still required today (Mar 2021). Presently, I am not using anything required in 3.6 so I stopped at the point of getting 2.7 to run.Many thanks! – Donny McCoy Mar 01 '21 at 20:55
  • (Mar 2021) After installing IronPython 2.7, make sure you change the Project Properties > Debug > Launch Mode to "Standard Python Launcher". Otherwise, if you attempt to debug your Python scripts, it just launches it and kills the debugging session too quickly, even with breakpoints set. – tom_mai78101 Mar 27 '21 at 23:30
1

Download the msi file for IronPython from Github. Then copy the path where it is downloaded and add it to the path in the system environment variable. Then restart visual studio. Select the project and set the python environment to IronPython.

Done M J
  • 11
  • 1
0

When switching from Python 3.8 to 3.9 I came across the same error (also with pylint). I simply edited the project.pyproj (xml) file from: <InterpreterId>Global|PythonCore|3.8</InterpreterId> to: <InterpreterId>Global|PythonCore|3.9</InterpreterId>.

dduck
  • 1
  • 1