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

Problem with Numpy version compatibility #23489

Open
Alicia-Jackson opened this issue Jan 16, 2025 · 5 comments
Open

Problem with Numpy version compatibility #23489

Alicia-Jackson opened this issue Jan 16, 2025 · 5 comments

Comments

@Alicia-Jackson
Copy link

Description

What steps will reproduce the problem?

Step: simply open spyder and the error pops up
Error Detail: from .move import (move_argmax, move_argmin, move_max, move_mean, move_median,
AttributeError: _ARRAY_API not found

Traceback

A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.0.1 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\ahong\Anaconda3\lib\site-packages\spyder\dependencies.py", line 425, in declare_dependencies
    add(dep['modname'], dep['package_name'],
  File "C:\Users\ahong\Anaconda3\lib\site-packages\spyder\dependencies.py", line 350, in add
    DEPENDENCIES += [Dependency(modname, package_name, features,
  File "C:\Users\ahong\Anaconda3\lib\site-packages\spyder\dependencies.py", line 307, in __init__
    self.installed_version = programs.get_module_version(modname)
  File "C:\Users\ahong\Anaconda3\lib\site-packages\spyder\utils\programs.py", line 852, in get_module_version
    mod = __import__(module_name)
  File "C:\Users\ahong\AppData\Roaming\Python\Python39\site-packages\pandas\__init__.py", line 77, in <module>
    from pandas.core.api import (
  File "C:\Users\ahong\AppData\Roaming\Python\Python39\site-packages\pandas\core\api.py", line 28, in <module>
    from pandas.core.arrays import Categorical
  File "C:\Users\ahong\AppData\Roaming\Python\Python39\site-packages\pandas\core\arrays\__init__.py", line 1, in <module>
    from pandas.core.arrays.arrow import ArrowExtensionArray
  File "C:\Users\ahong\AppData\Roaming\Python\Python39\site-packages\pandas\core\arrays\arrow\__init__.py", line 5, in <module>
    from pandas.core.arrays.arrow.array import ArrowExtensionArray
  File "C:\Users\ahong\AppData\Roaming\Python\Python39\site-packages\pandas\core\arrays\arrow\array.py", line 64, in <module>
    from pandas.core.arrays.masked import BaseMaskedArray
  File "C:\Users\ahong\AppData\Roaming\Python\Python39\site-packages\pandas\core\arrays\masked.py", line 60, in <module>
    from pandas.core import (
  File "C:\Users\ahong\AppData\Roaming\Python\Python39\site-packages\pandas\core\nanops.py", line 52, in <module>
    bn = import_optional_dependency("bottleneck", errors="warn")
  File "C:\Users\ahong\AppData\Roaming\Python\Python39\site-packages\pandas\compat\_optional.py", line 135, in import_optional_dependency
    module = importlib.import_module(name)
  File "C:\Users\ahong\Anaconda3\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "C:\Users\ahong\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.1.5
  • Python version: 3.9.12
  • Qt version: 5.9.7
  • PyQt5 version: 5.9.2
  • 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.0.0 (OK)
cookiecutter >=1.6.0          :  1.7.3 (OK)
diff_match_patch >=20181111   :  20200713 (OK)
intervaltree >=3.0.2          :  3.1.0 (OK)
IPython >=7.6.0               :  8.2.0 (OK)
jedi >=0.17.2;<0.19.0         :  0.18.1 (OK)
jsonschema >=3.2.0            :  4.4.0 (OK)
keyring >=17.0.0              :  23.4.0 (OK)
nbconvert >=4.0               :  6.4.4 (OK)
numpydoc >=0.6.0              :  1.2 (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.11.2 (OK)
pylint >=2.5.0;<2.10.0        :  2.9.6 (OK)
pyls_spyder >=0.4.0           :  0.4.0 (OK)
pylsp >=1.2.2;<1.3.0          :  1.2.4 (OK)
pylsp_black >=1.0.0           :  None (OK)
qdarkstyle =3.0.2             :  3.0.2 (OK)
qstylizer >=0.1.10            :  0.1.10 (OK)
qtawesome >=1.0.2             :  1.0.3 (OK)
qtconsole >=5.1.0             :  5.3.0 (OK)
qtpy >=1.5.0                  :  2.0.1 (OK)
rtree >=0.9.7                 :  0.9.7 (OK)
setuptools >=49.6.0           :  61.2.0 (OK)
sphinx >=0.6.6                :  4.4.0 (OK)
spyder_kernels >=2.1.1;<2.2.0 :  2.1.3 (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                      :  22.3.0 (OK)

# Optional:
cython >=0.21                 :  0.29.28 (OK)
matplotlib >=2.0.0            :  None (OK)
numpy >=1.7                   :  2.0.1 (OK)
pandas >=1.1.1                :  2.2.2 (OK)
scipy >=0.17.0                :  1.13.1 (OK)
sympy >=0.7.3                 :  1.10.1 (OK)
@ccordoba12
Copy link
Member

Hey @Alicia-Jackson, thanks for reporting. This problem is caused by installing Numpy, or a package that depends on it, with pip in a conda environment. Since pip and conda packages are binary incompatible, they can't be mixed in the same environment.

To solve it, you need to remove this directory

C:\Users\ahong\AppData\Roaming\Python

Let us know if that works for you. And if you want to learn more about this problem, check our our video about it.

@Alicia-Jackson
Copy link
Author

Alicia-Jackson commented Jan 17, 2025 via email

@ccordoba12
Copy link
Member

To solve that problem, I'm afraid you'll have to remove and reinstall Anaconda. And to properly do that, please follow the instructions in the second part of our video about it (the first part describes in more detail why you can't mix pip and conda packages).

Let us know how that goes.

@Alicia-Jackson
Copy link
Author

Would I need to re-install all the python packages if I reinstall Anaconda? I seem to be able to pypass this error but a new pop up screen came up with below (although the C:\Users\ahong\AppData\Roaming\Python was deleted)
I am a bit unsure what would be lost for removing and reinstalling Anaconda, any advice? Thank you


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\ahong\Anaconda3\lib\site-packages\spyder\dependencies.py", line 425, in declare_dependencies
add(dep['modname'], dep['package_name'],
File "C:\Users\ahong\Anaconda3\lib\site-packages\spyder\dependencies.py", line 350, in add
DEPENDENCIES += [Dependency(modname, package_name, features,
File "C:\Users\ahong\Anaconda3\lib\site-packages\spyder\dependencies.py", line 307, in init
self.installed_version = programs.get_module_version(modname)
File "C:\Users\ahong\Anaconda3\lib\site-packages\spyder\utils\programs.py", line 852, in get_module_version
mod = import(module_name)
File "C:\Users\ahong\Anaconda3\lib\site-packages\pandas_init_.py", line 80, in
from pandas.core.api import (
File "C:\Users\ahong\Anaconda3\lib\site-packages\pandas\core\api.py", line 28, in
from pandas.core.arrays import Categorical
File "C:\Users\ahong\Anaconda3\lib\site-packages\pandas\core\arrays_init_.py", line 1, in
from pandas.core.arrays.arrow import ArrowExtensionArray
File "C:\Users\ahong\Anaconda3\lib\site-packages\pandas\core\arrays\arrow_init_.py", line 5, in
from pandas.core.arrays.arrow.array import ArrowExtensionArray
File "C:\Users\ahong\Anaconda3\lib\site-packages\pandas\core\arrays\arrow\array.py", line 64, in
from pandas.core.arrays.masked import BaseMaskedArray
File "C:\Users\ahong\Anaconda3\lib\site-packages\pandas\core\arrays\masked.py", line 60, in
from pandas.core import (
File "C:\Users\ahong\Anaconda3\lib\site-packages\pandas\core\nanops.py", line 52, in
bn = import_optional_dependency("bottleneck", errors="warn")
File "C:\Users\ahong\Anaconda3\lib\site-packages\pandas\compat_optional.py", line 135, in import_optional_dependency
module = importlib.import_module(name)
File "C:\Users\ahong\Anaconda3\lib\importlib_init_.py", line 127, in import_module
return _bootstrap.gcd_import(name[level:], package, level)
File "C:\Users\ahong\Anaconda3\lib\site-packages\bottleneck_init
.py", line 7, in
from .move import (move_argmax, move_argmin, move_max, move_mean, move_median,
AttributeError: _ARRAY_API not found

@ccordoba12
Copy link
Member

Would I need to re-install all the python packages if I reinstall Anaconda?

Yes, you'll have to, sorry. That's why it's not a good idea to install packages with pip in a conda environment.

I seem to be able to pypass this error but a new pop up screen came up with below (although the C:\Users\ahong\AppData\Roaming\Python was deleted)

It's the same error as before, but now there's no workaround for it but to reinstall Anaconda

I am a bit unsure what would be lost for removing and reinstalling Anaconda, any advice? Thank you

You'll lose any additional packages you installed after installing Anaconda. You'll also lose all your conda environments, in case you created some of them.

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

2 participants