lmcinnes / pynndescent

A Python nearest neighbor descent for approximate nearest neighbors
BSD 2-Clause "Simplified" License
899 stars 105 forks source link

Trouble installing pynndescent "permanently" in colab #126

Closed drob-xx closed 3 years ago

drob-xx commented 3 years ago

I'm installing pynndescent on my gdrive so I can symlink to it during a colab session. Without doing this I'm forced to install bertopic (the package I'm working with and which works just fine) every time I start a new session. By installing it on my gdrive and then linking to it during a session I'm avoiding the overhead of re-installing.

pynndescent is a dependency for bertopic. When importing bertopic it errored out on pynndescent not being available as well as two other packages. I successfully installed the others with no problem. However, despite multiple attempts at installing, un-installing and upgrading (all successful according to pip) pynndescent is still popping an error:

DistributionNotFound: The 'pynndescent' distribution was not found and is required by the application

I did find a similar issue here but the solution doesn't seem relevant to my situation. Help appreciated.

sgbaird commented 3 years ago

@drob-xx why did you close this? If you figured out a solution, do you mind posting here? I'm running into issues with using pynndescent on Google Colab as well.

My stack trace:

/usr/local/lib/python3.7/site-packages/umap/__init__.py in <module>()
      1 from warnings import warn, catch_warnings, simplefilter
----> 2 from .umap_ import UMAP
      3 
      4 try:
      5     with catch_warnings():

/usr/local/lib/python3.7/site-packages/umap/umap_.py in <module>()
     45 )
     46 
---> 47 from pynndescent import NNDescent
     48 from pynndescent.distances import named_distances as pynn_named_distances
     49 from pynndescent.sparse import sparse_named_distances as pynn_sparse_named_distances

/usr/local/lib/python3.7/site-packages/pynndescent/__init__.py in <module>()
     13         numba.config.THREADING_LAYER = "workqueue"
     14 
---> 15 __version__ = pkg_resources.get_distribution("pynndescent").version

/usr/local/lib/python3.7/dist-packages/pkg_resources/__init__.py in get_distribution(dist)
    464         dist = Requirement.parse(dist)
    465     if isinstance(dist, Requirement):
--> 466         dist = get_provider(dist)
    467     if not isinstance(dist, Distribution):
    468         raise TypeError("Expected string, Requirement, or Distribution", dist)

/usr/local/lib/python3.7/dist-packages/pkg_resources/__init__.py in get_provider(moduleOrReq)
    340     """Return an IResourceProvider for the named module or requirement"""
    341     if isinstance(moduleOrReq, Requirement):
--> 342         return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
    343     try:
    344         module = sys.modules[moduleOrReq]

/usr/local/lib/python3.7/dist-packages/pkg_resources/__init__.py in require(self, *requirements)
    884         included, even if they were already activated in this working set.
    885         """
--> 886         needed = self.resolve(parse_requirements(requirements))
    887 
    888         for dist in needed:

/usr/local/lib/python3.7/dist-packages/pkg_resources/__init__.py in resolve(self, requirements, env, installer, replace_conflicting, extras)
    770                     if dist is None:
    771                         requirers = required_by.get(req, None)
--> 772                         raise DistributionNotFound(req, requirers)
    773                 to_activate.append(dist)
    774             if dist not in req:

DistributionNotFound: The 'pynndescent' distribution was not found and is required by the application