dcor icon indicating copy to clipboard operation
dcor copied to clipboard

OSError: [Errno 36] File name too long when importing dcor

Open Quentin62 opened this issue 2 years ago • 4 comments

Importing dcor failed due to file name too long.

Ubuntu 20.04 python 3.8.10 dcor 0.5.3 numba 0.53.1 (+ 0.54.1)

>>> import dcor
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/quentin/.local/lib/python3.8/site-packages/dcor/__init__.py", line 14, in <module>
    from . import independence  # noqa
  File "/home/quentin/.local/lib/python3.8/site-packages/dcor/independence.py", line 11, in <module>
    from ._dcor import u_distance_correlation_sqr
  File "/home/quentin/.local/lib/python3.8/site-packages/dcor/_dcor.py", line 26, in <module>
    from ._fast_dcov_mergesort import _distance_covariance_sqr_mergesort_generic
  File "/home/quentin/.local/lib/python3.8/site-packages/dcor/_fast_dcov_mergesort.py", line 208, in <module>
    _distance_covariance_sqr_mergesort_generic_impl_compiled = numba.njit(
  File "/home/quentin/.local/lib/python3.8/site-packages/numba/core/decorators.py", line 221, in wrapper
    disp.compile(sig)
  File "/home/quentin/.local/lib/python3.8/site-packages/numba/core/dispatcher.py", line 891, in compile
    cres = self._cache.load_overload(sig, self.targetctx)
  File "/home/quentin/.local/lib/python3.8/site-packages/numba/core/caching.py", line 644, in load_overload
    return self._load_overload(sig, target_context)
  File "/home/quentin/.local/lib/python3.8/site-packages/numba/core/caching.py", line 651, in _load_overload
    data = self._cache_file.load(key)
  File "/home/quentin/.local/lib/python3.8/site-packages/numba/core/caching.py", line 495, in load
    overloads = self._load_index()
  File "/home/quentin/.local/lib/python3.8/site-packages/numba/core/caching.py", line 511, in _load_index
    with open(self._index_path, "rb") as f:
OSError: [Errno 36] File name too long: '/home/quentin/.local/lib/python3.8/site-packages/dcor/__pycache__/_fast_dcov_mergesort._generate_distance_covariance_sqr_mergesort_generic_impl.locals._distance_covariance_sqr_mergesort_generic_impl-163.py38.nbi'

Quentin62 avatar Oct 13 '21 08:10 Quentin62

Which version of Numba are you using?

vnmabus avatar Oct 13 '21 14:10 vnmabus

I have numba version 0.53.1. I tried with the latest (0.54.1) and I still have the same error.

Quentin62 avatar Oct 14 '21 08:10 Quentin62

Unfortunately, Numba uses very long names for the cache files. Also, your filesystem seems to accept less length than others.

The only "solution" I can recommend to you is to use the environment variable NUMBA_CACHE_DIR in order to place the files in a more shallow path and hope that is enough (see https://numba.pydata.org/numba-doc/dev/reference/envvars.html#numba-envvars-caching).

vnmabus avatar Oct 14 '21 10:10 vnmabus

Note also that if your Windows is up-to-date, you may be able to request that longer paths are accepted: https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry#enable-long-paths-in-windows-10-version-1607-and-later.

vnmabus avatar Oct 12 '22 11:10 vnmabus

I suppose you solved your problem, so I will close this issue. Please reopen it if the problem persists.

vnmabus avatar Dec 09 '22 08:12 vnmabus