rkern / line_profiler

(OLD REPO) Line-by-line profiling for Python - Current repo ->
https://github.com/pyutils/line_profiler
Other
3.6k stars 256 forks source link

Failed to build line-profiler #168

Open zouyj0921 opened 4 years ago

zouyj0921 commented 4 years ago

pip install line-profiler --user failed . I've tried the solution #132 but not work. environment : ubuntu, python36, error details:

Requirement already satisfied: IPython>=0.13 in /home/zouyj/.local/lib/python3.6/site-packages (from line-profiler==2.1.1) (7.5.0) Requirement already satisfied: backcall in /home/zouyj/.local/lib/python3.6/site-packages (from IPython>=0.13->line-profiler==2.1.1) (0.1.0) Requirement already satisfied: traitlets>=4.2 in /home/zouyj/.local/lib/python3.6/site-packages (from IPython>=0.13->line-profiler==2.1.1) (4.3.2) Requirement already satisfied: pexpect; sys_platform != "win32" in /usr/lib/python3/dist-packages (from IPython>=0.13->line-profiler==2.1.1) (4.0.1) Requirement already satisfied: decorator in /usr/local/lib/python3.6/dist-packages (from IPython>=0.13->line-profiler==2.1.1) (4.4.0) Requirement already satisfied: prompt-toolkit<2.1.0,>=2.0.0 in /home/zouyj/.local/lib/python3.6/site-packages (from IPython>=0.13->line-profiler==2.1.1) (2.0.9) Requirement already satisfied: jedi>=0.10 in /home/zouyj/.local/lib/python3.6/site-packages (from IPython>=0.13->line-profiler==2.1.1) (0.13.3) Requirement already satisfied: pygments in /home/zouyj/.local/lib/python3.6/site-packages (from IPython>=0.13->line-profiler==2.1.1) (2.4.2) Requirement already satisfied: pickleshare in /home/zouyj/.local/lib/python3.6/site-packages (from IPython>=0.13->line-profiler==2.1.1) (0.7.5) Requirement already satisfied: setuptools>=18.5 in /home/zouyj/.local/lib/python3.6/site-packages (from IPython>=0.13->line-profiler==2.1.1) (41.4.0) Requirement already satisfied: six in /home/zouyj/.local/lib/python3.6/site-packages (from traitlets>=4.2->IPython>=0.13->line-profiler==2.1.1) (1.12.0) Requirement already satisfied: ipython-genutils in /home/zouyj/.local/lib/python3.6/site-packages (from traitlets>=4.2->IPython>=0.13->line-profiler==2.1.1) (0.2.0) Requirement already satisfied: wcwidth in /home/zouyj/.local/lib/python3.6/site-packages (from prompt-toolkit<2.1.0,>=2.0.0->IPython>=0.13->line-profiler==2.1.1) (0.1.7) Requirement already satisfied: parso>=0.3.0 in /home/zouyj/.local/lib/python3.6/site-packages (from jedi>=0.10->IPython>=0.13->line-profiler==2.1.1) (0.4.0) Building wheels for collected packages: line-profiler Building wheel for line-profiler (setup.py) ... error ERROR: Complete output from command /usr/bin/python3.6 -u -c 'import setuptools, tokenize;file='"'"'/tmp/pip-req-build-p1b24f_m/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 /tmp/pip-wheel-m38tdyar --python-tag cp36: ERROR: running bdist_wheel running build running build_py creating build creating build/lib.linux-x86_64-3.6 copying line_profiler.py -> build/lib.linux-x86_64-3.6 copying kernprof.py -> build/lib.linux-x86_64-3.6 copying line_profiler_py35.py -> build/lib.linux-x86_64-3.6 running build_ext skipping '_line_profiler.c' Cython extension (up-to-date) building '_line_profiler' extension creating build/temp.linux-x86_64-3.6 x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.6m -c _line_profiler.c -o build/temp.linux-x86_64-3.6/_line_profiler.o _line_profiler.c:4:20: fatal error: Python.h: No such file or directory compilation terminated. error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

ERROR: 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 ERROR: Complete output from command /usr/bin/python3.6 -u -c 'import setuptools, tokenize;file='"'"'/tmp/pip-req-build-p1b24f_m/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-7znj2mng/install-record.txt --single-version-externally-managed --compile --user --prefix=: ERROR: running install running build running build_py creating build creating build/lib.linux-x86_64-3.6 copying line_profiler.py -> build/lib.linux-x86_64-3.6 copying kernprof.py -> build/lib.linux-x86_64-3.6 copying line_profiler_py35.py -> build/lib.linux-x86_64-3.6 running build_ext skipping '_line_profiler.c' Cython extension (up-to-date) building '_line_profiler' extension creating build/temp.linux-x86_64-3.6 x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.6m -c _line_profiler.c -o build/temp.linux-x86_64-3.6/_line_profiler.o _line_profiler.c:4:20: fatal error: Python.h: No such file or directory compilation terminated. error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

ERROR: Command "/usr/bin/python3.6 -u -c 'import setuptools, tokenize;file='"'"'/tmp/pip-req-build-p1b24f_m/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-7znj2mng/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-req-build-p1b24f_m/

codeslord commented 4 years ago

Try this

git clone https://github.com/rkern/line_profiler.git
cd line_profiler
cython _line_profiler.pyx
pip install . --user

You might get a FutureWarning, ignore that as of now.