Search code examples
pythonprofilingprofilerscalene

Unable to install python "Scalene" module


I'm trying to install Scalene module for profiling in Python.

I've tried two ways so far pip install scalene and pip install -U scalene but both gives me the following error:

Running setup.py install for scalene ... error
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\deepanshu\appdata\local\programs\python\python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\DEEPAN~1\\AppData\\Local\\Temp\\pip-install-di4jsn85\\scalene\\setup.py'"'"'; __file__='"'"'C:\\Users\\DEEPAN~1\\AppData\\Local\\Temp\\pip-install-di4jsn85\\scalene\\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\DEEPAN~1\AppData\Local\Temp\pip-record-hs0b9thb\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\deepanshu\appdata\local\programs\python\python37\Include\scalene'
         cwd: C:\Users\DEEPAN~1\AppData\Local\Temp\pip-install-di4jsn85\scalene\
    Complete output (40 lines):
    WARNING: The wheel package is not available.
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.7
    creating build\lib.win-amd64-3.7\scalene
    copying scalene\adaptive.py -> build\lib.win-amd64-3.7\scalene
    copying scalene\leak_analysis.py -> build\lib.win-amd64-3.7\scalene
    copying scalene\replacement_exit.py -> build\lib.win-amd64-3.7\scalene
    copying scalene\replacement_fork.py -> build\lib.win-amd64-3.7\scalene
    copying scalene\replacement_lock.py -> build\lib.win-amd64-3.7\scalene
    copying scalene\replacement_pjoin.py -> build\lib.win-amd64-3.7\scalene
    copying scalene\replacement_poll_selector.py -> build\lib.win-amd64-3.7\scalene
    copying scalene\replacement_thread_join.py -> build\lib.win-amd64-3.7\scalene
    copying scalene\runningstats.py -> build\lib.win-amd64-3.7\scalene
    copying scalene\scalene_arguments.py -> build\lib.win-amd64-3.7\scalene
    copying scalene\scalene_magics.py -> build\lib.win-amd64-3.7\scalene
    copying scalene\scalene_output.py -> build\lib.win-amd64-3.7\scalene
    copying scalene\scalene_profiler.py -> build\lib.win-amd64-3.7\scalene
    copying scalene\scalene_statistics.py -> build\lib.win-amd64-3.7\scalene
    copying scalene\sparkline.py -> build\lib.win-amd64-3.7\scalene
    copying scalene\syntaxline.py -> build\lib.win-amd64-3.7\scalene
    copying scalene\__init__.py -> build\lib.win-amd64-3.7\scalene
    copying scalene\__main__.py -> build\lib.win-amd64-3.7\scalene
    running egg_info
    writing scalene.egg-info\PKG-INFO
    writing dependency_links to scalene.egg-info\dependency_links.txt
    writing entry points to scalene.egg-info\entry_points.txt
    writing requirements to scalene.egg-info\requires.txt
    writing top-level names to scalene.egg-info\top_level.txt
    reading manifest file 'scalene.egg-info\SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    writing manifest file 'scalene.egg-info\SOURCES.txt'
    copying scalene\libscalene.dylib -> build\lib.win-amd64-3.7\scalene
    copying scalene\libscalene.so -> build\lib.win-amd64-3.7\scalene
    copying scalene\scalene-usage.txt -> build\lib.win-amd64-3.7\scalene
    running build_ext
    building 'get_line_atomic' extension
    error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\deepanshu\appdata\local\programs\python\python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\DEEPAN~1\\AppData\\Local\\Temp\\pip-install-di4jsn85\\scalene\\setup.py'"'"'; __file__='"'"'C:\\Users\\DEEPAN~1\\AppData\\Local\\Temp\\pip-install-di4jsn85\\scalene\\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\DEEPAN~1\AppData\Local\Temp\pip-record-hs0b9thb\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\deepanshu\appdata\local\programs\python\python37\Include\scalene' Check the logs for full command output.

Please suggest a way to resolve this error.

I'm using python 3.7 on windows 10.


Solution

  • Try installing an older version: e.g. pip install scalene==0.9.16

    Though I'm not sure whether it supports Windows 10 or not