gruns / icecream

🍦 Never use print() to debug again.
MIT License
8.67k stars 182 forks source link

ic| Error: Failed to access the underlying source code for analysis. #158

Open rafaelcesar0 opened 9 months ago

rafaelcesar0 commented 9 months ago

My first attempt with ice cream gave me this error. ic| Error: Failed to access the underlying source code for analysis. Was ic() invoked in a REPL (e.g. from the command line), a frozen application (e.g. packaged with PyInstaller), or did the underlying source code change during execution?

Some information that may be useful:

vindevoy commented 9 months ago

I confirm this error. I just created a new conda environment with Python 3.11 and I get this error. Works with 3.10.

I am running "current file" from PyCharm. But I have the same issue when running it through a "configuration" from PyCharm and from CLI (Dos terminal in my case)

primalkriek commented 9 months ago

hey, same here. freshly installed conda, python version 3.11.5 did a pip install icecream and running a basic .py file where I use ic() I get this error. same in Jupyter notebook (version 7)

I see that in a previous thread around 3.11 the same error is posted, there they ask for the version of executing, if I am not mistaken, the version is 0.8.3. that seems to be the latest

QinHuoBin commented 8 months ago

The simplest way to solve this problem is to execute pip install -U executing (fixed in python 3.11.4)

primalkriek commented 8 months ago

no that did not solve it, as stated previously, executing is installed, and as far as I can see, this is still 0.8.3.

QinHuoBin commented 8 months ago

no that did not solve it, as stated previously, executing is installed, and as far as I can see, this is still 0.8.3.

You can try pip install executing==2.0.0 According to my debugging results, it is precisely because the name of the python bytecode instruction has changed and executing has not adapted to this change that the icecream cannot obtain the source code.

primalkriek commented 8 months ago

hi, pretty strange, because the output is 'Requirement already satisfied: executing==2.0.0 in anaconda3/lib/python3.11/site-packages (2.0.0)' I remember reading it somewhere before, so I had already done it before, but by doing the implicit pip install -U executing

but now icecream works. so thank you for the