brainpy / BrainPy

Brain Dynamics Programming in Python
https://brainpy.readthedocs.io/
GNU General Public License v3.0
531 stars 94 forks source link

"ImportError: cannot import name 'numba_range' from 'brainpy.tools'" in version 2.4.4.post1 #462

Closed CloudyDory closed 1 year ago

CloudyDory commented 1 year ago

Hi, I have just upgraded brainpy from version 2.4.3.post5 to version 2.4.4.post1. In version 2.4.3 everything works fine. However, immediately after upgrading to 2.4.4, import brainpy gives the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\xxx\miniconda3\Lib\site-packages\brainpy\__init__.py", line 24, in <module>
    from brainpy import (
  File "C:\Users\xxx\miniconda3\Lib\site-packages\brainpy\initialize\__init__.py", line 9, in <module>
    from .generic import *
  File "C:\Users\xxx\miniconda3\Lib\site-packages\brainpy\initialize\generic.py", line 10, in <module>
    from brainpy.types import Shape, Array
  File "C:\Users\xxx\miniconda3\Lib\site-packages\brainpy\types.py", line 3, in <module>
    from brainpy._src.types import (
  File "C:\Users\xxx\miniconda3\Lib\site-packages\brainpy\_src\types.py", line 9, in <module>
    from brainpy._src import connect as conn
  File "C:\Users\xxx\miniconda3\Lib\site-packages\brainpy\_src\connect\__init__.py", line 11, in <module>
    from .random_conn import *
  File "C:\Users\xxx\miniconda3\Lib\site-packages\brainpy\_src\connect\random_conn.py", line 11, in <module>
    from brainpy.tools import numba_seed, numba_jit, numba_range, format_seed
ImportError: cannot import name 'numba_range' from 'brainpy.tools' (C:\Users\xxx\miniconda3\Lib\site-packages\brainpy\tools\__init__.py)

I am using Python 3.11 with Miniconda. Thanks!

CloudyDory commented 1 year ago

I install brainpy by pip install -U brainpy. Have tried completely remove brainpy and reinstall, but still doesn't work.

chaoming0625 commented 1 year ago

I have tested it just now. It works, no error report. Please check your installation. Maybe something is wrong?

image
CloudyDory commented 1 year ago

Hi, I have tried removing brainpylib and jax[cpu], and then reinstall them with brainpy again. This time it works. Thanks!