Skip to content
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

Spyder encountered a problem when opening numpy array #8582

Closed
sayboltm opened this issue Jan 15, 2019 · 21 comments
Closed

Spyder encountered a problem when opening numpy array #8582

sayboltm opened this issue Jan 15, 2019 · 21 comments

Comments

@sayboltm
Copy link

Description

What steps will reproduce the problem?

build 120x12 array of float64

double click to open in variable explorer

Traceback

  File "C:\Users\CZ3QFP\miniconda2\envs\gmrpg_dev\lib\site-packages\spyder\widgets\variableexplorer\collectionseditor.py", line 482, in createEditor
    if not editor.setup_and_check(value, title=key, readonly=readonly):
  File "C:\Users\CZ3QFP\miniconda2\envs\gmrpg_dev\lib\site-packages\spyder\widgets\variableexplorer\arrayeditor.py", line 620, in setup_and_check
    self.data.flags.writeable = True
ValueError: cannot set WRITEABLE flag to True of this array

Versions

  • Spyder version: 3.3.2
  • Python version: 3.7.2
  • Qt version: 5.9.6
  • PyQt5 version: 5.9.2
  • Operating System: Windows 10

Dependencies

pyflakes >=0.6.0  :  2.0.0 (OK)
pycodestyle >=2.3 :  2.4.0 (OK)
pygments >=2.0    :  2.3.1 (OK)
sphinx >=0.6.6    :  1.8.2 (OK)
rope >=0.9.4      :  0.11.0 (OK)
jedi >=0.9.0      :  0.13.2 (OK)
nbconvert >=4.0   :  5.3.1 (OK)
pandas >=0.13.1   :  None (NOK)
numpy >=1.7       :  1.16.0rc2 (OK)
sympy >=0.7.3     :  None (NOK)
cython >=0.21     :  None (NOK)
qtconsole >=4.2.0 :  4.4.3 (OK)
IPython >=4.0     :  7.2.0 (OK)
matplotlib >=2.0.0:  3.0.2 (OK)
pylint >=0.25     :  2.2.2 (OK)
@sayboltm
Copy link
Author

sayboltm commented Jan 15, 2019

I can post the array if needed. If desired, what format do you guys want? There is nothing special about it, just a 120x12 numpy arrray. each float64 is 4 decimal places, no extended precision weird stuff or anything like that.

tried restarting spyder, same non-special array opens fine in spyder 2.3.8, which seems to have the most stable variable explorer (loads properly, updates values properly etc), but this version has issues I have mostly worked around regarding per-file run settings.

@ccordoba12
Copy link
Member

If desired, what format do you guys want?

Please post the command you're using to generate it.

@sayboltm
Copy link
Author

it is captured data, that's why I asked if you'd like me to post it. but there's nothing special, it was imported from a tdms file but printing it in the ipython window works just fine, it seems valid.

@ccordoba12
Copy link
Member

Then an npz file should be enough.

@sayboltm
Copy link
Author

Alright, it's attached as a zip because GH got mad at npz. Rename 'zip' to 'npz' then open with np.load (as I'm sure you're aware)

I opened with np.load, and verified the incoming array also produces the same issue when double clicking in the variable explorer. Like I said, nothing is special about it. If you find this to be not true, please let me know.. I'm curious! Thanks for helping make spyder better.

issue_array.zip

@ccordoba12 ccordoba12 changed the title Spyder encounters a problem when opening numpy array Spyder encountered a problem when opening numpy array Jan 16, 2019
@ccordoba12 ccordoba12 modified the milestones: important, v3.3.3 Jan 16, 2019
@ccordoba12
Copy link
Member

Thanks for your help!

@sayboltm
Copy link
Author

No problem, thanks for supporting. This piece of software made it easy for me to leave Matlab in the dust, eventually leading me to use Git and properly version control my Python code and older C# projects, and taught me how to bug report. So I am happy to help you out with at least decent bug reports :D

@meteorolog90
Copy link

Is this problem fixed ?

@ccordoba12
Copy link
Member

No, it hasn't.

@bcolsen
Copy link
Member

bcolsen commented Jan 22, 2019

This is popping up a lot lately. Is this bug related to #6213 as well?

@ccordoba12
Copy link
Member

I think this is caused by the new Numpy 1.16. That should be why we're getting so much reports about this problem lately.

@sayboltm
Copy link
Author

sayboltm commented Jan 23, 2019

I'm not sure what goes on under the hood, but I have not found the variable explorer to be 100% reliable since spyder 2.3.8, but 2.3.8 chokes up on spaces in the path for per-file input args which is so 90's. It wouldn't always update the values after a run. The issue not updating values was not reproduceable enough for me to report. Now with it not opening at all, AND it putting a nice template right in front of my face I couldn't not report. The variable explorer is probably my favorite feature of Spyder, seems like it needs to be made more robust (probably easier said than done). Wish I could help more, please let me know if I can provide anything else.

@CAM-Gerlach
Copy link
Member

CAM-Gerlach commented Jan 23, 2019

spyder 2.3.8

@sayboltm The Variable Explorer in 2.3.8 only supported a limited set of types, while in recent 3.2.x versions it can now (theoretically, issues like this aside) display almost all types, which results in many more edge/corner cases that need to be accounted for. We're working to improve this further for Spyder 4, including a dedicated arbitrary object viewer and support for Numpy object types.

@ccordoba12 According to numpy/numpy#12791 , setting the flag manually is a dangerous practice and accordingly has been removed in 1.16, and if we've made a copy of the original array (which should always be the case, AFAIK) it should be writable already in any modern Numpy version. If its not for some very special-case reason, we shouldn't try to modify it, so we should set readonly = True to prevent this.

Should I go ahead and implement this accordingly? Although its not a clean merge, should we consider including this in 3.3.3, since as people start upgrading to Numpy 1.16 en masse we're going to get a flood of reports and it will completely break viewing/editing any arrays in the Variable Explorer?

@ghost
Copy link

ghost commented Apr 20, 2019

Was this issue resolved ?

@CAM-Gerlach
Copy link
Member

@NaderNazemi Yes, as you can see by the fact that it is closed, it is marked with the milestone of a released Spyder version (3.3.3) and is addressed in the linked PR, #8632 .

@Li-Shu14
Copy link

Spyder 3.3.3 working on a Windows Server 2019 ( which is very similar to win10) still suffers from this problem. I can solve it by downgrade numpy to 14.0. However, some other packages rely on numpy 16.0, so my solution is transfering the numpy array to pandas.DataFrame then I can view this matrice...

@CAM-Gerlach
Copy link
Member

CAM-Gerlach commented Nov 27, 2020

@Li-Shu14 Hey, Spyder 3.3.3 is almost two years old and is no longer supported, the current version being 4.2.0. Can you verify if this problem still occurs with 4.2.0 and a supported release of Numpy 1.16+? Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants