MaartenGr / MaartenGr/BERTopic
ImportError with UMAP in Colab Notebook using T4 GPU
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 7.8k
- Forks
- 920
- Avg merge
- 22h 24m
- Merged PRs (30d)
- 5
Description
Environment
Google Colab Notebook
T4 GPU with High RAM configuration
Steps to Reproduce
1. Installed BERTopic using pip:
!pip install git+https://github.com/MaartenGr/BERTopic.git@master
2. Installed CUDA and CuPy related packages:
!pip install cudf-cu11 dask-cudf-cu11 --extra-index-url=https://pypi.nvidia.com
!pip install cuml-cu11 --extra-index-url=https://pypi.nvidia.com
!pip install cugraph-cu11 --extra-index-url=https://pypi.nvidia.com
!pip install cupy-cuda11x -f https://pip.cupy.dev/aarch64
Issue Encountered
While trying to load UMAP using the following code:
from cuml.manifold import UMAP
I encountered an ImportError. The error suggests a conflict between multiple CuPy packages (cupy-cuda11x, cupy-cuda12x) installed in the environment. The detailed error message is as follows:
/usr/local/lib/python3.10/dist-packages/cupy/_environment.py:447: UserWarning:
--------------------------------------------------------------------------------
CuPy may not function correctly because multiple CuPy packages are installed in your environment: cupy-cuda11x, cupy-cuda12x
...
ImportError: libcudart.so.11.0: cannot open shared object file: No such file or directory
**Full Error:**
/usr/local/lib/python3.10/dist-packages/cupy/_environment.py:447: UserWarning:
--------------------------------------------------------------------------------
CuPy may not function correctly because multiple CuPy packages are installed
in your environment:
cupy-cuda11x, cupy-cuda12x
Follow these steps to resolve this issue:
1. For all packages listed above, run the following command to remove all
existing CuPy installations:
$ pip uninstall
If you previously installed CuPy via conda, also run the following:
$ conda uninstall cupy
2. Install the appropriate CuPy package.
Refer to the Installation Guide for detailed instructions.
https://docs.cupy.dev/en/stable/install.html
--------------------------------------------------------------------------------
warnings.warn(f'''
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
[/usr/local/lib/python3.10/dist-packages/cupy/__init__.py](https://localhost:8080/#) in
16 try:
---> 17 from cupy import _core # NOQA
18 except ImportError as exc:
14 frames
[/usr/local/lib/python3.10/dist-packages/cupy/_core/__init__.py](https://localhost:8080/#) in
2
----> 3 from cupy._core import core # NOQA
4 from cupy._core import fusion # NOQA
ImportError: libcudart.so.11.0: cannot open shared object file: No such file or directory
The above exception was the direct cause of the following exception:
ImportError Traceback (most recent call last)
[](https://localhost:8080/#) in ()
----> 1 from cuml.manifold import UMAP
2 from cuml.cluster import HDBSCAN
3 from bertopic import BERTopic
[/usr/local/lib/python3.10/dist-packages/cuml/__init__.py](https://localhost:8080/#) in
15 #
16
---> 17 from cuml.internals.base import Base, UniversalBase
18 from cuml.internals.available_devices import is_cuda_available
19
[/usr/local/lib/python3.10/dist-packages/cuml/internals/__init__.py](https://localhost:8080/#) in
16
17 from cuml.internals.available_devices import is_cuda_available
---> 18 from cuml.internals.base_helpers import BaseMetaClass, _tags_class_and_instance
19 from cuml.internals.api_decorators import (
20 _deprecate_pos_args,
[/usr/local/lib/python3.10/dist-packages/cuml/internals/base_helpers.py](https://localhost:8080/#) in
18 import typing
19
---> 20 from cuml.internals.api_decorators import (
21 api_base_return_generic,
22 api_base_return_array,
[/usr/local/lib/python3.10/dist-packages/cuml/internals/api_decorators.py](https://localhost:8080/#) in
22
23 # TODO: Try to resolve circular import that makes this necessary:
---> 24 from cuml.internals import input_utils as iu
25 from cuml.internals.api_context_managers import BaseReturnAnyCM
26 from cuml.internals.api_context_managers import BaseReturnArrayCM
[/usr/local/lib/python3.10/dist-packages/cuml/internals/input_utils.py](https://localhost:8080/#) in
17 from collections import namedtuple
18
---> 19 from cuml.internals.array import CumlArray
20 from cuml.internals.array_sparse import SparseCumlArray
21 from cuml.internals.global_settings import GlobalSettings
[/usr/local/lib/python3.10/dist-packages/cuml/internals/array.py](https://localhost:8080/#) in
19 import pickle
20
---> 21 from cuml.internals.global_settings import GlobalSettings
22 from cuml.internals.logger import debug
23 from cuml.internals.mem_type import MemoryType, MemoryTypeError
[/usr/local/lib/python3.10/dist-packages/cuml/internals/global_settings.py](https://localhost:8080/#) in
18 import threading
19 from cuml.internals.available_devices import is_cuda_available
---> 20 from cuml.internals.device_type import DeviceType
21 from cuml.internals.mem_type import MemoryType
22 from cuml.internals.safe_imports import cpu_only_import, gpu_only_import
[/usr/local/lib/python3.10/dist-packages/cuml/internals/device_type.py](https://localhost:8080/#) in
17
18 from enum import Enum, auto
---> 19 from cuml.internals.mem_type import MemoryType
20
21
[/usr/local/lib/python3.10/dist-packages/cuml/internals/mem_type.py](https://localhost:8080/#) in
20 from cuml.internals.safe_imports import cpu_only_import, gpu_only_import
21
---> 22 cudf = gpu_only_import("cudf")
23 cp = gpu_only_import("cupy")
24 cpx_sparse = gpu_only_import("cupyx.scipy.sparse")
[/usr/local/lib/python3.10/dist-packages/cuml/internals/safe_imports.py](https://localhost:8080/#) in gpu_only_import(module, alt)
354 """
355 if GPU_ENABLED:
--> 356 return importlib.import_module(module)
357 else:
358 return safe_import(
[/usr/lib/python3.10/importlib/__init__.py](https://localhost:8080/#) in import_module(name, package)
124 break
125 level += 1
--> 126 return _bootstrap._gcd_import(name[level:], package, level)
127
128
[/usr/local/lib/python3.10/dist-packages/cudf/__init__.py](https://localhost:8080/#) in
10 validate_setup()
11
---> 12 import cupy
13 from numba import config as numba_config, cuda
14
[/usr/local/lib/python3.10/dist-packages/cupy/__init__.py](https://localhost:8080/#) in
17 from cupy import _core # NOQA
18 except ImportError as exc:
---> 19 raise ImportError(f'''
20 ================================================================
21 {_environment._diagnose_import_error()}
ImportError:
================================================================
Failed to import CuPy.
If you installed CuPy via wheels (cupy-cudaXXX or cupy-rocm-X-X), make sure that the package matches with the version of CUDA or ROCm installed.
On Linux, you may need to set LD_LIBRARY_PATH environment variable depending on how you installed CUDA/ROCm.
On Windows, try setting CUDA_PATH environment variable.
Check the Installation Guide for details:
https://docs.cupy.dev/en/latest/install.html
Original error:
ImportError: libcudart.so.11.0: cannot open shared object file: No such file or directory
**###Requesting Help**
I am seeking guidance on resolving this ImportError, specifically in the context of using UMAP with BERTopic in a Colab environment. Any suggestions on how to correctly set up the environment or resolve the package conflicts would be greatly appreciated.
Thank you for your time and consideration!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the listed Google Colab installation commands and the `from cuml.manifold import UMAP` entry point, then inspect the conflicting CuPy packages and CUDA-related error shown in the report. Done means the Colab environment has a consistent CuPy/CUDA setup and the UMAP import completes without the reported ImportError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100