Python 3.6 and Visual Studio 2017 42


As a new version of Visual Studio comes out, there are often fixes to put in your build chain tools so packages with external  C/C++ compilation requirements still work. For Python 3.6 and Visual Studio 2017 to work together, a good reference start point is the Windows compilers compatibility list on python.org.

Let’s try to compile scrapy which has a lot of dependencies including the twisted package.

Let’s assume you have installed “Visual Studio 2017 Community” on your PC with the C++ support. Trying to run the well-known

will end-up with a compile error, such as the following:

When working with Python 3.6 you may find however many stackoverflow articles stating that you must install Visual Studio 2015 back. Save yourself time and space by not doing it.

As mentioned as a requirement in the previously mentioned article, one requirement is to have a version of the setuptools library which is higher than 34.0. Unfortunately, Python 3.6 comes with 28.0 and the simple

won’t work as it tells you you have already what’s needed. Use instead:

If everything goes well, you’ll have:

This will allow Python to access your Visual Studio 2017 installation and no longer have two versions or more  installed in parallel.

The last trick is to use the proper environment to run command-line installations. With Visual Studio 2017 come multiple command prompts setups:

Do not choose ‘Developer’ although it may sound appealing. You’ll get caught with LNK2010  linking errors because of INCLUDE issues, in the same way that a regular cmd would output the  following error:

For proper compilation, choose the native architecture. In my case, I Choose ‘x64 Native Tools’ and finally got the following successful result:

 


Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

42 thoughts on “Python 3.6 and Visual Studio 2017

  • Ar one

    Thank you very much! Like a lot!!
    I couldn’t be bothered to download a humongous 4GB redundant older version c++ build tools, when I already have the latest ones.
    I tried searching for steps to make python choose the latest vs version for the build, but there were no relevant solutions. This one worked as a charm 🙂

  • Patrick

    Thank you very much for your solution. Worked perfectly! I did have to run the Command Prompt as administrator because I got an access denied error for read/write operations. Right mouse click Command Prompt as select: Run as administrator.

  • grateful dude

    Dimitri, man, thank you so much for the solution! 1 minute updating setuptools vs half a day downloading yet another version of MS monstrocity is quite a difference.

  • Dmitri

    Hello Dimitri. I failed to do the last trick. Can’t understand how could I run x64 Native Tools Command Prompt for VS 2017. I have only “Developer command prompt for VS 2017” available. Should I install something to have such a option?

    • Dimitri Post author

      Hello, in the version I installed, I’ve got 4 shortcut links under C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Visual Studio 2017\Visual Studio Tools\VC
      The shortcut I’m talking about is running “%comspec% /k “C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat”
      If you look into the that folder, do you have this vcvars64.bat? And is the Developer Command Prompt point to it?
      I’m wondering if the shortcut name changes with the Visual Studio releases or Edition…

      • Aayush Agrawal

        Hey,
        Even after trying the steps you mentioned, it’s giving the same error at my end. I also do not see the “Build” folder in the path below:
        C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat
        which you have mentioned in the comment above!. What should I do in such a case.

        • Dimitri Post author

          In the Visual Studio Installer, under Individual Components, you may want to verify if ‘VC++ 2017 v141 toolset (x86,x64)’ is installed. Also do you have the Windows 10 SDK installed or not?

      • kapil

        Hello Dmitri
        I am trying to install cvxpy package which has many dependencies like scrapy using pip and got the errors you have mentioned above.
        So I have installed python -m pip install -U pip setuptools which is the first step and successfully done the step.
        coming to the second step how can I choose x64 Native Tools. I am confused.
        I have got 4 shortcut links in C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Visual Studio 2017\Visual Studio Tools\VC
        and I have got vcvars64.bat file in C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat
        How to know Developer Command Prompt is pointing to it.

  • Jean

    Thanks a lot!
    However, after I did “python -m pip install -U pip setuptools” for my Python 3.6 and got “Successfully installed setuptools-38.5.1”, I still have this error:
    error: Microsoft Visual C++ 14.0 is required. Get it with “Microsoft Visual C++ Build Tools”:

    I am not sure my Path setting is correct though. I added to my Path the following:
    C:\Program Files (x86)\Microsoft Visual Studio\2017;
    C:\Program Files (x86)\Microsoft Visual Studio\2017\Community;
    C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7;
    C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE;
    C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\bin;
    C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\bin\MSBuild;
    C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild;
    C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0

    Almost everything.

    Any clue?

    Thanks a lot!

    • Dimitri Post author

      As mentioned in one of my previous answers, the commands at the end are launched through the vcvars64.bat prompt, which among other things set the path, but also do a few other things. You may want to do your compilation from that command prompt to see if it is working there.

  • narayana

    hi after the step “python -m pip install -U pip setuptools” , i’m still getting a lot of errors.
    C:\Users\Narayana>pip install setuptools
    Requirement already satisfied: setuptools in c:\program files\python36\lib\site-packages

    C:\Users\Narayana>python -m pip install -U pip setuptools
    Requirement already up-to-date: pip in c:\program files\python36\lib\site-packages
    Collecting setuptools
    Using cached setuptools-38.5.2-py2.py3-none-any.whl
    Installing collected packages: setuptools
    Found existing installation: setuptools 28.8.0
    Uninstalling setuptools-28.8.0:
    Exception:
    Traceback (most recent call last):
    File “C:\Program Files\Python36\lib\shutil.py”, line 544, in move
    os.rename(src, real_dst)
    PermissionError: [WinError 5] Access is denied: ‘c:\\program files\\python36\\lib\\site-packages\\__pycache__\\easy_install.cpython-36.pyc’ -> ‘C:\\Users\\Narayana\\AppData\\Local\\Temp\\pip-icydqxih-uninstall\\program files\\python36\\lib\\site-packages\\__pycache__\\easy_install.cpython-36.pyc’

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
    File “C:\Program Files\Python36\lib\site-packages\pip\basecommand.py”, line 215, in main
    status = self.run(options, args)
    File “C:\Program Files\Python36\lib\site-packages\pip\commands\install.py”, line 342, in run
    prefix=options.prefix_path,
    File “C:\Program Files\Python36\lib\site-packages\pip\req\req_set.py”, line 778, in install
    requirement.uninstall(auto_confirm=True)
    File “C:\Program Files\Python36\lib\site-packages\pip\req\req_install.py”, line 754, in uninstall
    paths_to_remove.remove(auto_confirm)
    File “C:\Program Files\Python36\lib\site-packages\pip\req\req_uninstall.py”, line 115, in remove
    renames(path, new_path)
    File “C:\Program Files\Python36\lib\site-packages\pip\utils\__init__.py”, line 267, in renames
    shutil.move(old, new)
    File “C:\Program Files\Python36\lib\shutil.py”, line 559, in move
    os.unlink(src)
    PermissionError: [WinError 5] Access is denied: ‘c:\\program files\\python36\\lib\\site-packages\\__pycache__\\easy_install.cpython-36.pyc’

    C:\Users\Narayana>
    please help regarding this issue

    • Dimitri Post author

      Hello, Your error is permission denied as marked on the latest line. You may want to double check you have enough rights when executing those commands (local administrator in an elevated prompt)

      • narayana

        Hi, I opened Windows PowerShell as Admin. the command “python -m pip install -U pi setuptools” worked fine. it successfully updated the required ones. the 3rd part is not getting done. I opened x64 Native Tools as Admin but the commands are not going good. when i enter “pip install pyswisseph” i’m getting the error not able to link the visual studio.
        swhgeo.obj : error LNK2001: unresolved external symbol strtok_r
        build\lib.win-amd64-3.6\swisseph.cp36-win_amd64.pyd : fatal error LNK1120: 1 unresolved externals
        error: command ‘C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC\\Tools\\MSVC\\14.13.26128\\bin\\HostX86\\x64\\link.exe’ failed with exit status 1120

        —————————————-
        Command “”c:\program files\python36\python.exe” -u -c “import setuptools, tokenize;__file__=’C:\\Users\\Narayana\\AppData\\Local\\Temp\\pip-build-zxnmxm6a\\pyswisseph\\setup.py’;f=getattr(tokenize, ‘open’, open)(__file__);code=f.read().replace(‘\r\n’, ‘\n’);f.close();exec(compile(code, __file__, ‘exec’))” install –record C:\Users\Narayana\AppData\Local\Temp\pip-mi08v6hq-record\install-record.txt –single-version-externally-managed –compile” failed with error code 1 in C:\Users\Narayana\AppData\Local\Temp\pip-build-zxnmxm6a\pyswisseph\

        Basically i’m trying to workout the first command in the site : https://libraries.io/github/charandas/drik-panchanga.

        • Dimitri Post author

          Your issue has nothing to do with the Python support anymore. You’re trying to compile C Code for which there’s a call to a function ‘strtrok_r’. strtok_r is not supported on the Windows platform. I would look into the source code of the package or contact the author to know which symbol should be defined to compile under Windows eventually: there’s probably a #define Win32 missing…

          • narayana

            Hi, Thanks for the info. I contacted the author. He said it was done for Linux and he doesn’t know how to do it on Windows. I think maybe that is the problem. Thanks for the support.

  • stpaulchuck

    OMG! thanks ever so much!! I never knew those launch icons were in there. I tried all the other approaches to no avail. Launching the X64 native as administrator and pip install line_profiler went PERFECT.

    I love the interwebs. You always run into smart people out here that figured something out.

    Cheers guys!

    • Dimitri Post author

      I’ve haven’t attempted this one, but which kind of error messages do you get? At Compilation? At Linking?

  • Tim Buchholz

    Hi,
    I am trying to install pyyawt (python 3.6.5 visual studio 2017) and it keeps raising this error:
    Command “”C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\python.exe” -u -c “import setuptools, tokenize;__file__=’C:\\Users\\TIMBUC~1\\AppData\\Local\\Temp\\pip-install-qwvadbd5\\pyyawt\\setup.py’;f=getattr(tokenize, ‘open’, open)(__file__);code=f.read().replace(‘\r\n’, ‘\n’);f.close();exec(compile(code, __file__, ‘exec’))” install –record C:\Users\TIMBUC~1\AppData\Local\Temp\pip-record-iksuld9r\install-record.txt –single-version-externally-managed –compile” failed with error code 1 in C:\Users\TIMBUC~1\AppData\Local\Temp\pip-install-qwvadbd5\pyyawt\
    Do you have any idea how I could fix this?

    • Dimitri Post author

      I didn’t try to compile PyYAWT myself but from the trace, I wouldn’t say it is an issue with the python path. In the documentation of the project, under ‘developmnt notes’, compiling under Windows seem to require to set some environment variables. Did you do it?

    • Dimitri

      You do not indicate if you use the proper command prompt to compile the extension. Updating setuptools alone does not suffice.

  • Ruslan

    Hi Dimitri!
    I have installed setuptools, but anyway I have error: command ‘C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC\\Tools\\MSVC\\14.15.26726\\bin\\HostX86\\x64\\cl.exe’ failed with exit status 2

    • Dimitri Post author

      Error code 2 means file not found. Updating python’s setuptools does the python part to avoid the concurrent installation of several Visual Studio versions. However you must still install the Visual Studio 2017 C++ buid tools to get cl.exe.

      • kyle lobo

        Hi Dimitri!

        I am getting the same error. I looked in the directory and the file “cl.exe” is there. I am not sure why it can’t execute it. Any thoughts?

      • kyle lobo

        I am calling it from visual studio x64 command line and getting the following output. I found “cl.exe”

        C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools>pip install pygraphviz
        Collecting pygraphviz
        Using cached https://files.pythonhosted.org/packages/7e/b1/d6d849ddaf6f11036f9980d433f383d4c13d1ebcfc3cd09bc845bda7e433/pygraphviz-1.5.zip
        Installing collected packages: pygraphviz
        Running setup.py install for pygraphviz … error
        Complete output from command c:\users\kyle\appdata\local\programs\python\python37\python.exe -u -c “import setuptools, tokenize;__file__=’C:\\Users\\kyle\\AppData\\Local\\Temp\\pip-install-xmq_fo3d\\pygraphviz\\setup.py’;f=getattr(tokenize, ‘open’, open)(__file__);code=f.read().replace(‘\r\n’, ‘\n’);f.close();exec(compile(code, __file__, ‘exec’))” install –record C:\Users\kyle\AppData\Local\Temp\pip-record-tuojb_ti\install-record.txt –single-version-externally-managed –compile:
        running install
        include_dirs=None
        library_dirs=None
        running build
        running build_py
        creating build
        creating build\lib.win-amd64-3.7
        creating build\lib.win-amd64-3.7\pygraphviz
        copying pygraphviz\agraph.py -> build\lib.win-amd64-3.7\pygraphviz
        copying pygraphviz\graphviz.py -> build\lib.win-amd64-3.7\pygraphviz
        copying pygraphviz\release.py -> build\lib.win-amd64-3.7\pygraphviz
        copying pygraphviz\version.py -> build\lib.win-amd64-3.7\pygraphviz
        copying pygraphviz\__init__.py -> build\lib.win-amd64-3.7\pygraphviz
        creating build\lib.win-amd64-3.7\pygraphviz\tests
        copying pygraphviz\tests\test.py -> build\lib.win-amd64-3.7\pygraphviz\tests
        copying pygraphviz\tests\test_attributes.py -> build\lib.win-amd64-3.7\pygraphviz\tests
        copying pygraphviz\tests\test_attribute_defaults.py -> build\lib.win-amd64-3.7\pygraphviz\tests
        copying pygraphviz\tests\test_clear.py -> build\lib.win-amd64-3.7\pygraphviz\tests
        copying pygraphviz\tests\test_drawing.py -> build\lib.win-amd64-3.7\pygraphviz\tests
        copying pygraphviz\tests\test_edge_attributes.py -> build\lib.win-amd64-3.7\pygraphviz\tests
        copying pygraphviz\tests\test_graph.py -> build\lib.win-amd64-3.7\pygraphviz\tests
        copying pygraphviz\tests\test_html.py -> build\lib.win-amd64-3.7\pygraphviz\tests
        copying pygraphviz\tests\test_layout.py -> build\lib.win-amd64-3.7\pygraphviz\tests
        copying pygraphviz\tests\test_node_attributes.py -> build\lib.win-amd64-3.7\pygraphviz\tests
        copying pygraphviz\tests\test_readwrite.py -> build\lib.win-amd64-3.7\pygraphviz\tests
        copying pygraphviz\tests\test_setup.py -> build\lib.win-amd64-3.7\pygraphviz\tests
        copying pygraphviz\tests\test_string.py -> build\lib.win-amd64-3.7\pygraphviz\tests
        copying pygraphviz\tests\test_subgraph.py -> build\lib.win-amd64-3.7\pygraphviz\tests
        copying pygraphviz\tests\test_unicode.py -> build\lib.win-amd64-3.7\pygraphviz\tests
        copying pygraphviz\tests\__init__.py -> build\lib.win-amd64-3.7\pygraphviz\tests
        running egg_info
        writing pygraphviz.egg-info\PKG-INFO
        writing dependency_links to pygraphviz.egg-info\dependency_links.txt
        writing top-level names to pygraphviz.egg-info\top_level.txt
        reading manifest file ‘pygraphviz.egg-info\SOURCES.txt’
        reading manifest template ‘MANIFEST.in’
        warning: no files found matching ‘*.png’ under directory ‘doc’
        warning: no files found matching ‘*.html’ under directory ‘doc’
        warning: no files found matching ‘*.txt’ under directory ‘doc’
        warning: no files found matching ‘*.css’ under directory ‘doc’
        warning: no previously-included files matching ‘*~’ found anywhere in distribution
        warning: no previously-included files matching ‘*.pyc’ found anywhere in distribution
        warning: no previously-included files matching ‘.svn’ found anywhere in distribution
        no previously-included directories found matching ‘doc\build’
        writing manifest file ‘pygraphviz.egg-info\SOURCES.txt’
        copying pygraphviz\graphviz.i -> build\lib.win-amd64-3.7\pygraphviz
        copying pygraphviz\graphviz_wrap.c -> build\lib.win-amd64-3.7\pygraphviz
        running build_ext
        building ‘pygraphviz._graphviz’ extension
        creating build\temp.win-amd64-3.7
        creating build\temp.win-amd64-3.7\Release
        creating build\temp.win-amd64-3.7\Release\pygraphviz
        C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\users\kyle\appdata\local\programs\python\python37\include -Ic:\users\kyle\appdata\local\programs\python\python37\include “-IC:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\include” “-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um” “-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt” “-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared” “-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um” “-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt” “-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt” “-IC:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\include” “-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um” “-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt” “-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared” “-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um” “-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt” “-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt” /Tcpygraphviz/graphviz_wrap.c /Fobuild\temp.win-amd64-3.7\Release\pygraphviz/graphviz_wrap.obj
        error: command ‘C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x64\\cl.exe’ failed: Invalid argument

        • Dimitri Post author

          Apparently the pygraphviz package calls cl.exe with one or more arguments which are not supported in this release.
          SO it’s more a C++ issue than a Pythone one.
          Did try try to run cl.exe /? to see which switches are supported.

  • Jostikas

    Hi!

    So: running from x64 native tools prompt, have ´[vcvarsall.bat] Environment initialized for: ‘x64’´,

    setuptools is >40 (as can be seen from the log), but It stil asks me to install 14.0:

    ´´´
    c:\Users\laurjo\Downloads>pip install line_profiler
    Collecting line_profiler
    Downloading https://files.pythonhosted.org/packages/14/fc/ecf4e238bb601ff829068e5a72cd1bd67b0ee0ae379db172eb6a0779c6b6/line_profiler-2.1.2.tar.gz (83kB)
    100% |████████████████████████████████| 92kB 1.4MB/s
    Requirement already satisfied: IPython>=0.13 in c:\users\laurjo\appdata\local\programs\python\python36\lib\site-packages (from line_profiler) (6.1.0)
    Requirement already satisfied: simplegeneric>0.8 in c:\users\laurjo\appdata\local\programs\python\python36\lib\site-packages (from IPython>=0.13->line_profiler) (0.8.1)
    Requirement already satisfied: pygments in c:\users\laurjo\appdata\local\programs\python\python36\lib\site-packages (from IPython>=0.13->line_profiler) (2.2.0)
    Requirement already satisfied: setuptools>=18.5 in c:\users\laurjo\appdata\local\programs\python\python36\lib\site-packages (from IPython>=0.13->line_profiler) (40.6.2)
    Requirement already satisfied: pickleshare in c:\users\laurjo\appdata\local\programs\python\python36\lib\site-packages (from IPython>=0.13->line_profiler) (0.7.4)
    Requirement already satisfied: prompt-toolkit=1.0.4 in c:\users\laurjo\appdata\local\programs\python\python36\lib\site-packages (from IPython>=0.13->line_profiler) (1.0.14)
    Requirement already satisfied: traitlets>=4.2 in c:\users\laurjo\appdata\local\programs\python\python36\lib\site-packages (from IPython>=0.13->line_profiler) (4.3.2)
    Requirement already satisfied: decorator in c:\users\laurjo\appdata\local\programs\python\python36\lib\site-packages (from IPython>=0.13->line_profiler) (4.0.11)
    Requirement already satisfied: colorama; sys_platform == “win32” in c:\users\laurjo\appdata\local\programs\python\python36\lib\site-packages (from IPython>=0.13->line_profiler) (0.3.9)
    Requirement already satisfied: jedi>=0.10 in c:\users\laurjo\appdata\local\programs\python\python36\lib\site-packages (from IPython>=0.13->line_profiler) (0.10.2)
    Requirement already satisfied: six>=1.9.0 in c:\users\laurjo\appdata\local\programs\python\python36\lib\site-packages (from prompt-toolkit=1.0.4->IPython>=0.13->line_profiler) (1.11.0)
    Requirement already satisfied: wcwidth in c:\users\laurjo\appdata\local\programs\python\python36\lib\site-packages (from prompt-toolkit=1.0.4->IPython>=0.13->line_profiler) (0.1.7)
    Requirement already satisfied: ipython-genutils in c:\users\laurjo\appdata\local\programs\python\python36\lib\site-packages (from traitlets>=4.2->IPython>=0.13->line_profiler) (0.2.0)
    Installing collected packages: line-profiler
    Running setup.py install for line-profiler … error
    Complete output from command c:\users\laurjo\appdata\local\programs\python\python36\python.exe -u -c “import setuptools, tokenize;__file__=’C:\\Users\\laurjo\\AppData\\Local\\Temp\\pip-install-w5oj5_fi\\line-profiler\\setup.py’;f=getattr(tokenize, ‘open’, open)(__file__);code=f.read().replace(‘\r\n’, ‘\n’);f.close();exec(compile(code, __file__, ‘exec’))” install –record C:\Users\laurjo\AppData\Local\Temp\pip-record-u66cscjg\install-record.txt –single-version-externally-managed –compile:
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.6
    copying line_profiler.py -> build\lib.win-amd64-3.6
    copying kernprof.py -> build\lib.win-amd64-3.6
    copying line_profiler_py35.py -> build\lib.win-amd64-3.6
    running build_ext
    skipping ‘_line_profiler.c’ Cython extension (up-to-date)
    building ‘_line_profiler’ extension
    error: Microsoft Visual C++ 14.0 is required. Get it with “Microsoft Visual C++ Build Tools”: https://visualstudio.microsoft.com/downloads/

    —————————————-
    Command “c:\users\laurjo\appdata\local\programs\python\python36\python.exe -u -c “import setuptools, tokenize;__file__=’C:\\Users\\laurjo\\AppData\\Local\\Temp\\pip-install-w5oj5_fi\\line-profiler\\setup.py’;f=getattr(tokenize, ‘open’, open)(__file__);code=f.read().replace(‘\r\n’, ‘\n’);f.close();exec(compile(code, __file__, ‘exec’))” install –record C:\Users\laurjo\AppData\Local\Temp\pip-record-u66cscjg\install-record.txt –single-version-externally-managed –compile” failed with error code 1 in C:\Users\laurjo\AppData\Local\Temp\pip-install-w5oj5_fi\line-profiler\
    ´´´

    So, any idea what else may I be missing?

    • Dimitri Post author

      From your message, the python part is fine. That’s the C++ complier which is not fine.
      I would check that the C++ compiler is indeed accessible from a vcvarsall.bat prompt, and then that it is the expected version.
      I’m assuming you are reviewed the Visual studio options by launching the Visual Studio installer and checking the C/C++ option is installed. The “standard” workloads from Microsoft do not necessarily include it (e.g. ‘Web development’ may bring you C# but not C++).

  • Mehul

    error: command ‘C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x86\\cl.exe’ faile
    d with exit status 2