spyder-ide / spyder

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

Can't view objects in object explorer, when using spyder installer with custom python interpreter #17065

Closed Hawxxer closed 2 years ago

Hawxxer commented 2 years ago

Issue Report Checklist

Problem Description

When trying to open an object I defined myself with, I get this error image

While it says, don't report this to github, I think it is a problem with Spyder itself because I don't encounter this problem when using a Spyder version that is installed in a conda env.

Maybe the current spyder-kernels from conda-forge is not compatible with the current spyder installer? When I use the default python interpreter the problem below does not occur, the object is viewable in the Object Explorer

What steps reproduce the problem?

  1. Install Spyder for Windows from Spyder Website (The Installer one)
  2. setup environment with conda, installing latest spyder-kernels 2.2.0 from conda-forge channel and activate it in Spyder as custom interpreter
  3. run code
    
    class test:
    def __init__(self, x):
        self.x = x

myclass = test(2)

4. Double Click variable myclass in variable explorer

### What is the expected output? What do you see instead?
Object Explorer should open to view the object, instead it shows the error message above

## Versions
<!--- You can get this information from Help > About Spyder...
or (if Spyder won't launch) the "conda list" command
from the Anaconda Prompt/Terminal/command line. --->

* Spyder version: 5.2.1 None
* Python version: 3.7.9 64-bit
* Qt version: 5.12.10
* PyQt5 version: 5.12.3
* Operating System: Windows 10

It's Windows 11, but it says Windows 10 in Spyder about section, maybe also a bug to fix? (I know Windows 11 is Windows 10 with updates)

### Dependencies
<!--- Please go to the menu entry Help > Dependencies,
press the Copy to clipboard button and paste below --->

Mandatory:

atomicwrites >=1.2.0 : 1.4.0 (OK) chardet >=2.0.0 : 4.0.0 (OK) cloudpickle >=0.5.0 : 2.0.0 (OK) cookiecutter >=1.6.0 : 1.7.3 (OK) diff_match_patch >=20181111 : 20200713 (OK) intervaltree : None (OK) IPython >=7.6.0 : 7.30.1 (OK) jedi >=0.17.2;<0.19.0 : 0.18.1 (OK) jellyfish >=0.7 : 0.8.9 (OK) jsonschema >=3.2.0 : 4.2.1 (OK) keyring >=17.0.0 : 23.4.0 (OK) nbconvert >=4.0 : 6.3.0 (OK) numpydoc >=0.6.0 : 1.1.0 (OK) paramiko >=2.4.0 : 2.8.1 (OK) parso >=0.7.0;<0.9.0 : 0.8.3 (OK) pexpect >=4.4.0 : 4.8.0 (OK) pickleshare >=0.4 : 0.7.5 (OK) psutil >=5.3 : 5.8.0 (OK) pygments >=2.0 : 2.10.0 (OK) pylint >=2.5.0 : 2.12.2 (OK) pyls_spyder >=0.4.0 : 0.4.0 (OK) pylsp >=1.3.2;<1.4.0 : 1.3.3 (OK) pylsp_black >=1.0.0 : 1.0.1 (OK) qdarkstyle =3.0.2 : 3.0.2 (OK) qstylizer >=0.1.10 : 0.2.1 (OK) qtawesome >=1.0.2 : 1.1.1 (OK) qtconsole >=5.2.1;<5.3.0 : 5.2.2 (OK) qtpy >=1.5.0 : 1.11.3 (OK) rtree >=0.9.7 : 0.9.7 (OK) setuptools >=49.6.0 : 59.6.0 (OK) sphinx >=0.6.6 : 4.3.1 (OK) spyder_kernels >=2.2.0;<2.3.0 : 2.2.0 (OK) textdistance >=4.2.0 : 4.2.2 (OK) three_merge >=0.1.1 : 0.1.1 (OK) watchdog : 2.1.6 (OK) zmq >=17 : 22.3.0 (OK)

Optional:

cython >=0.21 : 0.29.25 (OK) matplotlib >=2.0.0 : 3.5.1 (OK) numpy >=1.7 : 1.19.3 (OK) pandas >=1.1.1 : 1.3.5 (OK) scipy >=0.17.0 : 1.7.3 (OK) sympy >=0.7.3 : 1.9 (OK)

Hawxxer commented 2 years ago

Maybe adding to this, if the class do not have any methods (is it called methods in python? I mean functions in classes) only variables I can open the object in Object Explorer. Example Code:

class test:
    x = 2

myclass = test()

--EDIT--

Is viewing other objects than the supported objects like numpy, pandas and so generally not supported? If I try

import numpy as np
class test:
    x = np.array([1,2])

myclass = test()

I can't look at the object either with installer or installed via conda like stated above

image

Also there is no error message in the normal / internal console

--Edit2-- Maybe related to this Issue

dalthviz commented 2 years ago

Hi @Hawxxer thank you for your feedback! I was unable to reproduce this on Windows 10. In my case this is what I'm seeing:

imagen

Also, did you update from a previous installer version without uninstalling the previous one first? Could be possible for you to uninstall the current version of the standalone Spyder you have and install Spyder again?

Any new info in order to reproduce this is greatly appreciated. Let us know!

Hawxxer commented 2 years ago

Yes, this could have been the problem, after reinstalling spyder (installer) and miniconda it's working fine.

roteiro commented 2 years ago

@dalthviz @Hawxxer I'm experiencing the same bug with Spyder 5.2.2 (and also older versions like 5.1.5 and 5.05) on Win10. It used to work before as shown in https://github.com/spyder-ide/spyder/issues/17065#issuecomment-999647905 I already tried uninstalling previous versions and reinstalling Spyder 5.2.2, did not help. I'd like to avoid reinstalling miniconda and all my environments, therefore any idea what's the root of this issue would be greatly appreciated.

dalthviz commented 2 years ago

Hi @roteiro, is this happening only with a specific custom interpreter env in your setup or with all the envs? Could you try to create a new env to test if the custom interpreter continues raising the error message when using the object explorer? Also, do you have some example code that triggers this for you or the original one posted here also triggers the error message dialog in your case?

Let us know!

roteiro commented 2 years ago

Hi @dalthviz, thanks for the quick reply. Here is my setup, example code and results from my tests.

Setup

Spyder Version: 5.2.2 (current Windows installer)

Dependencies ## Mandatory: atomicwrites >=1.2.0 : 1.4.0 (OK) chardet >=2.0.0 : 4.0.0 (OK) cloudpickle >=0.5.0 : 2.0.0 (OK) cookiecutter >=1.6.0 : 1.7.3 (OK) diff_match_patch >=20181111 : 20200713 (OK) intervaltree : None (OK) IPython >=7.6.0;<8.0.0 : 7.31.1 (OK) jedi >=0.17.2;<0.19.0 : 0.18.1 (OK) jellyfish >=0.7 : 0.9.0 (OK) jsonschema >=3.2.0 : 4.4.0 (OK) keyring >=17.0.0 : 23.5.0 (OK) nbconvert >=4.0 : 6.4.0 (OK) numpydoc >=0.6.0 : 1.1.0 (OK) paramiko >=2.4.0 : 2.9.2 (OK) parso >=0.7.0;<0.9.0 : 0.8.3 (OK) pexpect >=4.4.0 : 4.8.0 (OK) pickleshare >=0.4 : 0.7.5 (OK) psutil >=5.3 : 5.9.0 (OK) pygments >=2.0 : 2.11.2 (OK) pylint >=2.5.0 : 2.12.2 (OK) pyls_spyder >=0.4.0 : 0.4.0 (OK) pylsp >=1.3.2;<1.4.0 : 1.3.3 (OK) pylsp_black >=1.0.0 : 1.0.1 (OK) qdarkstyle =3.0.2 : 3.0.2 (OK) qstylizer >=0.1.10 : 0.2.1 (OK) qtawesome >=1.0.2 : 1.1.1 (OK) qtconsole >=5.2.1;<5.3.0 : 5.2.2 (OK) qtpy >=1.5.0 : 2.0.0 (OK) rtree >=0.9.7 : 0.9.7 (OK) setuptools >=49.6.0 : 60.5.0 (OK) sphinx >=0.6.6 : 4.3.2 (OK) spyder_kernels >=2.2.1;<2.3.0 : 2.2.1 (OK) textdistance >=4.2.0 : 4.2.2 (OK) three_merge >=0.1.1 : 0.1.1 (OK) watchdog : 2.1.6 (OK) zmq >=17 : 22.3.0 (OK) ## Optional: cython >=0.21 : 0.29.26 (OK) matplotlib >=2.0.0 : 3.5.1 (OK) numpy >=1.7 : 1.19.3 (OK) pandas >=1.1.1 : 1.3.5 (OK) scipy >=0.17.0 : 1.7.3 (OK) sympy >=0.7.3 : 1.9 (OK)
My env ## Creation ``` conda create -n test_env_5.2.2_acoustics python=3.7 spyder-kernels=2.2.1 numpy matplotlib scipy blas=*=openblas pandas tabulate conda activate test_env_5.2.2_acoustics pip install acoustics ``` ## Info ``` ❯ conda list # packages in environment at D:\Programme\miniconda3\envs\test_env_5.2.2_acoustics: # # Name Version Build Channel acoustics 0.2.4.post0 pypi_0 pypi backcall 0.2.0 pyh9f0ad1d_0 / backports 1.0 py_2 / backports.functools_lru_cache 1.6.4 pyhd8ed1ab_0 / blas 2.113 openblas / blas-devel 3.9.0 13_win64_openblas / brotli 1.0.9 h8ffe710_6 / brotli-bin 1.0.9 h8ffe710_6 / ca-certificates 2021.10.8 h5b45459_0 / certifi 2021.10.8 py37h03978a9_1 / cloudpickle 2.0.0 pyhd8ed1ab_0 / colorama 0.4.4 pyh9f0ad1d_0 / cycler 0.11.0 pyhd8ed1ab_0 / debugpy 1.5.1 py37hf2a7229_0 / decorator 5.1.1 pyhd8ed1ab_0 / entrypoints 0.3 pyhd8ed1ab_1003 / fonttools 4.29.0 py37hcc03f2d_0 / freetype 2.10.4 h546665d_1 / icu 68.2 h0e60522_0 / ipykernel 6.7.0 py37h4038f58_0 / ipython 7.31.1 py37h03978a9_0 / jbig 2.1 h8d14728_2003 / jedi 0.18.1 py37h03978a9_0 / jpeg 9e h8ffe710_0 / jupyter_client 7.1.2 pyhd8ed1ab_0 / jupyter_core 4.9.1 py37h03978a9_1 / kiwisolver 1.3.2 py37h8c56517_1 / lcms2 2.12 h2a16943_0 / lerc 3.0 h0e60522_0 / libblas 3.9.0 13_win64_openblas / libbrotlicommon 1.0.9 h8ffe710_6 / libbrotlidec 1.0.9 h8ffe710_6 / libbrotlienc 1.0.9 h8ffe710_6 / libcblas 3.9.0 13_win64_openblas / libclang 11.1.0 default_h5c34c98_1 / libdeflate 1.8 h8ffe710_0 / libflang 5.0.0 h6538335_20180525 / liblapack 3.9.0 13_win64_openblas / liblapacke 3.9.0 13_win64_openblas / libopenblas 0.3.18 pthreads_hc469a61_0 / libpng 1.6.37 h1d00b33_2 / libsodium 1.0.18 h8d14728_1 / libtiff 4.3.0 hd413186_2 / libzlib 1.2.11 h8ffe710_1013 / llvm-meta 5.0.0 0 / lz4-c 1.9.3 h8ffe710_1 / m2w64-gcc-libgfortran 5.3.0 6 / m2w64-gcc-libs 5.3.0 7 / m2w64-gcc-libs-core 5.3.0 7 / m2w64-gmp 6.1.0 2 / m2w64-libwinpthread-git 5.0.0.4634.697f757 2 / matplotlib 3.5.1 py37h03978a9_0 / matplotlib-base 3.5.1 py37h4a79c79_0 / matplotlib-inline 0.1.3 pyhd8ed1ab_0 / msys2-conda-epoch 20160418 1 / munkres 1.1.4 pyh9f0ad1d_0 / nest-asyncio 1.5.4 pyhd8ed1ab_0 / numpy 1.21.5 py37h5fa1a60_0 / olefile 0.46 pyh9f0ad1d_1 / openblas 0.3.18 pthreads_h543f93c_0 / openjpeg 2.4.0 hb211442_1 / openmp 5.0.0 vc14_1 / openssl 1.1.1l h8ffe710_0 / packaging 21.3 pyhd8ed1ab_0 / pandas 1.3.5 py37h9386db6_0 / parso 0.8.3 pyhd8ed1ab_0 / pickleshare 0.7.5 py_1003 / pillow 8.4.0 py37hd7d9ad0_0 / pip 21.3.1 pyhd8ed1ab_0 / prompt-toolkit 3.0.24 pyha770c72_0 / pygments 2.11.2 pyhd8ed1ab_0 / pyparsing 3.0.7 pyhd8ed1ab_0 / pyqt 5.12.3 py37h03978a9_8 / pyqt-impl 5.12.3 py37hf2a7229_8 / pyqt5-sip 4.19.18 py37hf2a7229_8 / pyqtchart 5.12 py37hf2a7229_8 / pyqtwebengine 5.12.1 py37hf2a7229_8 / python 3.7.12 h7840368_100_cpython / python-dateutil 2.8.2 pyhd8ed1ab_0 / python_abi 3.7 2_cp37m / pytz 2021.3 pyhd8ed1ab_0 / pywin32 303 py37hcc03f2d_0 / pyzmq 22.3.0 py37hcce574b_1 / qt 5.12.9 h5909a2a_4 / scipy 1.7.3 py37hb6553fb_0 / setuptools 59.8.0 py37h03978a9_0 / six 1.16.0 pyh6c4a22f_0 / spyder-kernels 2.2.1 py37h03978a9_0 / sqlite 3.37.0 h8ffe710_0 / tabulate 0.8.9 pyhd8ed1ab_0 / tk 8.6.11 h8ffe710_1 / tornado 6.1 py37hcc03f2d_2 / traitlets 5.1.1 pyhd8ed1ab_0 / ucrt 10.0.20348.0 h57928b3_0 / unicodedata2 14.0.0 py37hcc03f2d_0 / vc 14.2 hb210afc_6 / vs2015_runtime 14.29.30037 h902a5da_6 / wcwidth 0.2.5 pyh9f0ad1d_2 / wheel 0.37.1 pyhd8ed1ab_0 / xz 5.2.5 h62dcd97_1 / zeromq 4.3.4 h0e60522_1 / zlib 1.2.11 h8ffe710_1013 / zstd 1.5.2 h6255e5f_0 / ```
My Code ```python import acoustics standard_object = [1, 2, 3] #displays correctly in variable explorer non_standard_object= acoustics.Signal(data=standard_object, fs=1) #does not display correctly in variable explorer ```

Results

image

dalthviz commented 2 years ago

@roteiro checking a little bit I'm getting a ModuleNotFoundError: No module named 'acoustics'. I think this is related with the unpickling done to get the variable value which fails since when trying to retrive the variable the Spyder installation needs the module associated with the variable (in this case acoustics). I'm not totally sure if we can do something about this or if there is already an issue regarding that, maybe we should improve the message being displayed in the dialog. Pinging @ccordoba12 just in case.

Hawxxer commented 2 years ago

Just want to add, that the issue occurred again for me i just gave up and lived with it. Maybe reinstall helps again. It occurres with the installer version under both windows 11 and MacOs Monterey with Spyder Version 5.2.2. I used the installer version, after a while I couldn't view panda Dataframes anymore, today I installed spyder via conda install -c conda-forge spyder (so I have the standalone installer and one version in a miniconda env parallel). Selecting the same custom python interpreter, the standalone can't show pandas, the conda env one can.

I add a comparison, left is standalone, right via miniconda. Will try to reinstall the standalone when I find time.

Bildschirmfoto 2022-02-04 um 18 45 17
dalthviz commented 2 years ago

Hi @Hawxxer I think the issue with pandas is related with the Python version that is being bundled with the installer (Python 3.7) which is incompatible with the pandas version in your custom interpreter env (pandas 1.4.0). So, I think most probably your issue is related with https://github.com/spyder-ide/spyder/issues/17253

Let us know if the info there helps!

lwbaqueros commented 2 years ago

I have a similar configuration: base environment with Spyder 5.1.5 and other environments with spypder-kernels 2.1.3. All environments with python 3.9.7. Spyder (using the Python interpreter from the working environment) could not retrieve the value of a pandas dataframe.

My working environment had pandas 1.4.1. When I downgraded it to version 1.3.5, the Spyder variable explorer worked again.