Open matjojo opened 5 years ago
same here
update: although i got the same error as you, i used the fix in #132 and things worked out
looks like you're not in the right directory when you run cython (and there is only a single file necessary to be computed).
this worked for me: C:\tmnpo\line_profiler>cython _line_profiler.pyx
With @choosehappy 's thought I was able to get this to work. The solution (for windows) is this.
open git-bash in the folder you want line_profiler to copy to.
pip install cython
git clone https://github.com/rkern/line_profiler.git
got into the newly cloned folder
cython line_profiler
pip install . --user
It's a combination of both methods, and pip successfully installed line_profiler with this.
matth@DESKTOP-JOODKLV MINGW64 /c/Programming/pipinstalltryout/line_profiler (master)
$ pip install . --user
Processing c:\programming\pipinstalltryout\line_profiler
Requirement already satisfied: IPython>=0.13 in c:\program files\python37\lib\site-packages (from line-profiler==2.1.1) (6.5.0)
Requirement already satisfied: simplegeneric>0.8 in c:\program files\python37\lib\site-packages (from IPython>=0.13->line-profiler==2.1.1) (0.8.1)
Requirement already satisfied: setuptools>=18.5 in c:\program files\python37\lib\site-packages (from IPython>=0.13->line-profiler==2.1.1) (39.0.1)
Requirement already satisfied: pickleshare in c:\program files\python37\lib\site-packages (from IPython>=0.13->line-profiler==2.1.1) (0.7.4)
Requirement already satisfied: traitlets>=4.2 in c:\program files\python37\lib\site-packages (from IPython>=0.13->line-profiler==2.1.1) (4.3.2)
Requirement already satisfied: colorama; sys_platform == "win32" in c:\program files\python37\lib\site-packages (from IPython>=0.13->line-profiler==2.1.1) (0.3.9)
Requirement already satisfied: backcall in c:\program files\python37\lib\site-packages (from IPython>=0.13->line-profiler==2.1.1) (0.1.0)
Requirement already satisfied: decorator in c:\program files\python37\lib\site-packages (from IPython>=0.13->line-profiler==2.1.1) (4.3.0)
Requirement already satisfied: pygments in c:\program files\python37\lib\site-packages (from IPython>=0.13->line-profiler==2.1.1) (2.2.0)
Requirement already satisfied: prompt-toolkit<2.0.0,>=1.0.15 in c:\program files\python37\lib\site-packages (from IPython>=0.13->line-profiler==2.1.1) (1.0.15)
Requirement already satisfied: jedi>=0.10 in c:\program files\python37\lib\site-packages (from IPython>=0.13->line-profiler==2.1.1) (0.12.1)
Requirement already satisfied: six in c:\program files\python37\lib\site-packages (from traitlets>=4.2->IPython>=0.13->line-profiler==2.1.1) (1.11.0)
Requirement already satisfied: ipython-genutils in c:\program files\python37\lib\site-packages (from traitlets>=4.2->IPython>=0.13->line-profiler==2.1.1) (0.2.0)
Requirement already satisfied: wcwidth in c:\program files\python37\lib\site-packages (from prompt-toolkit<2.0.0,>=1.0.15->IPython>=0.13->line-profiler==2.1.1) (0.1.7)
Requirement already satisfied: parso>=0.3.0 in c:\program files\python37\lib\site-packages (from jedi>=0.10->IPython>=0.13->line-profiler==2.1.1) (0.3.1)
Installing collected packages: line-profiler
Running setup.py install for line-profiler: started
Running setup.py install for line-profiler: finished with status 'done'
Successfully installed line-profiler-2.1.1
matth@DESKTOP-JOODKLV MINGW64 /c/Programming/pipinstalltryout/line_profiler (master)
$
The only problem is that I can't just call kernprof -l file.py
now, since the kernprof.py file has not been added to the PATH environment variable. calling C:\path\to\file\kernprof.py does work, but it's a bit awkward. Leaving this issue open since the fix is not a pretty workaround and it doesn't get added to the path
@matjojo's solution also works for mac. Many thanks!
With @choosehappy 's thought I was able to get this to work. The solution (for windows) is this.
open git-bash in the folder you want line_profiler to copy to. pip install cython git clone https://github.com/rkern/line_profiler.git got into the newly cloned folder cython line_profiler pip install . --user
It's a combination of both methods, and pip successfully installed line_profiler with this.
matth@DESKTOP-JOODKLV MINGW64 /c/Programming/pipinstalltryout/line_profiler (master) $ pip install . --user Processing c:\programming\pipinstalltryout\line_profiler Requirement already satisfied: IPython>=0.13 in c:\program files\python37\lib\site-packages (from line-profiler==2.1.1) (6.5.0) Requirement already satisfied: simplegeneric>0.8 in c:\program files\python37\lib\site-packages (from IPython>=0.13->line-profiler==2.1.1) (0.8.1) Requirement already satisfied: setuptools>=18.5 in c:\program files\python37\lib\site-packages (from IPython>=0.13->line-profiler==2.1.1) (39.0.1) Requirement already satisfied: pickleshare in c:\program files\python37\lib\site-packages (from IPython>=0.13->line-profiler==2.1.1) (0.7.4) Requirement already satisfied: traitlets>=4.2 in c:\program files\python37\lib\site-packages (from IPython>=0.13->line-profiler==2.1.1) (4.3.2) Requirement already satisfied: colorama; sys_platform == "win32" in c:\program files\python37\lib\site-packages (from IPython>=0.13->line-profiler==2.1.1) (0.3.9) Requirement already satisfied: backcall in c:\program files\python37\lib\site-packages (from IPython>=0.13->line-profiler==2.1.1) (0.1.0) Requirement already satisfied: decorator in c:\program files\python37\lib\site-packages (from IPython>=0.13->line-profiler==2.1.1) (4.3.0) Requirement already satisfied: pygments in c:\program files\python37\lib\site-packages (from IPython>=0.13->line-profiler==2.1.1) (2.2.0) Requirement already satisfied: prompt-toolkit<2.0.0,>=1.0.15 in c:\program files\python37\lib\site-packages (from IPython>=0.13->line-profiler==2.1.1) (1.0.15) Requirement already satisfied: jedi>=0.10 in c:\program files\python37\lib\site-packages (from IPython>=0.13->line-profiler==2.1.1) (0.12.1) Requirement already satisfied: six in c:\program files\python37\lib\site-packages (from traitlets>=4.2->IPython>=0.13->line-profiler==2.1.1) (1.11.0) Requirement already satisfied: ipython-genutils in c:\program files\python37\lib\site-packages (from traitlets>=4.2->IPython>=0.13->line-profiler==2.1.1) (0.2.0) Requirement already satisfied: wcwidth in c:\program files\python37\lib\site-packages (from prompt-toolkit<2.0.0,>=1.0.15->IPython>=0.13->line-profiler==2.1.1) (0.1.7) Requirement already satisfied: parso>=0.3.0 in c:\program files\python37\lib\site-packages (from jedi>=0.10->IPython>=0.13->line-profiler==2.1.1) (0.3.1) Installing collected packages: line-profiler Running setup.py install for line-profiler: started Running setup.py install for line-profiler: finished with status 'done' Successfully installed line-profiler-2.1.1 matth@DESKTOP-JOODKLV MINGW64 /c/Programming/pipinstalltryout/line_profiler (master) $
The only problem is that I can't just call
kernprof -l file.py
now, since the kernprof.py file has not been added to the PATH environment variable. calling C:\path\to\file\kernprof.py does work, but it's a bit awkward. Leaving this issue open since the fix is not a pretty workaround and it doesn't get added to the path
The following works:
python "C:/path/to/line_profiler/kernprof.py" -l -v script.py
On windows 10, python:
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] on win32
pip install gives:
(It says requirement already satisfied for all requirements because I already tried this before but I had to install vs build tools. Thus it had already installed all the requirements. ) I tried this https://github.com/rkern/line_profiler/issues/132#issuecomment-418913772 :
This fails with:
This last command made me feel like it failed already but I also executed the last command:
From https://github.com/rkern/line_profiler/issues/127#issuecomment-402837321 I tried:
it gives:
These two errors make it look like I need to install cython, but after
pip install cython
which returned succesfully:executing
pip install line_profiler
still fails with the same error as above.