spyder-ide / spyder

Official repository for Spyder - The Scientific Python Development Environment
https://www.spyder-ide.org
MIT License
8.28k stars 1.61k forks source link

Error when attempting to inspect array with special dtype #8676

Open apalom opened 5 years ago

apalom commented 5 years ago

Problem Description

What steps will reproduce the problem?

Created np.dtype, assigned np.dtype to array. Attempted to open array from variable explorer and got "Spyder has encountered an internal problem.

Traceback

  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\lib\site-packages\spyder\widgets\variableexplorer\collectionseditor.py", line 470, in createEditor
    if not editor.setup_and_check(value, title=key, readonly=readonly):
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\lib\site-packages\spyder\widgets\variableexplorer\arrayeditor.py", line 660, in setup_and_check
    readonly, xlabels, ylabels))
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\lib\site-packages\spyder\widgets\variableexplorer\arrayeditor.py", line 541, in __init__
    ylabels=ylabels, readonly=readonly, parent=self)
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\lib\site-packages\spyder\widgets\variableexplorer\arrayeditor.py", line 131, in __init__
    self.test_array = np.array([0], dtype=data.dtype)
ValueError: Converting an integer to a NumPy datetime requires a specified unit

Package Versions

Dependencies

pyflakes >=0.6.0 :  1.6.0 (OK)
pycodestyle >=2.3:  2.4.0 (OK)
pygments >=2.0   :  2.2.0 (OK)
pandas >=0.13.1  :  0.23.0 (OK)
numpy >=1.7      :  1.14.3 (OK)
sphinx >=0.6.6   :  1.7.4 (OK)
rope >=0.9.4     :  0.10.7 (OK)
jedi >=0.9.0     :  0.12.0 (OK)
nbconvert >=4.0  :  5.3.1 (OK)
sympy >=0.7.3    :  1.1.1 (OK)
cython >=0.21    :  0.28.2 (OK)
qtconsole >=4.2.0:  4.3.1 (OK)
IPython >=4.0    :  6.4.0 (OK)
pylint >=0.25    :  1.8.4 (OK)
ccordoba12 commented 5 years ago

I think it's not possible for Spyder to show an array in this case. So need to show a message about it.

lalita90 commented 5 years ago

Is this problem resolved? I am also facing the same issue. When I try to open an array the spyder shows the error that it has some internal issue. Could you please guide how to resolve it?

Hyypeer commented 5 years ago

Same problem here ... everything is up to date.. Is someone working on this problem ???

bcolsen commented 5 years ago

Giving a some code to reproduce the error would help.

lalita90 commented 5 years ago

spyder error My code runs fine but when I try to open array such as img_norm variable in this case, it shows this error and I can't see the values without printing the whole array.

bcolsen commented 5 years ago

@lalita90 What does it say in show details?

lalita90 commented 5 years ago

spyder error

bcolsen commented 5 years ago

@lalita90 You don't have this bug. You have #8582, which is fixed in 3.3.3. To fix it please upgrade to the latest version of Spyder by opening the Anaconda Prompt and typing:

conda update spyder
lalita90 commented 5 years ago

Thanks for referring me to #8582. I already updated everything but nothing worked out. Just had to downgrade my numpy version to 1.15.0. It may be useful for someone else in the future.