Released: Python support in Visual Studio 2017


Today is launch day for Visual Studio 2017, and you can see all the info and join the live event at launch.visualstudio.com. But over in this corner of our world, we are announcing something special.

As you likely know, once software is officially released, it normally gets less frequent updates. For those of us who love getting new toys, this can be disappointing after an update-packed preview phase. For Visual Studio 2017, we significantly improved our install experience and added scenario-specific workloads, but also made it easier for us to service the product. This means everyone will see more frequent updates, and they’ll generally be faster and more targeted than in the past, but we can also provide our early adopters with access to features before anyone else.

Visual Studio 2017 and Visual Studio Preview

The Visual Studio Preview icon

As well as Visual Studio 2017, today we are also releasing Visual Studio Preview. This will be an early preview of what’s coming next for Visual Studio, just like those we have been releasing up to this point. Visual Studio Preview will receive updates a few weeks before the “stable” release, letting you try the latest and greatest improvements first.

In the past, installing a preview of Visual Studio has required using a completely separate machine. For Visual Studio 2017, we now have the ability to install and use Preview side-by-side with another install of Visual Studio. And while the Preview install is not officially supported (not “go live”), the main one remains fully supported and you can use both at the same time on the same machine.

(To be clear, if you’ve already installed Visual Studio 2017, this will install it again and you’ll have two separate installations with separate workloads and settings, both managed through the same Visual Studio Installer. Everything that is in Visual Studio 2017 is also in Preview, so you would only need both to take advantage of paid product support offerings, which are not available for Preview. The FAQ at the product page has more details.)

Why announce it here?

Python in Visual Studio Preview

You may be wondering why we are announcing Visual Studio Preview from the Python blog, rather than the main Visual Studio blog. The reason is that the first available feature in preview is the Python development workload!

This is the same Python support you’ve used since Visual Studio 2010 as Python Tools for Visual Studio, but now updated and enhanced for 2017. Let’s walk through some of the major changes, and we’ll be posting more blogs in the coming weeks diving deeper into each one.

Installation

As Python support is now part of the Visual Studio installer, we get to take advantage of the features it provides. In the screenshot below, you can see that when the Python development workload is selected, a list of optional components become available. These are either recommended Visual Studio features or third-party tools that we think you will find useful.

The Python development workload selected in the Visual Studio 2017 Preview installer

Firstly, you’ll see a range of Python versions available, as well as the Anaconda distribution from Continuum Analytics. These are coming straight from the external sites, so you can install them yourself and get exactly the same functionality, but we’re also making it a simple checkbox.

“Python native development tools” are actually Visual Studio’s regular C++ tools and compilers, but we’ve selected the correct versions for developing with Python 3.5 and later. See our earlier post for information about versions prior to 3.5.

We will discuss Cookiecutter template support below, and the other options are specialized Visual Studio features for Azure or Windows IoT Core. You’ll know (or you’ll be prompted in product) if you need these.

(Minor known issue – if you’ve already installed Python 3.6, you’ll want to deselect its checkbox when installing. Otherwise uninstalling VS will also uninstall Python.)

Interactive Windows

Python interactive windows showing code cells

We know that many of our users spend most of their time in interactive windows, so we have made some improvements for this release to make them more powerful. Expect a future blog post to go into more detail, but the highlights include:

  • You can now Ctrl+Enter in the editor to send to interactive
  • You can mark code cells with #%% and send them all at once
  • You can create as many interactive windows as you like, and choose the Python environment for each one

Cookiecutter

When Cookiecutter template support is installed, you will see new options appear under File, New Project and also the Add New Item menus. These will open our Cookiecutter Explorer window, which can help you find and use online templates.

Not familiar with Cookiecutter? Check out our previous blog walking through the new support.

Azure

For Visual Studio 2017, we’ve started an overhaul of how Python projects are created and deployed to Azure. Previously, we made it easy to get something simple up quickly, but we heard feedback that we weren’t well supporting people who were maintaining complex web applications.

New Azure-specific item templates in Visual Studio 2017

We expect this process to take some time, and we hope you’ll join us in this to help us get it right, but here are the changes from ealier versions so far:

(This area does have one known issue: you should select the “Azure Cloud Services core tools” optional component when installing for full Azure support. We’ll fix it as soon as we can.)

What plans do we have for the future?

Visual Studio Preview is a staging ground, so you can expect to see the Python development workload (and the Data Science workload) become available in the fully supported Visual Studio release within a few months. At that point, you can either remove Visual Studio Preview, or keep it around and enjoy the next set of early updates.

We are continuing to actively develop our Python support, and as in the past, all our development takes place on github, so if you would like to let us know what you need most, please come and file an issue. We also accept code and documentation contributions.

Comments (77)
  1. Mike says:

    So does that mean there is no way to install PTVS in non-Preview 2017?

    1. Right now, yes, that’s what it means. We’re hoping to move into non-Preview as soon as possible once we’ve finished the last few things we need to do.

      1. Mike says:

        Thanks for the clarification. 🙂

      2. Arthur says:

        Steve, do you have a tentative release date for this non-preview?

        1. aeophie says:

          I also want to kown the exactly day that the python integrate with vs2017,but as you see,steve might not sure about it.

          1. As soon as I can guarantee the date, I’ll let you know 🙂 . Until then, we should have regular updates coming through Preview.

  2. Jim says:

    Was wondering what happened to Python. Guess I’ll stick to learning it for now in the Python IDE. Though I am glad it’ll come back at a later date.

  3. Sean says:

    Can you compile python into a Windows executable?

  4. Louis says:

    will “Test Explorer” integrate the Django TestCase ?, it looks not work in this VisualStudio 2017 preview, still need to use “python manage.y test”

  5. Great! Visual Studio Code, Visual Studio 2017 and now Visual Studio Preview are running side-by-side.

  6. Steven says:

    Anyone have any luck installing with a proxy? In corp environment the setup keeps saying to check my connection. Everything I searched on it mentions making an offline CD with –layout, but still doesn’t mention how to do that behind a proxy for dev enviorments never out of corp network.

  7. William says:

    What about Python 2.7? Is 2017 just for Python 3.0 and later? Working with 2013/Python 2.7 and love it.

    1. Works just as well for Python 2.7 as any other version! (And slightly better than Python 3.6 right now – we haven’t quite handled all the new features yet.)

  8. John says:

    Hello Steve,

    If I install the VS enterprise preview and didn’t have a license like RC can we use it without the license ?

    1. I think you can only use Preview versions that you would have regular access too. But I’m not sure whether that’s the way it’s going to stay. Keep an eye out for future announcements.

  9. R. Robinson says:

    Python works OK except Microsoft’s CNTK (latest version) fails its first suggested test: can’t set device to GPU. Says “invalid device” when trying:

    import cntk
    from cntk.device import set_default_device, gpu
    set_default_device(gpu(0))

    CNTK python examples that don’t try to use set_default_device work OK.

    I guess this is a CNTK problem? rather than Visual Studio but I though I would mention it since my main reason for trying python in Visual Studio 2017 was to use it with CNTK.

    1. Great to hear you’re using CNTK! Does your code sample work if you run it from the command line? If it’s different inside VS then we will want to take a look.

      1. R. Robinson says:

        Steve,
        Thanks for your reply. Nice to know somebody at Microsoft cares.
        Yes, using CNRK in a CLI python environment gives the same error. So I guess its a CNTK problem, not VS 2017.
        Russell Robinson

  10. Thomas Israelsen says:

    Please please please:

    Provide support for executing Python unit tests as part of a TFS build server build, including the ability to view tests results.

    1. We have some experiments going on ways to make this easier, but our current suggestion is to use pytest to run the tests with JUnit format logs, then use the Publish Test Results task to get the results showing up on the build. (Visual Studio doesn’t really do anything special for Python tests, so you can use the standard tools most of the time.)

      1. Thomas Israelsen says:

        Sounds very promising. I was not aware of the pytest/JUnit option. Two questions:
        1. Will I be able to write pytest based tests and execute them directly in VS Test Explorer? I would prefer to write one set of tests and the be able to execute them in Visual Studio and on a build server
        2. Is the Publish Test Results task available for XAML build definitions or the new build definitions from TFS 2015 or both?

        1. 1. Right now, we only detect unittest-style tests, but so does pytest. So if you write your tests in unittest style then we can. Right now, we don’t handle some of the special features of pytest in this area (e.g. using a decorator to create permutations of a test).
          2. I know the Publish Test Results task is available for the new build definitions. I think the XAML build definitions integrate test run/publish into one step, so it won’t work. This is one of the reasons they are being replaced by the new style definition

          1. Thomas Israelsen says:

            1: Perfect!
            2: OK. No problem. A good incentive to switch 🙂

  11. I’m pretty sure that all of us heavy users would have been OK with a (beta) tag next to the python dev packages and then it would be pretty easy to deal with whatever issues there might be until the (beta) tag is removed. When can we expect this first “asap” update :D?

    1. I’m checking in the first update right now. It’ll come out when it’s ready (there are other teams contributing to it as well), but should be within the next week or two. (There won’t be anything “new” in this update, just bugfixes.)

      1. I’m sorry – will the python support be included in this immediate update or will it be in a future update? Please say it will be included now :).

        1. It’s in the version of Visual Studio Preview linked in the post, which is otherwise exactly the same as the “regular” VS 2017 release.

  12. pkmlp says:

    You got me! I am a Python Enthusiast and work since year with different IDEs, of course allways others than VS (and, sorry for that, VS was not a real option for Python coders who know others like PyCharm, …). VS 2015 with VSPT was a step in the right direction. VS 2017 (preview) is great, I am looking forward to many more Python related Posts and I hope you will include a GUI Designer that works like QT-Designer. If so – I’m yours.

  13. santi santosh says:

    I am using python scripts on VS2015 and quite happy with performance report that it generates, what’s new in this regard on VS2017 ?

    1. For profiling, not much has changed. We’ve added code coverage reports when running unit tests, but only if you have VS 2017 Enterprise. We do have some plans to improve it though, and those will only come to VS 2017.

      There are also lots of bug fixes and minor improvements. Hopefully most of them you won’t even notice, it’ll just feel faster and more stable 🙂

  14. Ali hassan says:

    I was using Python in visual studio 2015 it was good now today i installed vs 2017 community. And Python is gone. When possibly we can have it back in future update. Please confirm

    1. If you install VS 2017 Community from the link near the top of this post, then it will include the Python workload.

      1. ali hassan says:

        Sorry but can you please tell me the difference between vs2017 RTW and vs 2017 preview. because I have low disk space and in order to use python I need to uninstall RTW version of vs. so is there any difference or should I uninstall RTW and install Preview without any worries?

        1. Sabeel says:

          From the article : Visual Studio Preview will receive updates a few weeks before the “stable” release, letting you try the latest and greatest improvements first.

        2. Right now RTW and Preview are identical except for Python support (and if you want to use any support plans then Preview is not covered – you’ll be asked to install RTW first). Over time, Preview is going to get updates earlier than RTW, so it will diverge more, but right now there’s basically no difference.

      2. Francois Botha says:

        Python isn’t an explicit item under VS 2017 Community’s installation. Is it an implied item and if so, what items do I need to select to install it? Or can I do a base install (i.e. excluding .NET etc) and expect Python support?

        1. If you don’t see it, you should close the installer and run the one linked from this post. This one will add extra options for you.

  15. Please add ability to turn off intellisense on Python. The constant popups are annoying and distracting.

    1. If you go to Tools, Options, Text Editor, Python and deselect “Auto-list members” and “Parameter information” then we shouldn’t pop anything up while you are typing.

      You can still use Ctrl+J or Ctrl+Space to get a completion list, and Ctrl+Shift+Space inside a function call when you want to see popups.

  16. Alex says:

    Downloaded and installed the Preview version. There’s the Python workload there as expected but no Data Science one. Any info on the latter? Thank you.

    1. Coming soon 🙂 (hopefully only a few weeks away, but keep an eye on the blog and we’ll let everyone know about it)

  17. Alireza Manashty says:

    I have installed VS 2017 Enterprise. Now that I want to install the VS 2017 Enterprise preview, it just brings up the VS 2017 Enterprise setup screen with Modify/Repair option. Modify doesn’t show any Python as before. Am I missing something? Thanks.

    1. When you say “as before”, do you mean during RC? Or did you install VS 2017 Preview Enterprise (in the last week) and now Python has disappeared?

    2. We accidentally had the wrong download linked from that page – it was up from about 10am-1pm today (US west coast time), but has been fixed now. Thanks for your patience!

  18. Rebecca says:

    I installed today from the link above and Python Workload isn’t there

    1. It looks like something has been updated – I’m investigating now.

      1. Floris says:

        I’m currently experiencing the same problem. I’m also trying to install the preview version with python support, but it does not show up on the installer screen, even though I downloaded the preview version. (I think it looks like even though I clicked on download via the preview page, it still gives me the regular VS2017 download).
        Is there any update on this?

        1. I saw this problem once, and then tried again and it was fine. Possibly we accidentally uploaded the wrong download and then fixed it – I’m about to check with some people who will know.

        2. We accidentally had the wrong download linked from that page – it was up from about 10am-1pm today (US west coast time), but has been fixed now. Thanks for your patience!

          1. Floris says:

            OK, thanks!

    2. We accidentally had the wrong download linked from that page – it was up from about 10am-1pm today (US west coast time), but has been fixed now. Thanks for your patience!

      1. Martin Bezděk says:

        Python Workload still missing…
        Downloaded installer: vs_professional__750528283.1489735404.exe

        1. I don’t know what the numbers mean, but I get different ones when I download today. Perhaps you got the old installer from a slow CDN? Can you try downloading it again?

  19. Karol says:

    Hello! Could you tell me when Python will be available on Visual Studio 2017? 😉

    1. Only as well as I’ve said so far. It’s available on VS 2017 Preview right now, and coming to VS 2017 stable in the next few months.

      1. Nirmalkumar says:

        No its not available….

        1. Mark says:

          No, it doesn’t seem to be available at all. Tried all the links they all download the same Vs-installer and Python is not included.

          1. Can you email one of the installers you downloaded to python@microsoft.com? Either in a zip file (to get past the virus scanners) or a link to dropbox/etc. We’re getting the right ones when we download, but it’s possible that a slow CDN is still holding the broken one.

          2. Mark says:

            Its available in the preview release, not in the main release.

  20. Alex says:

    In previous versions of PTVS when I open a single .PY file the editor automatically changes its scope to the file’s folder. That way all imports work seamlessly, I got intellisense and can navigate between modules. But in VS2017 you changed that behaviour. Same-folder modules are no longer visible. Instead I got green warnings.
    Is it possible to somehow control VS working directory without using solutions? Maybe some Command, or menu option.

    1. Alex says:

      Actually I’ve just created a solution from my existing code and Intellisense doesn’t work at all 🙂 So one-file editing is not so bad..
      Also, did you abandon code-folding feature of PTVS? I no longer see minus button on functions, multiline strings and classes to collapse them.

      1. Nope, we didn’t abandon any of that – it sounds like your install hasn’t gone well. Can you try running a Repair from the VS installer?

        1. Alex says:

          I have this installer: vs_community__814779171.1489251936.exe
          Only “Python language support” was checked during installation.
          After repair everything is the same. No changes

  21. Janisku7 says:

    micropython for this too as like Adafruit is doing micropython version called Circuitpython as what works on they boards like featherline example Huzzah what are in Azure IoT Starterkits and CircutPlayground second version. could be nice to have micropython option with python tools

  22. Carlos says:

    would have been good that Vs2017 bring support to Ruby/Rails, like it makes with Python

  23. Today, I downloaded and installed Visual Studio 2017 Community Edition (poor man’s learning platform) and decided to do some ophiology but I am unable to find Python in the Visual Studio 2017 workloads. Any suggestions to catch this reptile by the tail and put it into the Visual Studio cage will be appreciated. 😉

    On a serious note it is a bit frustrating. Thanks in advance guys.

    1. Yeah, I understand it’s frustrating. If you download from the link at the top of this post then you should see it. We’ll be back in the main installer soon.

    2. Ali says:

      Be sure it is the VS 2017 Preview version. Otherwise, you won’t have access to Python support in general

  24. David says:

    What did happen to python? I installed what I believe to be the non preview version of VS 2017 and I do not see python support in it? Is that feature still being worked on or is it dropped?

    1. It’s in the Preview version – see the post above.

      1. Ed K says:

        Don’t know why people aren’t reading the thread. Same questions so many times! But seriously, when can we expect this!!!
        Kidding…thanks for the great work

        1. I think the title is causing a little confusion 🙂 (in my draft I had “Preview”, but I was asked to take it out to avoid confusing people…)

          Right now we’re looking pretty good for within the next 2-3 months, though you won’t notice much difference from what is out there today (unless you’re seeing crashes, in which case tell us and hopefully you will notice a difference!)

          1. Dallas says:

            So on March 22nd at 8PM you say “We’ll be back in the main installer soon” and the next day at 8AM (only 12 hours later) “Right now we’re looking pretty good for within the next 2-3 months”…? WTF

          2. Big companies and big products move slowly. Visual Studio normally deals with changes over years, not days, so “months” is relatively soon though I recognize not everyone has that full context. The product is basically fully planned over the next 6-12 months, though we’re getting much better at doing incremental releases and adjusting major release dates to meet quality goals.

  25. Kirill says:

    Good job. Now it will be great to add a possibility to compile an executable from a Python project.

  26. merlik says:

    the preview is not working for me is it because im using window 7

    1. Sorry you’re having trouble. It’s really hard to tell why it isn’t working without more details. I suggest going to https://developercommunity.visualstudio.com/ and reporting it there, and someone should come along to help you out.

Comments are closed.

Skip to main content