hyppo
hyppo copied to clipboard
Locator files?
My issue is about the fact that the package don't install with any sort of ease
Reproducing code example:
Find the docker file here https://github.com/microsoft/graspologic/blob/docker-dev/Dockerfile, or just pull the image from here:
docker pull neurodata/graspologic
Then, enter shell interactively:
docker run -ti --entrypoint /bin/bash neurodata/graspologic
$ pip install --upgrade hyppo==0.3.2 # I manually deprecated to 0.3.0 which doesn't share the issue, so upgrading back to 0.3.2 will re-introduce the bug
$ cd /home
$ ipython
$ >>> import hyppo # doesn't work
Error message
File <frozen importlib._bootstrap>:1007, in _find_and_load(name, import_)
File <frozen importlib._bootstrap>:986, in _find_and_load_unlocked(name, import_)
File <frozen importlib._bootstrap>:664, in _load_unlocked(spec)
File <frozen importlib._bootstrap>:627, in _load_backward_compatible(spec)
File <frozen zipimport>:259, in load_module(self, fullname)
File /usr/local/lib/python3.9/site-packages/hyppo-0.3.2-py3.9.egg/hyppo/__init__.py:1, in <module>
----> 1 import hyppo.discrim
2 import hyppo.independence
3 import hyppo.ksample
File <frozen importlib._bootstrap>:1007, in _find_and_load(name, import_)
File <frozen importlib._bootstrap>:986, in _find_and_load_unlocked(name, import_)
File <frozen importlib._bootstrap>:664, in _load_unlocked(spec)
File <frozen importlib._bootstrap>:627, in _load_backward_compatible(spec)
File <frozen zipimport>:259, in load_module(self, fullname)
File /usr/local/lib/python3.9/site-packages/hyppo-0.3.2-py3.9.egg/hyppo/discrim/__init__.py:1, in <module>
----> 1 from .discrim_one_samp import DiscrimOneSample
2 from .discrim_two_samp import DiscrimTwoSample
4 __all__ = [s for s in dir()]
File <frozen importlib._bootstrap>:1007, in _find_and_load(name, import_)
File <frozen importlib._bootstrap>:986, in _find_and_load_unlocked(name, import_)
File <frozen importlib._bootstrap>:664, in _load_unlocked(spec)
File <frozen importlib._bootstrap>:627, in _load_backward_compatible(spec)
File <frozen zipimport>:259, in load_module(self, fullname)
File /usr/local/lib/python3.9/site-packages/hyppo-0.3.2-py3.9.egg/hyppo/discrim/discrim_one_samp.py:5, in <module>
3 import numpy as np
4 from scipy._lib._util import MapWrapper
----> 5 from ._utils import _CheckInputs
6 from .base import DiscriminabilityTest
7 from sklearn.utils import check_random_state
File <frozen importlib._bootstrap>:1007, in _find_and_load(name, import_)
File <frozen importlib._bootstrap>:986, in _find_and_load_unlocked(name, import_)
File <frozen importlib._bootstrap>:664, in _load_unlocked(spec)
File <frozen importlib._bootstrap>:627, in _load_backward_compatible(spec)
File <frozen zipimport>:259, in load_module(self, fullname)
File /usr/local/lib/python3.9/site-packages/hyppo-0.3.2-py3.9.egg/hyppo/discrim/_utils.py:4, in <module>
1 import numpy as np
2 from sklearn.metrics import pairwise_distances
----> 4 from ..tools import check_ndarray_xy, check_reps, contains_nan, convert_xy_float64
7 class _CheckInputs:
8 """Checks inputs for discriminability tests"""
File <frozen importlib._bootstrap>:1007, in _find_and_load(name, import_)
File <frozen importlib._bootstrap>:986, in _find_and_load_unlocked(name, import_)
File <frozen importlib._bootstrap>:664, in _load_unlocked(spec)
File <frozen importlib._bootstrap>:627, in _load_backward_compatible(spec)
File <frozen zipimport>:259, in load_module(self, fullname)
File /usr/local/lib/python3.9/site-packages/hyppo-0.3.2-py3.9.egg/hyppo/tools/__init__.py:4, in <module>
2 from .indep_sim import *
3 from .ksample_sim import *
----> 4 from .power import *
5 from .time_series_sim import *
7 __all__ = [s for s in dir() if not s.startswith("_")]
File <frozen importlib._bootstrap>:1007, in _find_and_load(name, import_)
File <frozen importlib._bootstrap>:986, in _find_and_load_unlocked(name, import_)
File <frozen importlib._bootstrap>:664, in _load_unlocked(spec)
File <frozen importlib._bootstrap>:627, in _load_backward_compatible(spec)
File <frozen zipimport>:259, in load_module(self, fullname)
File /usr/local/lib/python3.9/site-packages/hyppo-0.3.2-py3.9.egg/hyppo/tools/power.py:5, in <module>
1 from math import ceil
3 import numpy as np
----> 5 from ..independence import INDEP_TESTS
6 from ..ksample import KSAMP_TESTS, KSample, k_sample_transform
7 from ..d_variate import MULTI_TESTS
File <frozen importlib._bootstrap>:1007, in _find_and_load(name, import_)
File <frozen importlib._bootstrap>:986, in _find_and_load_unlocked(name, import_)
File <frozen importlib._bootstrap>:664, in _load_unlocked(spec)
File <frozen importlib._bootstrap>:627, in _load_backward_compatible(spec)
File <frozen zipimport>:259, in load_module(self, fullname)
File /usr/local/lib/python3.9/site-packages/hyppo-0.3.2-py3.9.egg/hyppo/independence/__init__.py:3, in <module>
1 from ._utils import sim_matrix
2 from .cca import CCA
----> 3 from .dcorr import Dcorr
4 from .hhg import HHG
5 from .hsic import Hsic
File <frozen importlib._bootstrap>:1007, in _find_and_load(name, import_)
File <frozen importlib._bootstrap>:986, in _find_and_load_unlocked(name, import_)
File <frozen importlib._bootstrap>:664, in _load_unlocked(spec)
File <frozen importlib._bootstrap>:627, in _load_backward_compatible(spec)
File <frozen zipimport>:259, in load_module(self, fullname)
File /usr/local/lib/python3.9/site-packages/hyppo-0.3.2-py3.9.egg/hyppo/independence/dcorr.py:262, in <module>
248 stat, pvalue = super(Dcorr, self).test(
249 x,
250 y,
(...)
255 random_state=random_state,
256 )
258 return IndependenceTestOutput(stat, pvalue)
261 @jit(nopython=True, cache=True)
--> 262 def _center_distmat(distx, bias): # pragma: no cover
263 """Centers the distance matrices"""
264 n = distx.shape[0]
File /usr/local/lib/python3.9/site-packages/numba/core/decorators.py:212, in _jit.<locals>.wrapper(func)
208 disp = dispatcher(py_func=func, locals=locals,
209 targetoptions=targetoptions,
210 **dispatcher_args)
211 if cache:
--> 212 disp.enable_caching()
213 if sigs is not None:
214 # Register the Dispatcher to the type inference mechanism,
215 # even though the decorator hasn't returned yet.
216 from numba.core import typeinfer
File /usr/local/lib/python3.9/site-packages/numba/core/dispatcher.py:863, in Dispatcher.enable_caching(self)
862 def enable_caching(self):
--> 863 self._cache = FunctionCache(self.py_func)
File /usr/local/lib/python3.9/site-packages/numba/core/caching.py:613, in Cache.__init__(self, py_func)
611 self._name = repr(py_func)
612 self._py_func = py_func
--> 613 self._impl = self._impl_class(py_func)
614 self._cache_path = self._impl.locator.get_cache_path()
615 # This may be a bit strict but avoids us maintaining a magic number
File /usr/local/lib/python3.9/site-packages/numba/core/caching.py:350, in _CacheImpl.__init__(self, py_func)
348 break
349 else:
--> 350 raise RuntimeError("cannot cache function %r: no locator available "
351 "for file %r" % (qualname, source_path))
352 self._locator = locator
353 # Use filename base name as module name to avoid conflict between
354 # foo/__init__.py and foo/foo.py
RuntimeError: cannot cache function '_center_distmat': no locator available for file '/usr/local/lib/python3.9/site-packages/hyppo-0.3.2-py3.9.egg/hyppo/independence/dcorr.py'
Already tried all the standard numba
fixes, like manually setting the cache directory to a readable location, tried building numba
from scratch locally (via the latest working git tag, 0.55.2) after setting the cache directory, etc. A fix that shows how to properly install hyppo
would be good. I had this same issue setting up hyppo
for @aj-hersko and it was a PITA to work around if I recall. Can't seem to come up with whatever solution I arrived at last time, which ultimately worked, but took ~20m to arrive at for hyppo
installation and I don't seem to be able to replicate whatever I did that time.
UPDATE: the fix that I used was deprecating to hyppo 0.3.0, which fixed the problem, but obviously is undesirable as it results in hyppo 0.3.2 not being used.
Version information
- OS: docker debian latest and Mac OS Big Sur
- Python Version 3.9.13
- Package Version 0.3.2 hyppo; numba 0.55.2
NB: hyppo 0.3.0 does not suffer from this issue, and works successfully.