roshan-research / hazm

Persian NLP Toolkit
https://www.roshan-ai.ir/hazm/
MIT License
1.16k stars 181 forks source link

module 'numpy' has no attribute '_no_nep50_warning' #309

Closed lnxdx closed 7 months ago

lnxdx commented 7 months ago

When importing hazm in google colab . . . import hazm I get the following error!

AttributeError                            Traceback (most recent call last)
[<ipython-input-2-5a674230a00f>](https://localhost:8080/#) in <cell line: 1>()
----> 1 import hazm

10 frames
[/usr/local/lib/python3.10/dist-packages/numpy/__init__.py](https://localhost:8080/#) in __getattr__(attr)
    309         # here to save on the order of 10 ms of import time for most users
    310         #
--> 311         # The previous way Tester was imported also had a side effect of adding
    312         # the full `numpy.testing` namespace
    313         if attr == 'testing':

AttributeError: module 'numpy' has no attribute '_no_nep50_warning'

numpy version which installs alongside hazm is 1.24.3

what should I do?

lnxdx commented 7 months ago

The problem is old numpy version. We have to restart the runtime in order to changing the numpy version takes effect and we will be able to use the newly installed version of numpy.

When we install hazm using pip, the following error is generated which say to restart the runtime.

Successfully installed fasttext-wheel-0.9.2 flashtext-2.7 hazm-0.9.4 numpy-1.24.3 pybind11-2.11.1 python-crfsuite-0.9.9
WARNING: The following packages were previously imported in this runtime:
  [numpy]
You must restart the runtime in order to use newly installed versions.