Я столкнулся с ошибкой ImportError при попытке импортировать библиотеку cuml в среду conda в Ubuntu 24.04. Вот шаги, которые я выполнил, и ошибки, с которыми я столкнулся.
Шаги по воспроизведению:
- < li>Создайте новую среду conda:
Код: Выделить всё
conda create --prefix ./env jupyter python=3.8 - Установите библиотеку cuml с канала Rapidsai:
Установка прошла нормально, и все загрузилось успешно.
Код: Выделить всё
conda install -c rapidsai -c nvidia -c conda-forge cuml=21.12 cudatoolkit=11.0 - Запустите Сервер Jupyter:
Код: Выделить всё
jupyter notebook - Выполните в ячейке Jupyter следующую команду:
Код: Выделить всё
import cuml
Код: Выделить всё
ImportError: cannot import name 'MachAr' from 'numpy'
Код: Выделить всё
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
Cell In[1], line 1
----> 1 import cuml
File ~/Desktop/cuML-problem/env/lib/python3.8/site-packages/cuml/__init__.py:17
1 #
2 # Copyright (c) 2021, NVIDIA CORPORATION.
3 #
(...)
14 # limitations under the License.
15 #
---> 17 from cuml.common.base import Base
18 from cuml.common.handle import Handle
19 import cuml.common.cuda as cuda
File ~/Desktop/cuML-problem/env/lib/python3.8/site-packages/cuml/common/__init__.py:17
1 #
2 # Copyright (c) 2019-2020, NVIDIA CORPORATION.
3 #
(...)
14 # limitations under the License.
15 #
---> 17 from cuml.common.array import CumlArray
18 from cuml.common.array_sparse import SparseCumlArray
20 # utils
File ~/Desktop/cuML-problem/env/lib/python3.8/site-packages/cuml/common/array.py:17
1 #
2 # Copyright (c) 2020-2021, NVIDIA CORPORATION.
3 #
(...)
14 # limitations under the License.
15 #
---> 17 import cupy as cp
18 import numpy as np
19 import operator
File ~/Desktop/cuML-problem/env/lib/python3.8/site-packages/cupy/__init__.py:394
392 from numpy import finfo # NOQA
393 from numpy import iinfo # NOQA
--> 394 from numpy import MachAr # NOQA
396 from numpy import find_common_type # NOQA
397 from numpy import issctype # NOQA
ImportError: cannot import name 'MachAr' from 'numpy' (/home/john/Desktop/cuML-problem/env/lib/python3.8/site-packages/numpy/__init__.py)
- Обнаружена связанная проблема предлагаю понизить версию numpy до 1.23:
- Выполните команду:
Код: Выделить всё
conda install numpy=1.23 - Обнаружена следующая ошибка:
Код: Выделить всё
LibMambaUnsatisfiableError: Encountered problems while solving: - nothing provides numpy-base 1.23.3 py310h375b286_0 needed by numpy-1.23.3-py310hac523dd_0
- Выполните команду:
- Попытка установить cuml библиотека в среде conda с Python 3.12:
- Обнаружены аналогичные проблемы с зависимостями:
Код: Выделить всё
LibMambaUnsatisfiableError: Encountered problems while solving: - package cuml-21.12.00-cuda11_py37_g04c4927f3_0 requires python >=3.7, [list] [*]ОС:[/b] Ubuntu 24.04 [*][b]Версия Conda:< /strong> 24.5.0 [*]Графический процессор:[/b] NVIDIA GeForce GTX 1060 3 ГБ [*][b]Версия драйвера NVIDIA:< /strong> 535.183.01 [*]Версия Cuda:[/b] 11.0 [/list] [b] Вопрос:[/b] Как устранить ошибку ImportError и успешно импортировать библиотеку cuml в мою среду conda? Нужно ли мне для этого предпринять какие-то особые действия? Подробнее здесь: [url]https://stackoverflow.com/questions/78818232/importerror-when-trying-to-import-the-cuml-library[/url]
- Обнаружены аналогичные проблемы с зависимостями: