-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why Line Contents not being shown with line profiler? #152
Comments
Same issue, have you figured out the reason? |
Getting a MWE would go a long way towards fixing this. |
@Erotemic By MWE if you mean an example then I think I already gave one. Maybe, I can explain it. I have a very big code with many functions. At one such function say fn1, I use a line profiler command i.e. I had installed line profiler like 2-3 months ago and the same procedure of %lprun thing worked well. But now it is giving the error if I am running the program from the same directory as that of profiler. I am confused as I don't go and run the profiler separately, I only import it in my code and use it. I had also uninstalled and reinstalled the line profiler package but no use. Ask me if you need any more specific details. I would like to get this problem solved as I will be coding in the next months as well. |
@Jaya472 Your MWE isn't complete because I don't have the ipynb file you are referencing. Please upload an ipynb file that demonstrates this error (e.g. as a github gist). Even better you could specify a simple set of commands that lets someone reproduce it via: curl <url-of-your-notebook>
papermill notebook-name.ipynb output.ipynb e.g. like this: pip install papermill
curl https://raw.githubusercontent.com/Erotemic/xdoctest/main/testing/test_doctest_in_notebook.ipynb -o mwe.ipynb
papermill mwe.ipynb output.ipynb |
@Erotemic Oh ok. I never knew all this stuff. So, I now created a gist as you said and I am sharing the link here. I have created a small example to perform the sum of numbers and used the line profiler and showed the corresponding output. Hope this is enough or else let me know. https://gist.github.com/Jaya472/10805d3c20dea33908de372eee8d8e68 |
@Erotemic And as you said about ipynb file, I created a private repository with the same code as I have put in the gist and this is the link. Hope this is what you were intending. https://github.com/Jaya472/an-mwe-for-line-profiler-problem/blob/f7d7f8c467f152851ede4f105e0b9d2f3b80ccd8/mwe.ipynb |
@GoingMyWay Btw, as a workaround (for now) I have been able to solve the problem by running my code in Google Colab (the free version). Because as per the message by the compiler, it is a problem of some directory and installations. So I thought to do on google colab where it will take care of where to install line profiler and where to run the code. And it worked. @Erotemic But of course, I would like to solve the problem for my personal workstation instead of every time using Colab resources. So please let me know if you need any more information or if you want me to try any resolving steps. |
@Erotemic Yes, that's what I was thinking that maybe it will work on your computer with no problem. Because if it is the directory problem or installation path problem or whatever it is, it would have been specific to my computer. But it is also true both my laptop and computer were giving me the same problem. Maybe something somewhere changed in the Windows update or pip install paths or even the jupyter notebooks' storage locations that there was some mismatch with the profiler.py unable to find the script on its path and causing the error in question. Thanks for your help and for now, I will continue on google colab. |
I think it could have to do with this function in
Could you insert a breakpoint or a print statement to determine what the filename is and if it is missing a case on your machine? You can find the location line profiler is installed to via:
Just modify that file in an editor. I'm wondering if it is a backslash thing. |
Did anyone fine a workaround to this? Having this issue as well. |
After bisecting versions of I think the change is when long filename support was added to the temp paths: I'm not sure if the issue is in ipykernel or how line-profiler is using it, but hope this helps others. |
Does this issue still exist in the latest release? |
I run my .ipynb file in the OneDrive folder via Anaconda JupyterLab. I am using %lprun line profiler and everything except for the Line Contents are displayed with the following message. What might be the mistake? Please, anyone, suggest. I am struggling for 10 hours just on this one thing!
I realize now maybe it is some version problem but don't know what versions I should have to solve this since I had already uninstalled and reinstalled the line profiler.
My python -V gives 3.9.7
My ipython -V gives 8.2.0
line_profiler (i see two versions in Anaconda environment) 3.5.1 and 3.4.0
The text was updated successfully, but these errors were encountered: