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
Variable Explorer & Numba - Unable to retrieve the values . . . #18821
Comments
Hi @Scoooooba thank you for the feedback! Since you are using the standalone installer most probably this is a duplicate of #18807 . The suggestion to workaround this is at #18807 (comment) or since you are using virtualenv basically creating a virtualenv where Spyder is installed along side Numba and other packages you want to use. Let us know if something of the above helps! |
For @mhofsaess who also posted here: we fixed the way Spyder handles PYTHONPATH in 5.3.2 because it was inconsistent and not entirely right. So to address your problem I think now you need to import your external PYTHONPATH to our manager. You can do that by clicking in the new |
Hi @ccordoba12 , as I wrote in the previous post, I added the path to the PYTHONPATH. I have been doing this since I started using Spyder (version 2.x or so) via the PYTHONPATH manager. I use the pip version under linux and as said with SPYDER 5.3.1 the display of the OBJECT in the variable manager works, after update to 5.3.2 unfortunately no longer. I did not change anything in the configuration, the PATH is also correct in the PYTHONPATH. I started spyder in debug mode and import my user defined class.
In the variable explorer the variable [DEBUG] [spyder_kernels.comms.commbase] -> Exception in cloudpickle.loads : No module named 'IO' I hope this helps. |
Hi dalthviz, thanks for your answer! I tried your suggestions and can confirm that it works fine in two different ways:
Both ways there is no longer an error message using the example of my initial post. Unfortunately I still get an error using the more complex classes I mentioned in my initial post, but I have not yet been able to reduce it to a simple example. It is like I have a module "SomeModule" with a class "SomeClass", and having the path of "SomeModule" in the PYTHONPATH. If I write in the console:
and then double click on Until then I thank your for your previous answer, solving at least the first problem. Edit: This raises an other question:
|
@mhofsaess, you said:
This means that the kernel is not loading PYTHONPATH correctly. @mrclary, this looks like a regression of a long-standing behavior. Could you take a look at it? |
@Scoooooba, you said:
Yes, please take a look at the
Pip creates an executable called |
The new behavior for PYTHONPATH Manager is that these paths only apply to the IPython Console environment, not to Spyder's runtime environment. This provides a type of firewall between Spyder's runtime environment and the user's own development environment and is important to prevent user's from accidentally breaking Spyder. For the same reason, the user's system This issue also manifests in the difference between our "Lite" and "Full" versions of the Spyder installer for macOS and Windows: objects for numpy, matplotlib, pandas, etc. cannot be double-clicked in the Variable Explorer if those packages are not installed in Spyder's runtime environment ("Full" version). I've been exploring some ideas to resolve this issue as well as make Variable Explorer more flexible, but in the short term I don't think there is an easy fix, sorry. |
Just in case, maybe this could be interesting for the limitation of serialization/deserialization in the Variable Explorer?: cloudpipe/cloudpickle#417 and https://github.com/cloudpipe/cloudpickle#overriding-pickles-serialization-mechanism-for-importable-constructs with |
Thank you! |
Hi @mrclary , |
Variables will still be displayed, but they may not be able to be inspected (double-clicked in the Variable Explorer). I cannot make any promises as to when this will be resolved, but we are investigating possible solutions. We agree that this functionality of the Variable Explorer is important and appreciate your patience. |
Hey Guys, Please note, that in the IPython Console everything works fine and changes to the class are always correctly applied. But as far as I understood, the IPython console and Spyders internally used representation of classes are two different things. Edit:
So far regarding the refreshing of the representation of the class in Spyder. By the way, the problematic change mentioned is editing the |
@Scoooooba, can you post a minimum working example that reproduces the behavior? If we can properly identify the underlying issue, then we may be able to create a fix; maybe a cache refresh or reloading the IPython namespace, or something. |
Sorry, yes of course!
File
Working directory is the one, where both files are in. Steps to reproduce:
Also, when the Variable Explorer is not working as it should, the "loading circle" is spinning forever, like mhofsaess mentioned in his first post. Versions:
Dependencies:
|
@Scoooooba, I can reproduce your issue. We do not implement a caching system for the variable explorer. However, this is what is happening:
We are currently looking into features of
>>> import sys
>>> sys.modules.pop('Testclass')
You can repeat the process after changing back This is not a practical work-around, by an means, but merely illustrates the mechanisms at play. This is Python's standard treatment of imported modules: if it already exists in @ccordoba12 @dalthviz, as we endeavor to improve Variable Explorer, perhaps we should also consider leveraging or replicating the User Module Reloader for use with the Variable Explorer. |
Ok, that sounds like a very interesting idea. For that I think we should simply import and run our UMR before users try to open a variable in the Variable Explorer. However, given that that could impact Spyder's stability (I don't know how it could affect the running application under all possible circumstances), I think we should leave it for Spyder 6. |
@mrclary, @ccordoba12, thanks for the explaination and outview |
Issue Report Checklist
conda update spyder
(orpip
, if not using Anaconda)jupyter qtconsole
(if console-related)spyder --reset
Problem Description
Hi Guys,
using a numba-jit function inside a class method causes the "Spyder was unable to retrieve the value of this variable from the console. . . ." error when trying to view the class instance in the variable explorer.
What steps reproduce the problem?
Given the following code:
After executing this code (Run File), double clicking on
testclass_1
in the Variable Explorer will show the error.Additional info: The filepath is in the Pythonpath. Error confirmed on a second computer.
What is the expected output? What do you see instead?
I expect to see the class object information, like I see it when commenting out
a = nb_test(a) # COMMENT THIS OUT TO SHOW NO ERROR
. Instead I see the error.This error first occurred with an other, more complex class that I use in a project. But without making any changes, sometimes the error is shown and sometimes everything works fine. It's like chasing ghosts, I could not figure out what really is the problem. But it seems like it has something to do with the numba function, that is used in one of the class methods, just like in the reduced example shown above. But that's also the reason why I report this, even though the error message told me not to do it. It seems odd, that sometimes it works, and sometimes not.
Paste Traceback/Error Below (if applicable)
None
Versions
Dependencies
PIP LIST
The text was updated successfully, but these errors were encountered: