7

I am trying to install line profiler for ipython. I am using anaconda to use python.

Current version of python is :

Python 3.6.2 |Anaconda, Inc.| (default, Sep 19 2017, 08:03:39) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

When I tried to install the line profiler with pip this is the output I got with error.

Note: I am running anaconda with python.

C:\Users\dsandhu>pip install line_profiler
Collecting line_profiler
  Using cached https://files.pythonhosted.org/packages/14/fc/ecf4e238bb601ff829068e5a72cd1bd67b0ee0ae379db172eb6a0779c6b6/line_profiler-2.1.2.tar.gz
Requirement already satisfied: IPython>=0.13 in c:\program files (x86)\microsoft visual studio\shared\anaconda3_64\lib\site-packages (from line_profiler) (6.1.0)
Requirement already satisfied: setuptools>=18.5 in c:\program files (x86)\microsoft visual studio\shared\anaconda3_64\lib\site-packages (from IPython>=0.13->line_profiler) (36.5.0.post20170921)
Requirement already satisfied: jedi>=0.10 in c:\program files (x86)\microsoft visual studio\shared\anaconda3_64\lib\site-packages (from IPython>=0.13->line_profiler) (0.10.2)
Requirement already satisfied: decorator in c:\program files (x86)\microsoft visual studio\shared\anaconda3_64\lib\site-packages (from IPython>=0.13->line_profiler) (4.1.2)
Requirement already satisfied: pickleshare in c:\program files (x86)\microsoft visual studio\shared\anaconda3_64\lib\site-packages (from IPython>=0.13->line_profiler) (0.7.4)
Requirement already satisfied: simplegeneric>0.8 in c:\program files (x86)\microsoft visual studio\shared\anaconda3_64\lib\site-packages (from IPython>=0.13->line_profiler) (0.8.1)
Requirement already satisfied: traitlets>=4.2 in c:\program files (x86)\microsoft visual studio\shared\anaconda3_64\lib\site-packages (from IPython>=0.13->line_profiler) (4.3.2)
Requirement already satisfied: prompt_toolkit<2.0.0,>=1.0.4 in c:\program files (x86)\microsoft visual studio\shared\anaconda3_64\lib\site-packages (from IPython>=0.13->line_profiler) (1.0.15)
Requirement already satisfied: pygments in c:\program files (x86)\microsoft visual studio\shared\anaconda3_64\lib\site-packages (from IPython>=0.13->line_profiler) (2.2.0)
Requirement already satisfied: colorama in c:\program files (x86)\microsoft visual studio\shared\anaconda3_64\lib\site-packages (from IPython>=0.13->line_profiler) (0.3.9)
Requirement already satisfied: ipython_genutils in c:\program files (x86)\microsoft visual studio\shared\anaconda3_64\lib\site-packages (from traitlets>=4.2->IPython>=0.13->line_profiler) (0.2.0)
Requirement already satisfied: six in c:\program files (x86)\microsoft visual studio\shared\anaconda3_64\lib\site-packages (from traitlets>=4.2->IPython>=0.13->line_profiler) (1.10.0)
Requirement already satisfied: wcwidth in c:\program files (x86)\microsoft visual studio\shared\anaconda3_64\lib\site-packages (from prompt_toolkit<2.0.0,>=1.0.4->IPython>=0.13->line_profiler) (0.1.7)
Building wheels for collected packages: line-profiler
  Running setup.py bdist_wheel for line-profiler ... error
  Complete output from command "c:\program files (x86)\microsoft visual studio\shared\anaconda3_64\python.exe" -u -c "import setuptools, tokenize;__file__='C:\\Users\\dsandhu\\AppData\\Local\\Temp\\pip-install-0llx4z1k\\line-profiler\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d C:\Users\dsandhu\AppData\Local\Temp\pip-wheel-63ockg8z --python-tag cp36:
  running bdist_wheel
  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": http://landinghub.visualstudio.com/visual-cpp-build-tools

  ----------------------------------------
  Failed building wheel for line-profiler
  Running setup.py clean for line-profiler
Failed to build line-profiler
Installing collected packages: line-profiler
  Running setup.py install for line-profiler ... error
    Complete output from command "c:\program files (x86)\microsoft visual studio\shared\anaconda3_64\python.exe" -u -c "import setuptools, tokenize;__file__='C:\\Users\\dsandhu\\AppData\\Local\\Temp\\pip-install-0llx4z1k\\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\dsandhu\AppData\Local\Temp\pip-record-za9vqo8p\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": http://landinghub.visualstudio.com/visual-cpp-build-tools

    ----------------------------------------
Command ""c:\program files (x86)\microsoft visual studio\shared\anaconda3_64\python.exe" -u -c "import setuptools, tokenize;__file__='C:\\Users\\dsandhu\\AppData\\Local\\Temp\\pip-install-0llx4z1k\\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\dsandhu\AppData\Local\Temp\pip-record-za9vqo8p\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\dsandhu\AppData\Local\Temp\pip-install-0llx4z1k\line-profiler\
Deepak
  • 1,503
  • 3
  • 22
  • 45
  • Download Pycharm for the win – Swift Sep 12 '18 at 17:07
  • https://stackoverflow.com/search?q=%5Bpip%5D+error%3A+Microsoft+Visual+C%2B%2B+14.0+is+required – phd Sep 12 '18 at 18:20
  • also see: https://stackoverflow.com/questions/29846087/microsoft-visual-c-14-0-is-required-unable-to-find-vcvarsall-bat – Corey Goldberg Sep 12 '18 at 22:10
  • Vote to reopen. None of the linked answers include the use of the Conda repository (the most upvoted answer here), which was the best solution for this particular problem for me – Hobo Mar 08 '20 at 03:35

2 Answers2

12

You should install via the Conda repository.

conda install -c anaconda line_profiler 
eatmeimadanish
  • 3,809
  • 1
  • 14
  • 20
2

the error is pretty clear:

error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools

I assume you don't have Microsoft Visual C++ Build Tools installed.

(working link is: https://visualstudio.microsoft.com/visual-cpp-build-tools/ )

Corey Goldberg
  • 59,062
  • 28
  • 129
  • 143