cudf: [QST] Failed to create cudf.DataFrame

What is your question?

When I create cudf.DataFrame I get the following error, can someone help?

cudf version: 21.12.2 python version: 3.7.13

code:

image

ERROR:

In [1]: import cudf

In [2]: df = cudf.DataFrame({'a': list(range(20)),
   ...:                      'b': list(reversed(range(20))),
   ...:                      'c': list(range(20))
   ...:                     })
   ...: df
Out[2]: ---------------------------------------------------------------------------
CudaAPIError                              Traceback (most recent call last)
/home/.anaconda3/envs/alex_env_3.7/lib/python3.7/site-packages/numba/cuda/cudadrv/driver.py in ensure_initialized(self)
    245             _logger.info('init')
--> 246             self.cuInit(0)
    247         except CudaAPIError as e:

/home/.anaconda3/envs/alex_env_3.7/lib/python3.7/site-packages/numba/cuda/cudadrv/driver.py in safe_cuda_api_call(*args)
    318             retcode = libfn(*args)
--> 319             self._check_ctypes_error(fname, retcode)
    320 

/home/.anaconda3/envs/alex_env_3.7/lib/python3.7/site-packages/numba/cuda/cudadrv/driver.py in _check_ctypes_error(self, fname, retcode)
    386                 self._detect_fork()
--> 387             raise CudaAPIError(retcode, msg)
    388 

CudaAPIError: [304] Call to cuInit results in CUDA_ERROR_OPERATING_SYSTEM

During handling of the above exception, another exception occurred:

CudaSupportError                          Traceback (most recent call last)
/home/.anaconda3/envs/alex_env_3.7/lib/python3.7/site-packages/IPython/core/formatters.py in __call__(self, obj)
    700                 type_pprinters=self.type_printers,
    701                 deferred_pprinters=self.deferred_printers)
--> 702             printer.pretty(obj)
    703             printer.flush()
    704             return stream.getvalue()

/home/.anaconda3/envs/alex_env_3.7/lib/python3.7/site-packages/IPython/lib/pretty.py in pretty(self, obj)
    392                         if cls is not object \
    393                                 and callable(cls.__dict__.get('__repr__')):
--> 394                             return _repr_pprint(obj, self, cycle)
    395 
    396             return _default_pprint(obj, self, cycle)

/home/.anaconda3/envs/alex_env_3.7/lib/python3.7/site-packages/IPython/lib/pretty.py in _repr_pprint(obj, p, cycle)
    698     """A pprint that just redirects to the normal repr function."""
    699     # Find newlines and replace them with p.break_()
--> 700     output = repr(obj)
    701     lines = output.splitlines()
    702     with p.group():

/home/.anaconda3/envs/alex_env_3.7/lib/python3.7/site-packages/cudf/core/dataframe.py in __repr__(self)
   1835     def __repr__(self):
   1836         output = self._get_renderable_dataframe()
-> 1837         return self._clean_renderable_dataframe(output)
   1838 
   1839     def _repr_html_(self):

/home/.anaconda3/envs/alex_env_3.7/lib/python3.7/site-packages/cudf/core/dataframe.py in _clean_renderable_dataframe(self, output)
   1714             width = None
   1715 
-> 1716         output = output.to_pandas().to_string(
   1717             max_rows=max_rows,
   1718             min_rows=min_rows,

/home/.anaconda3/envs/alex_env_3.7/lib/python3.7/site-packages/cudf/core/dataframe.py in to_pandas(self, nullable, **kwargs)
   4737         for i, col_key in enumerate(self._data):
   4738             out_data[i] = self._data[col_key].to_pandas(
-> 4739                 index=out_index, nullable=nullable
   4740             )
   4741 

/home/.anaconda3/envs/alex_env_3.7/lib/python3.7/site-packages/cudf/core/column/numerical.py in to_pandas(self, index, nullable, **kwargs)
    580             pd_series = pd.Series(pandas_array, copy=False)
    581         elif str(self.dtype) in NUMERIC_TYPES and not self.has_nulls:
--> 582             pd_series = pd.Series(cupy.asnumpy(self.values), copy=False)
    583         else:
    584             pd_series = self.to_arrow().to_pandas(**kwargs)

/home/.anaconda3/envs/alex_env_3.7/lib/python3.7/site-packages/cudf/core/column/column.py in values(self)
    152             raise ValueError("Column must have no nulls.")
    153 
--> 154         return cupy.asarray(self.data_array_view)
    155 
    156     def find_and_replace(

/home/.anaconda3/envs/alex_env_3.7/lib/python3.7/site-packages/cudf/core/column/column.py in data_array_view(self)
     91         View the data as a device array object
     92         """
---> 93         return cuda.as_cuda_array(self.data).view(self.dtype)
     94 
     95     @property

/home/.anaconda3/envs/alex_env_3.7/lib/python3.7/site-packages/numba/cuda/api.py in as_cuda_array(obj, sync)
     75     else:
     76         return from_cuda_array_interface(obj.__cuda_array_interface__,
---> 77                                          owner=obj, sync=sync)
     78 
     79 

/home/.anaconda3/envs/alex_env_3.7/lib/python3.7/site-packages/numba/cuda/cudadrv/devices.py in _require_cuda_context(*args, **kws)
    229     @functools.wraps(fn)
    230     def _require_cuda_context(*args, **kws):
--> 231         with _runtime.ensure_context():
    232             return fn(*args, **kws)
    233 

/home/.anaconda3/envs/alex_env_3.7/lib/python3.7/contextlib.py in __enter__(self)
    110         del self.args, self.kwds, self.func
    111         try:
--> 112             return next(self.gen)
    113         except StopIteration:
    114             raise RuntimeError("generator didn't yield") from None

/home/.anaconda3/envs/alex_env_3.7/lib/python3.7/site-packages/numba/cuda/cudadrv/devices.py in ensure_context(self)
    119         any top-level Numba CUDA API.
    120         """
--> 121         with driver.get_active_context():
    122             oldctx = self._get_attached_context()
    123             newctx = self.get_or_create_context(None)

/home/.anaconda3/envs/alex_env_3.7/lib/python3.7/site-packages/numba/cuda/cudadrv/driver.py in __enter__(self)
    485             else:
    486                 hctx = drvapi.cu_context(0)
--> 487                 driver.cuCtxGetCurrent(byref(hctx))
    488                 hctx = hctx if hctx.value else None
    489 

/home/.anaconda3/envs/alex_env_3.7/lib/python3.7/site-packages/numba/cuda/cudadrv/driver.py in __getattr__(self, fname)
    282     def __getattr__(self, fname):
    283         # First request of a driver API function
--> 284         self.ensure_initialized()
    285 
    286         if self.initialization_error is not None:

/home/.anaconda3/envs/alex_env_3.7/lib/python3.7/site-packages/numba/cuda/cudadrv/driver.py in ensure_initialized(self)
    248             description = f"{e.msg} ({e.code})"
    249             self.initialization_error = description
--> 250             raise CudaSupportError(f"Error at driver init: {description}")
    251         else:
    252             self.pid = _getpid()

CudaSupportError: Error at driver init: Call to cuInit results in CUDA_ERROR_OPERATING_SYSTEM (304)

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 16 (8 by maintainers)

Most upvoted comments

That looks like a different issue. Your installation shows

 cudf-cu12 24.6.0 pypi_0 pypi

That looks wrong because the version of cudf-cu12 on PyPI is just a placeholder, the real package is on pypi.nvidia.com. Please try running

pip uninstall -y cudf-cu12
pip install --extra-index-url=https://pypi.nvidia.com cudf-cu12==24.6.*

and see if that fixes things for you. If it doesn’t please open a new issue to report the failure.