Python support is now stable in Visual Studio 2017


Today we have released our next update to Visual Studio 2017, and it's the one you've been waiting for. As of today, the Python development and Data Science and Analytical Applications workloads are stable and ready for production use.

You can read our post on the Visual Studio blog for an overview of what is new, and we will release a detailed blog in the next few days, but right now, I want to walk through how to install Python support in Visual Studio 2017.

[Edit May 15th] Our blog A Lap around Python in Visual Studio 2017 is now available over on the main Visual Studio blog.

You can use the links below to jump directly to the section that best describes your situation.


I have never installed VS 2017 before

Welcome! We're glad you're going to try out our tools. If you find anything that doesn't work as you expect, please use the "Send Feedback" tools within the product to let us know.

For installation, we recommend downloading the installer from the main download page. Then, when prompted to select workloads, choose Python development.

If you already have a copy of Python installed, you can skip installing it again, or select other distros from the right-hand side of the install screen.

Visual Studio installer modify dialog with Python development workload highlighted


I have only installed the Preview

Firstly, thanks so much for helping test our early releases. The feedback has been very useful and has made the product better in many ways.

Now that Python is available in the stable release, you have the choice to remove Preview entirely, or to keep using it. Future updates will still be released to Preview first (for example, our next round of bugfixes will be in Preview in just a few weeks), so if you like having early access, you can simply click Update in the installer. Clicking the notification that appears inside Visual Studio will also bring you to this screen.

Visual Studio installer showing Update for Preview

Alternatively, if you want to use the fully supported version of Visual Studio with Python, you can now remove Preview. To do this, rather than click the notification icon in Visual Studio, you will want to launch the installer through Start and select the Uninstall option. You can then install one of the release versions, and make sure to select the Python workload.

Visual Studio installer showing Uninstall selected for Preview


I have only installed the stable release

If you've been using the release version of Visual Studio, you can now add Python support, but it will include a couple of extra steps.

First, you should update your Visual Studio installation. You'll see a notification appear within VS that will do this for you.

Next, you will need to open Visual Studio Installer and modify your installation.

Visual Studio installer showing Modify button for release

In the following screen, you will see new options for Python development and Data science and analytical applications. Both of these include Python support, so select either (or both) and any optional components you want from the right-hand side of the installer.

Visual Studio installer modify dialog with Python development workload highlighted


I have installed both stable and Preview

Now that Python support is available in the stable release, you have a few options.

If you intend to keep both copies installed, so that you can have the reassurance of using the fully supported version of Visual Studio while also having early access to upcoming updates, simply update both installs.

Visual Studio installer showing the Update button for both releases

Then, for the stable release, click Modify and select the Python development workload to add Python support.

Visual Studio installer showing the Modify button for release while Preview is installed

Visual Studio installer modify dialog with Python development workload highlighted

If you no longer want to keep Preview installed on your machine, you can uninstall it from here, then update and modify the stable install.

Visual Studio installer showing Uninstall selected for Preview

Summary

Thanks again to everyone who helped us out by testing Preview, and we hope you'll enjoy Python support being available in the main installation. As usual, please send us feedback using Report a Problem in Visual Studio or directly at our GitHub site, and keep an eye on the Visual Studio blog for detailed blogs about our features.

Comments (21)
  1. john snow says:

    My system is windows 10 64bit ,when I type the help(print)in the python 2.7interactive window,it does well,also in the pycharm and python 3.6 itself,but in the python 3.6 interactive it shows nothing!I’ve changed several computers, all shows nothing,in the visual studio 2017 preview 15.3 with the python 3.6 environment also nothing,I’m confused! Can you tell me why?

    1. This looks like a bug in how we are handling text redirection in the interactive window. If I do “help(print)” and then immediately reset the interactive window, the output appears in red like an error.

      I created a bug at https://github.com/Microsoft/PTVS/issues/2531 for us to look into it. Thanks for letting us know!

      1. john snow says:

        thank you for the reply,and I wanna kown when the bug will be fixed?the next version in the june?

  2. Daniel Morgan says:

    Glad to see it is finally here. I installed the 15.2 update and checked Python and Data Analysis.

    Most templates for projects like C# or VB whether a class library, console app, or asp.net mvc web project; a simple hello world project is created with an app you can immediately run and/or debug.

    The Python template created a PythonApplication1.py file but it is blank.

    Any good examples of Python running / debugging in Visual Studio 2017 version 15.2?

    Thanks,
    Daniel

    1. If you installed Anaconda, the templates under Machine Learning are great for this (though getting a little dated… we have some updates planned for them).

  3. Daniel Morgan says:

    Does not display correctly for the Dark theme. You type command like: print(“test”)
    and the “print” disappears because the text becomes black.
    I had to change the theme to the “Light” theme to see the text.

    1. Thanks. This is a known issue and currently our top priority. You can workaround it by uninstalling F# support, or by using the light theme. The next update to VS (in a couple weeks) should fix it and you can switch back then.

      1. Daniel Morgan says:

        I tried step-debugging and then inspecting a variable, and it works. Very nice.

        The past couple of months, I have been learning new languages like Python and R since they are becoming popular. Also because there is a lot cool stuff out there written in Python like Digital Signal Processing. Glad to see it supported in Visual Studio since I use Visual Studio at work — and at home. On the weekends, we have our own pet projects and languages we like to play with. Python is one of those things.

        Thanks for adding Python support in Visual Studio 2017 15.2.
        – Daniel

    2. Chris Steenkamp says:

      I had the same issue, I just switched the theme to light, then to blue, and then back to dark and it seemed to correct the issue.

  4. Nick says:

    How can you tell VS to detect a pre-existing install of Anaconda?

    1. If it isn’t automatically detected, you can add it manually. See the instructions at https://docs.microsoft.com/en-us/visualstudio/python/python-environments#creating-an-environment-for-an-existing-interpreter (Recent versions of Anaconda should be detected automatically – possibly twice, depending on the options you selected when installing it.)

  5. David Waterworth says:

    How do you migrate an existing VS2015 python project to VS2017? When I try and open an existing solution it shows (needs migration) against the project but it didn’t ask me if I want to run a migration wizard?

    Dave

    1. It should run it automatically just after prompting. If you’re getting the prompt repeatedly, it’d be great if you sent a problem report (through Help/Feedback) and attach the .pyproj file.

      1. David Waterworth says:

        Hi Steve

        I don’t get a prompt at all. If I open my solution in VS2017, in the solution explorer under the Solution my project has (needs migration) beside it and if I try and expand the project it says This project needs to be migrated but that’s all that happens when I open it, no prompt to do the migration?

        Dave

        1. David Waterworth says:

          Hi Again

          It appears that right-click on the project and selecting reload invokes the migration wizard. Simply opening the previous solution file doesn’t (for me)

          Dave

  6. mp says:

    Hello,

    How do I report a bug with Python running under VS 2017?

    If I create a text file in python application and then open the same file and try and print out the contents it has all sorts of issues including either not reading the last line or not reading the contents at all.

    If I send command to the python interactive window, it works fine.

    If I open a new solution and open the file and then print, it works file.

    Perhaps difficult to explain but I can post (simple) code – just need to know where.

    1. mp says:

      Apologies – found out how to report bug 🙂

  7. Maxima says:

    I have VS Pro. There is no “Python Development” workload in my installer.. is it only for Enterprise version

    1. Nope, should be in all versions (for Windows only – not in VS for Mac or VS Code). Make sure you’ve updated your installer.

  8. sravya haasa says:

    Does Microsoft Visual Studio 2017 support Python 3.6.1?

    1. Yes, with a few caveats:

      We will automatically detect Python 3.6 and offer it in the list of environments
      Most Intellisense and debugging (including remote and mixed-mode) work with 3.6
      By default, VS 2017 will install Python 3.6.0 right now – this will be updated soon
      Some new syntax features are not recognized and may be marked as errors

      In general, Python 3.6 works just fine, especially if you’re writing code that also works on 3.5 and earlier. There are just a few new features that we haven’t yet added the support for.

Comments are closed.

Skip to main content