Skip to content

BUG: ModuleNotFoundError: No module named 'numpy.char' #28558

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

Closed
LucasColas opened this issue Mar 19, 2025 · 2 comments
Closed

BUG: ModuleNotFoundError: No module named 'numpy.char' #28558

LucasColas opened this issue Mar 19, 2025 · 2 comments
Labels

Comments

@LucasColas
Copy link

Describe the issue:

Hello, for a NLP task, I need to go back to an earlier version compatible with torchtext.

Reproduce the code example:

!pip install torch==2.1.2+cu121 -f https://download.pytorch.org/whl/torch/ --force-reinstall --no-cache-dir > /dev/null
!pip install torchtext==0.16.2 --force-reinstall --no-cache-dir > /dev/null
!pip install numpy==1.23.5 --force-reinstall --no-cache-dir > /dev/null


!python3 -m spacy download en > /dev/null
!python3 -m spacy download fr > /dev/null
!pip install torchinfo > /dev/null
!pip install einops > /dev/null
!pip install wandb > /dev/null

from sklearn.model_selection import train_test_split

Error message:

ModuleNotFoundError                       Traceback (most recent call last)

<ipython-input-4-c2161d2c5b02> in <cell line: 0>()
      3 
      4 import numpy as np
----> 5 from sklearn.model_selection import train_test_split
      6 import pandas as pd
      7 

11 frames

/usr/local/lib/python3.11/dist-packages/numpy/__init__.py in __getattr__(attr)
    365             # Throw runtime error, if the test failed Check for warning and error_message
    366             error_message = ""
--> 367             if len(w) > 0:
    368                 error_message = "{}: {}".format(w[-1].category.__name__, str(w[-1].message))
    369                 msg = (

ModuleNotFoundError: No module named 'numpy.char'


---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the
"Open Examples" button below.

Python and NumPy Versions:

2.0.2
3.11.11 (main, Dec 4 2024, 08:55:07) [GCC 11.4.0]

Runtime Environment:

Exception ignored on calling ctypes callback function: <function ThreadpoolController._find_libraries_with_dl_iterate_phdr..match_library_callback at 0x78a71408e980>
Traceback (most recent call last):
File "/usr/local/lib/python3.11/dist-packages/threadpoolctl.py", line 1005, in match_library_callback
self._make_controller_from_path(filepath)
File "/usr/local/lib/python3.11/dist-packages/threadpoolctl.py", line 1187, in _make_controller_from_path
lib_controller = controller_class(
^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/threadpoolctl.py", line 114, in init
self.dynlib = ctypes.CDLL(filepath, mode=_RTLD_NOLOAD)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/ctypes/init.py", line 376, in init
self._handle = _dlopen(self.name, mode)
^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: /usr/local/lib/python3.11/dist-packages/numpy.libs/libscipy_openblas64
-99b71e71.so: cannot open shared object file: No such file or directory
Exception ignored on calling ctypes callback function: <function ThreadpoolController._find_libraries_with_dl_iterate_phdr..match_library_callback at 0x78a71408e980>
Traceback (most recent call last):
File "/usr/local/lib/python3.11/dist-packages/threadpoolctl.py", line 1005, in match_library_callback
self._make_controller_from_path(filepath)
File "/usr/local/lib/python3.11/dist-packages/threadpoolctl.py", line 1187, in _make_controller_from_path
lib_controller = controller_class(
^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/threadpoolctl.py", line 114, in init
self.dynlib = ctypes.CDLL(filepath, mode=_RTLD_NOLOAD)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/ctypes/init.py", line 376, in init
self._handle = _dlopen(self._name, mode)
^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: dlopen() error

[{'numpy_version': '2.0.2',
'python': '3.11.11 (main, Dec 4 2024, 08:55:07) [GCC 11.4.0]',
'uname': uname_result(system='Linux', node='3554ebc8f6fb', release='6.1.85+', version='#1 SMP PREEMPT_DYNAMIC Thu Jun 27 21:05:47 UTC 2024', machine='x86_64')},
{'simd_extensions': {'baseline': ['SSE', 'SSE2', 'SSE3'],
'found': ['SSSE3',
'SSE41',
'POPCNT',
'SSE42',
'AVX',
'F16C',
'FMA3',
'AVX2'],
'not_found': ['AVX512F',
'AVX512CD',
'AVX512_KNL',
'AVX512_KNM',
'AVX512_SKX',
'AVX512_CLX',
'AVX512_CNL',
'AVX512_ICL']}}]

Context for the issue:

I can't use torchtext and train models. I know torchtext is no longer in development but I must use it.

@seberg
Copy link
Member

seberg commented Mar 19, 2025

Something is very wrong with your install, you somehow managed to install multiple numpy versions at once or so.
I can't help but notice dist-packages/numpy.libs maybe you should use an environment.

Start from a fresh env and make sure no numpy exists.

You can try to keep asking, but as this is a messed up install, it isn't a NumPy issue and someone who is local to you is more likely to be helpful.

@seberg seberg closed this as not planned Won't fix, can't repro, duplicate, stale Mar 19, 2025
@LucasColas
Copy link
Author

Something is very wrong with your install, you somehow managed to install multiple numpy versions at once or so. I can't help but notice dist-packages/numpy.libs maybe you should use an environment.

Start from a fresh env and make sure no numpy exists.

You can try to keep asking, but as this is a messed up install, it isn't a NumPy issue and someone who is local to you is more likely to be helpful.

I have to use colab I can't start a new env

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants