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

This command failed to be executed because an error occurred while trying to get the file code from Spyder's editor. The error was: An exception has occurred, use %tb to see the full traceback. UnicodeDecodeError: 'cp950' codec can't decode byte 0x81 in position 471: illegal multibyte sequence #23038

Open
c110156240 opened this issue Nov 21, 2024 · 2 comments

Comments

@c110156240
Copy link

Description

What steps will reproduce the problem?

This command failed to be executed because an error occurred while trying to get the file code from Spyder's editor. The error was: An exception has occurred, use %tb to see the full traceback. UnicodeDecodeError: 'cp950' codec can't decode byte 0x81 in position 471: illegal multibyte sequence

Traceback

A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.0.2 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.

If you are a user of the module, the easiest solution will be to
downgrade to 'numpy<2' or try to upgrade the affected module.
We expect that some modules will need time to support NumPy 2.

Traceback (most recent call last):  File "C:\Users\Genuine\anaconda3\lib\site-packages\spyder\plugins\application\container.py", line 361, in _compute_dependencies
    dependencies.declare_dependencies()
  File "C:\Users\Genuine\anaconda3\lib\site-packages\spyder\dependencies.py", line 455, in declare_dependencies
    add(dep['modname'], dep['package_name'],
  File "C:\Users\Genuine\anaconda3\lib\site-packages\spyder\dependencies.py", line 378, in add
    DEPENDENCIES += [Dependency(modname, package_name, features,
  File "C:\Users\Genuine\anaconda3\lib\site-packages\spyder\dependencies.py", line 320, in __init__
    self.installed_version = programs.get_module_version(modname)
  File "C:\Users\Genuine\anaconda3\lib\site-packages\spyder\utils\programs.py", line 855, in get_module_version
    mod = __import__(module_name)
  File "C:\Users\Genuine\anaconda3\lib\site-packages\matplotlib\__init__.py", line 188, in <module>
    from . import _api, _version, cbook, _docstring, rcsetup
  File "C:\Users\Genuine\anaconda3\lib\site-packages\matplotlib\rcsetup.py", line 27, in <module>
    from matplotlib.colors import Colormap, is_color_like
  File "C:\Users\Genuine\anaconda3\lib\site-packages\matplotlib\colors.py", line 57, in <module>
    from matplotlib import _api, _cm, cbook, scale
  File "C:\Users\Genuine\anaconda3\lib\site-packages\matplotlib\scale.py", line 22, in <module>
    from matplotlib.ticker import (
  File "C:\Users\Genuine\anaconda3\lib\site-packages\matplotlib\ticker.py", line 143, in <module>
    from matplotlib import transforms as mtransforms
  File "C:\Users\Genuine\anaconda3\lib\site-packages\matplotlib\transforms.py", line 49, in <module>
    from matplotlib._path import (
Traceback (most recent call last):
  File "C:\Users\Genuine\anaconda3\lib\site-packages\numpy\core\_multiarray_umath.py", line 44, in __getattr__
    raise ImportError(msg)
ImportError: 
A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.0.2 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.

If you are a user of the module, the easiest solution will be to
downgrade to 'numpy<2' or try to upgrade the affected module.
We expect that some modules will need time to support NumPy 2.



A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.0.2 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.

If you are a user of the module, the easiest solution will be to
downgrade to 'numpy<2' or try to upgrade the affected module.
We expect that some modules will need time to support NumPy 2.

Traceback (most recent call last):  File "C:\Users\Genuine\anaconda3\lib\site-packages\spyder\plugins\application\container.py", line 361, in _compute_dependencies
    dependencies.declare_dependencies()
  File "C:\Users\Genuine\anaconda3\lib\site-packages\spyder\dependencies.py", line 455, in declare_dependencies
    add(dep['modname'], dep['package_name'],
  File "C:\Users\Genuine\anaconda3\lib\site-packages\spyder\dependencies.py", line 378, in add
    DEPENDENCIES += [Dependency(modname, package_name, features,
  File "C:\Users\Genuine\anaconda3\lib\site-packages\spyder\dependencies.py", line 320, in __init__
    self.installed_version = programs.get_module_version(modname)
  File "C:\Users\Genuine\anaconda3\lib\site-packages\spyder\utils\programs.py", line 855, in get_module_version
    mod = __import__(module_name)
  File "C:\Users\Genuine\anaconda3\lib\site-packages\pandas\__init__.py", line 54, in <module>
    from pandas.compat import (
  File "C:\Users\Genuine\anaconda3\lib\site-packages\pandas\compat\__init__.py", line 27, in <module>
    from pandas.compat.pyarrow import (
  File "C:\Users\Genuine\anaconda3\lib\site-packages\pandas\compat\pyarrow.py", line 8, in <module>
    import pyarrow as pa
  File "C:\Users\Genuine\anaconda3\lib\site-packages\pyarrow\__init__.py", line 65, in <module>
    import pyarrow.lib as _lib
AttributeError: _ARRAY_API not found

A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.0.2 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.

If you are a user of the module, the easiest solution will be to
downgrade to 'numpy<2' or try to upgrade the affected module.
We expect that some modules will need time to support NumPy 2.

Traceback (most recent call last):  File "C:\Users\Genuine\anaconda3\lib\site-packages\spyder\plugins\application\container.py", line 361, in _compute_dependencies
    dependencies.declare_dependencies()
  File "C:\Users\Genuine\anaconda3\lib\site-packages\spyder\dependencies.py", line 455, in declare_dependencies
    add(dep['modname'], dep['package_name'],
  File "C:\Users\Genuine\anaconda3\lib\site-packages\spyder\dependencies.py", line 378, in add
    DEPENDENCIES += [Dependency(modname, package_name, features,
  File "C:\Users\Genuine\anaconda3\lib\site-packages\spyder\dependencies.py", line 320, in __init__
    self.installed_version = programs.get_module_version(modname)
  File "C:\Users\Genuine\anaconda3\lib\site-packages\spyder\utils\programs.py", line 855, in get_module_version
    mod = __import__(module_name)
  File "C:\Users\Genuine\anaconda3\lib\site-packages\pandas\__init__.py", line 77, in <module>
    from pandas.core.api import (
  File "C:\Users\Genuine\anaconda3\lib\site-packages\pandas\core\api.py", line 9, in <module>
    from pandas.core.dtypes.dtypes import (
  File "C:\Users\Genuine\anaconda3\lib\site-packages\pandas\core\dtypes\dtypes.py", line 24, in <module>
    from pandas._libs import (
  File "C:\Users\Genuine\anaconda3\lib\site-packages\pyarrow\__init__.py", line 65, in <module>
    import pyarrow.lib as _lib
AttributeError: _ARRAY_API not found

A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.0.2 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.

If you are a user of the module, the easiest solution will be to
downgrade to 'numpy<2' or try to upgrade the affected module.
We expect that some modules will need time to support NumPy 2.

Traceback (most recent call last):  File "C:\Users\Genuine\anaconda3\lib\site-packages\spyder\plugins\application\container.py", line 361, in _compute_dependencies
    dependencies.declare_dependencies()
  File "C:\Users\Genuine\anaconda3\lib\site-packages\spyder\dependencies.py", line 455, in declare_dependencies
    add(dep['modname'], dep['package_name'],
  File "C:\Users\Genuine\anaconda3\lib\site-packages\spyder\dependencies.py", line 378, in add
    DEPENDENCIES += [Dependency(modname, package_name, features,
  File "C:\Users\Genuine\anaconda3\lib\site-packages\spyder\dependencies.py", line 320, in __init__
    self.installed_version = programs.get_module_version(modname)
  File "C:\Users\Genuine\anaconda3\lib\site-packages\spyder\utils\programs.py", line 855, in get_module_version
    mod = __import__(module_name)
  File "C:\Users\Genuine\anaconda3\lib\site-packages\pandas\__init__.py", line 77, in <module>
    from pandas.core.api import (
  File "C:\Users\Genuine\anaconda3\lib\site-packages\pandas\core\api.py", line 28, in <module>
    from pandas.core.arrays import Categorical
  File "C:\Users\Genuine\anaconda3\lib\site-packages\pandas\core\arrays\__init__.py", line 1, in <module>
    from pandas.core.arrays.arrow import ArrowExtensionArray
  File "C:\Users\Genuine\anaconda3\lib\site-packages\pandas\core\arrays\arrow\__init__.py", line 5, in <module>
    from pandas.core.arrays.arrow.array import ArrowExtensionArray
  File "C:\Users\Genuine\anaconda3\lib\site-packages\pandas\core\arrays\arrow\array.py", line 50, in <module>
    from pandas.core import (
  File "C:\Users\Genuine\anaconda3\lib\site-packages\pandas\core\ops\__init__.py", line 8, in <module>
    from pandas.core.ops.array_ops import (
  File "C:\Users\Genuine\anaconda3\lib\site-packages\pandas\core\ops\array_ops.py", line 56, in <module>
    from pandas.core.computation import expressions
  File "C:\Users\Genuine\anaconda3\lib\site-packages\pandas\core\computation\expressions.py", line 21, in <module>
    from pandas.core.computation.check import NUMEXPR_INSTALLED
  File "C:\Users\Genuine\anaconda3\lib\site-packages\pandas\core\computation\check.py", line 5, in <module>
    ne = import_optional_dependency("numexpr", errors="warn")
  File "C:\Users\Genuine\anaconda3\lib\site-packages\pandas\compat\_optional.py", line 135, in import_optional_dependency
    module = importlib.import_module(name)
  File "C:\Users\Genuine\anaconda3\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "C:\Users\Genuine\anaconda3\lib\site-packages\numexpr\__init__.py", line 24, in <module>
    from numexpr.interpreter import MAX_THREADS, use_vml, __BLOCK_SIZE1__
AttributeError: _ARRAY_API not found

A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.0.2 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.

If you are a user of the module, the easiest solution will be to
downgrade to 'numpy<2' or try to upgrade the affected module.
We expect that some modules will need time to support NumPy 2.

Traceback (most recent call last):  File "C:\Users\Genuine\anaconda3\lib\site-packages\spyder\plugins\application\container.py", line 361, in _compute_dependencies
    dependencies.declare_dependencies()
  File "C:\Users\Genuine\anaconda3\lib\site-packages\spyder\dependencies.py", line 455, in declare_dependencies
    add(dep['modname'], dep['package_name'],
  File "C:\Users\Genuine\anaconda3\lib\site-packages\spyder\dependencies.py", line 378, in add
    DEPENDENCIES += [Dependency(modname, package_name, features,
  File "C:\Users\Genuine\anaconda3\lib\site-packages\spyder\dependencies.py", line 320, in __init__
    self.installed_version = programs.get_module_version(modname)
  File "C:\Users\Genuine\anaconda3\lib\site-packages\spyder\utils\programs.py", line 855, in get_module_version
    mod = __import__(module_name)
  File "C:\Users\Genuine\anaconda3\lib\site-packages\pandas\__init__.py", line 77, in <module>
    from pandas.core.api import (
  File "C:\Users\Genuine\anaconda3\lib\site-packages\pandas\core\api.py", line 28, in <module>
    from pandas.core.arrays import Categorical
  File "C:\Users\Genuine\anaconda3\lib\site-packages\pandas\core\arrays\__init__.py", line 1, in <module>
    from pandas.core.arrays.arrow import ArrowExtensionArray
  File "C:\Users\Genuine\anaconda3\lib\site-packages\pandas\core\arrays\arrow\__init__.py", line 5, in <module>
    from pandas.core.arrays.arrow.array import ArrowExtensionArray
  File "C:\Users\Genuine\anaconda3\lib\site-packages\pandas\core\arrays\arrow\array.py", line 64, in <module>
    from pandas.core.arrays.masked import BaseMaskedArray
  File "C:\Users\Genuine\anaconda3\lib\site-packages\pandas\core\arrays\masked.py", line 60, in <module>
    from pandas.core import (
  File "C:\Users\Genuine\anaconda3\lib\site-packages\pandas\core\nanops.py", line 52, in <module>
    bn = import_optional_dependency("bottleneck", errors="warn")
  File "C:\Users\Genuine\anaconda3\lib\site-packages\pandas\compat\_optional.py", line 135, in import_optional_dependency
    module = importlib.import_module(name)
  File "C:\Users\Genuine\anaconda3\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "C:\Users\Genuine\anaconda3\lib\site-packages\bottleneck\__init__.py", line 7, in <module>
    from .move import (move_argmax, move_argmin, move_max, move_mean, move_median,
AttributeError: _ARRAY_API not found

Versions

  • Spyder version: 5.2.2
  • Python version: 3.9.18
  • Qt version: 5.12.10
  • PyQt5 version: 5.12.3
  • Operating System: Windows 10

Dependencies

# Mandatory:
atomicwrites >=1.2.0          :  1.4.0 (OK)
chardet >=2.0.0               :  3.0.4 (OK)
cloudpickle >=0.5.0           :  2.2.1 (OK)
cookiecutter >=1.6.0          :  2.5.0 (OK)
diff_match_patch >=20181111   :  20200713 (OK)
intervaltree >=3.0.2          :  3.1.0 (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               :  1.0.1 (OK)
jsonschema >=3.2.0            :  4.19.2 (OK)
keyring >=17.0.0              :  23.13.1 (OK)
nbconvert >=4.0               :  6.4.4 (OK)
numpydoc >=0.6.0              :  1.4.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.9.0 (OK)
pygments >=2.0                :  2.15.1 (OK)
pylint >=2.5.0                :  2.16.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.0 (OK)
qdarkstyle =3.0.2             :  3.0.2 (OK)
qstylizer >=0.1.10            :  0.2.2 (OK)
qtawesome >=1.0.2             :  1.2.2 (OK)
qtconsole >=5.2.1;<5.3.0      :  5.2.2 (OK)
qtpy >=1.5.0                  :  2.4.1 (OK)
rtree >=0.9.7                 :  1.0.1 (OK)
setuptools >=49.6.0           :  68.0.0 (OK)
sphinx >=0.6.6                :  5.0.2 (OK)
spyder_kernels >=2.2.1;<2.3.0 :  2.2.1 (OK)
textdistance >=4.2.0          :  4.2.1 (OK)
three_merge >=0.1.1           :  0.1.1 (OK)
watchdog >=0.10.3             :  2.1.6 (OK)
zmq >=17                      :  23.2.0 (OK)

# Optional:
cython >=0.21                 :  0.29.32 (OK)
matplotlib >=2.0.0            :  None (NOK)
numpy >=1.7                   :  2.0.2 (OK)
pandas >=1.1.1                :  2.2.2 (OK)
scipy >=0.17.0                :  1.9.3 (OK)
sympy >=0.7.3                 :  1.11.1 (OK)
@maurerle
Copy link
Contributor

Have you tried the solution from this ticket:
#22187 (comment)

pip install -U numexpr bottleneck

This updates dependencies which were relying on the old numpy version

@ccordoba12
Copy link
Member

Hey @c110156240, thanks for reporting. There are two problems in this same issue:

This command failed to be executed because an error occurred while trying to get the file code from Spyder's editor. The error was: An exception has occurred, use %tb to see the full traceback. UnicodeDecodeError: 'cp950' codec can't decode byte 0x81 in position 471: illegal multibyte sequence

Please post a simple script that generates this error so we can try to reproduce this problem on our side.

A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.0.2 as it may crash

This problem is caused because you installed Numpy or one of its dependencies with pip in Anaconda, which broke your installation. Now you have to uninstall and reinstall it (otherwise you'll have similar problems in the future).

To do that properly, please see the second part of our video about not mixing pip and conda packages.

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

3 participants