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

Impossible to load .spydata file #22972

Open
blancfrederic opened this issue Nov 13, 2024 · 3 comments · May be fixed by #23812
Open

Impossible to load .spydata file #22972

blancfrederic opened this issue Nov 13, 2024 · 3 comments · May be fixed by #23812

Comments

@blancfrederic
Copy link

Description

What steps will reproduce the problem?

Impossible to load a .spydata file

Exception in comms call load_data:

File "/Users/Fred/miniconda3/envs/py39/lib/python3.9/site-packages/spyder_kernels/comms/commbase.py", line 359, in _handle_remote_call
return_value = self._remote_callback(

File "/Users/Fred/miniconda3/envs/py39/lib/python3.9/site-packages/spyder_kernels/comms/frontendcomm.py", line 213, in _remote_callback
return super(FrontendComm, self)._remote_callback(

File "/Users/Fred/miniconda3/envs/py39/lib/python3.9/site-packages/spyder_kernels/comms/commbase.py", line 373, in _remote_callback
return self._remote_call_handlers[call_name](

File "/Users/Fred/miniconda3/envs/py39/lib/python3.9/site-packages/spyder_kernels/console/kernel.py", line 416, in load_data
data, error_message = load_func(filename)

File "/Users/Fred/miniconda3/envs/py39/lib/python3.9/site-packages/spyder_kernels/utils/iofuncs.py", line 408, in load_dictionary
data = pickle.loads(fdesc.read())

File "/Users/Fred/miniconda3/envs/py39/lib/python3.9/site-packages/matplotlib/cbook.py", line 213, in setstate
self._cid_gen = itertools.count(cid_count)

TypeError: a number is required

Traceback

  File "/Users/Fred/miniconda3/envs/py39/lib/python3.9/site-packages/spyder/plugins/variableexplorer/widgets/main_widget.py", line 154, in <lambda>
    triggered=lambda x: self.import_data(),
  File "/Users/Fred/miniconda3/envs/py39/lib/python3.9/site-packages/spyder/plugins/variableexplorer/widgets/main_widget.py", line 556, in import_data
    nsb.import_data(filenames=filenames)
  File "/Users/Fred/miniconda3/envs/py39/lib/python3.9/site-packages/spyder/plugins/variableexplorer/widgets/namespacebrowser.py", line 334, in import_data
    error_message = self.load_data(self.filename, extension)
  File "/Users/Fred/miniconda3/envs/py39/lib/python3.9/site-packages/spyder/plugins/variableexplorer/widgets/namespacebrowser.py", line 360, in load_data
    return self.shellwidget.call_kernel(
  File "/Users/Fred/miniconda3/envs/py39/lib/python3.9/site-packages/spyder_kernels/comms/commbase.py", line 611, in __call__
    return self._comms_wrapper._get_call_return_value(
  File "/Users/Fred/miniconda3/envs/py39/lib/python3.9/site-packages/spyder/plugins/ipythonconsole/comms/kernelcomm.py", line 171, in _get_call_return_value
    return super(KernelComm, self)._get_call_return_value(
  File "/Users/Fred/miniconda3/envs/py39/lib/python3.9/site-packages/spyder_kernels/comms/commbase.py", line 470, in _get_call_return_value
    return self._sync_error(return_value)
  File "/Users/Fred/miniconda3/envs/py39/lib/python3.9/site-packages/spyder_kernels/comms/commbase.py", line 530, in _sync_error
    error_wrapper.raise_error()
  File "/Users/Fred/miniconda3/envs/py39/lib/python3.9/site-packages/spyder_kernels/comms/commbase.py", line 135, in raise_error
    raise self.etype(self)
Error in sys.excepthook:
Traceback (most recent call last):
  File "/Users/Fred/miniconda3/envs/py39/lib/python3.9/site-packages/spyder_kernels/comms/commbase.py", line 172, in comm_excepthook
    value.args[0].print_error()
  File "/Users/Fred/miniconda3/envs/py39/lib/python3.9/site-packages/spyder_kernels/comms/commbase.py", line 153, in print_error
    for line in self.format_error():
  File "/Users/Fred/miniconda3/envs/py39/lib/python3.9/site-packages/spyder_kernels/comms/commbase.py", line 143, in format_error
    + traceback.format_list(self.tb)
  File "/Users/Fred/miniconda3/envs/py39/lib/python3.9/traceback.py", line 39, in format_list
    return StackSummary.from_list(extracted_list).format()
  File "/Users/Fred/miniconda3/envs/py39/lib/python3.9/traceback.py", line 380, in from_list
    for frame in a_list:
TypeError: 'NoneType' object is not iterable

Original exception was:
Traceback (most recent call last):
  File "/Users/Fred/miniconda3/envs/py39/lib/python3.9/site-packages/spyder/plugins/variableexplorer/widgets/main_widget.py", line 154, in <lambda>
    triggered=lambda x: self.import_data(),
  File "/Users/Fred/miniconda3/envs/py39/lib/python3.9/site-packages/spyder/plugins/variableexplorer/widgets/main_widget.py", line 556, in import_data
    nsb.import_data(filenames=filenames)
  File "/Users/Fred/miniconda3/envs/py39/lib/python3.9/site-packages/spyder/plugins/variableexplorer/widgets/namespacebrowser.py", line 334, in import_data
    error_message = self.load_data(self.filename, extension)
  File "/Users/Fred/miniconda3/envs/py39/lib/python3.9/site-packages/spyder/plugins/variableexplorer/widgets/namespacebrowser.py", line 360, in load_data
    return self.shellwidget.call_kernel(
  File "/Users/Fred/miniconda3/envs/py39/lib/python3.9/site-packages/spyder_kernels/comms/commbase.py", line 611, in __call__
    return self._comms_wrapper._get_call_return_value(
  File "/Users/Fred/miniconda3/envs/py39/lib/python3.9/site-packages/spyder/plugins/ipythonconsole/comms/kernelcomm.py", line 171, in _get_call_return_value
    return super(KernelComm, self)._get_call_return_value(
  File "/Users/Fred/miniconda3/envs/py39/lib/python3.9/site-packages/spyder_kernels/comms/commbase.py", line 470, in _get_call_return_value
    return self._sync_error(return_value)
  File "/Users/Fred/miniconda3/envs/py39/lib/python3.9/site-packages/spyder_kernels/comms/commbase.py", line 530, in _sync_error
    error_wrapper.raise_error()
  File "/Users/Fred/miniconda3/envs/py39/lib/python3.9/site-packages/spyder_kernels/comms/commbase.py", line 135, in raise_error
    raise self.etype(self)
TypeError: a number is required

Versions

  • Spyder version: 6.0.2 (conda)
  • Python version: 3.9.20 64-bit
  • Qt version: 5.15.8
  • PyQt5 version: 5.15.9
  • Operating System: macOS-14.5-arm64-arm-64bit

Dependencies

# Mandatory:
aiohttp >=3.9.3                  :  3.10.10 (OK)
applaunchservices >=0.3.0        :  0.3.0 (OK)
asyncssh >=2.14.0,<3.0.0         :  2.17.0 (OK)
atomicwrites >=1.2.0             :  1.4.1 (OK)
chardet >=2.0.0                  :  5.2.0 (OK)
cloudpickle >=0.5.0              :  3.1.0 (OK)
cookiecutter >=1.6.0             :  2.6.0 (OK)
diff_match_patch >=20181111      :  20230430 (OK)
github >=2.3.0                   :  2.4.0 (OK)
importlib_metadata >=4.6.0       :  8.5.0 (OK)
intervaltree >=3.0.2             :  3.1.0 (OK)
IPython >=8.13.0,<9.0.0,!=8.17.1 :  8.18.1 (OK)
jedi >=0.17.2,<0.20.0            :  0.19.1 (OK)
jellyfish >=0.7                  :  1.1.0 (OK)
jsonschema >=3.2.0               :  4.23.0 (OK)
keyring >=17.0.0                 :  25.4.1 (OK)
nbconvert >=4.0                  :  7.16.4 (OK)
numpydoc >=0.6.0                 :  1.8.0 (OK)
parso >=0.7.0,<0.9.0             :  0.8.4 (OK)
pexpect >=4.4.0                  :  4.9.0 (OK)
pickleshare >=0.4                :  0.7.5 (OK)
psutil >=5.3                     :  6.0.0 (OK)
pygments >=2.0                   :  2.18.0 (OK)
pylint >=3.1,<4                  :  3.3.1 (OK)
pylint_venv >=3.0.2              :  3.0.3 (OK)
pyls_spyder >=0.4.0              :  0.4.0 (OK)
pylsp >=1.12.0,<1.13.0           :  1.12.0 (OK)
pylsp_black >=2.0.0,<3.0.0       :  2.0.0 (OK)
pyuca >=1.2                      :  1.2 (OK)
qdarkstyle >=3.2.0,<3.3.0        :  3.2.3 (OK)
qstylizer >=0.2.2                :  0.2.3 (OK)
qtawesome >=1.3.1,<1.4.0         :  1.3.1 (OK)
qtconsole >=5.6.1,<5.7.0         :  5.6.1 (OK)
qtpy >=2.4.0                     :  2.4.1 (OK)
rtree >=0.9.7                    :  1.3.0 (OK)
setuptools >=49.6.0              :  75.1.0 (OK)
sphinx >=0.6.6                   :  7.4.7 (OK)
spyder_kernels >=3.0.1,<3.1.0    :  3.0.1 (OK)
superqt >=0.6.2,<1.0.0           :  0.6.7 (OK)
textdistance >=4.2.0             :  4.6.2 (OK)
three_merge >=0.1.1              :  0.1.1 (OK)
watchdog >=0.10.3                :  5.0.3 (OK)
yarl >=1.9.4                     :  1.15.3 (OK)
zmq >=24.0.0                     :  26.2.0 (OK)

# Optional:
cython >=0.21                    :  3.0.11 (OK)
matplotlib >=3.0.0               :  3.9.2 (OK)
numpy >=1.7                      :  1.23.5 (OK)
pandas >=1.1.1                   :  2.2.3 (OK)
scipy >=0.17.0                   :  1.13.1 (OK)
sympy >=0.7.3                    :  1.13.3 (OK)
@dalthviz
Copy link
Member

Hi @blancfrederic thank you for the report! I think this can happen if you try to load variables while your current setup has a different version of the packages used to create such variables 🤔

Some similar issues: https://github.com/spyder-ide/spyder/issues?q=is%3Aissue+TypeError%3A+a+number+is+required+is%3Aclosed

Also, maybe this kind of error should be catch and some sort of error dialog should be shown explaining what is happening when an error like this occurs @ccordoba12 ?

@blancfrederic
Copy link
Author

Thanks for your answer ... yes you're right. I succeed in loading the file in another conda env ...

@ccordoba12
Copy link
Member

Also, maybe this kind of error should be catch and some sort of error dialog should be shown explaining what is happening when an error like this occurs @ccordoba12?

That's a good idea. Perhaps we should catch any error when trying to load a spydata file and tell users what are the possible causes for it: missing packages in the Spyder env, different Python versions or incompatible package versions (e.g. Numpy 1 vs. 2). I can't think of any other possible cause.

@ccordoba12 ccordoba12 changed the title impossible to load .spydata file Impossible to load .spydata file Nov 14, 2024
@ccordoba12 ccordoba12 added this to the v6.0.4 milestone Nov 14, 2024
@ccordoba12 ccordoba12 modified the milestones: v6.0.4, v6.0.5 Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants