sacdallago / bio_embeddings

Get protein embeddings from protein sequences
http://docs.bioembeddings.com
MIT License
463 stars 65 forks source link

FileNotFoundError METADATA #160

Open nprime496 opened 3 years ago

nprime496 commented 3 years ago

Hey, I get this weird error each time the first time I try to use bio_embeddings package, then it disappears the next times.

Screenshot from 2021-09-01 12-31-31

nprime496 commented 3 years ago
Complete stacktrace
``` AttributeError Traceback (most recent call last) /usr/local/lib/python3.7/dist-packages/pkg_resources/__init__.py in _dep_map(self) 3015 try: -> 3016 return self.__dep_map 3017 except AttributeError: 19 frames /usr/local/lib/python3.7/dist-packages/pkg_resources/__init__.py in __getattr__(self, attr) 2812 if attr.startswith('_'): -> 2813 raise AttributeError(attr) 2814 return getattr(self._provider, attr) AttributeError: _DistInfoDistribution__dep_map During handling of the above exception, another exception occurred: AttributeError Traceback (most recent call last) /usr/local/lib/python3.7/dist-packages/pkg_resources/__init__.py in _parsed_pkg_info(self) 3006 try: -> 3007 return self._pkg_info 3008 except AttributeError: /usr/local/lib/python3.7/dist-packages/pkg_resources/__init__.py in __getattr__(self, attr) 2812 if attr.startswith('_'): -> 2813 raise AttributeError(attr) 2814 return getattr(self._provider, attr) AttributeError: _pkg_info During handling of the above exception, another exception occurred: FileNotFoundError Traceback (most recent call last) in () ----> 1 import bio_embeddings 2 bio_embeddings.__version__ /usr/local/lib/python3.7/dist-packages/bio_embeddings/__init__.py in () 12 import bio_embeddings.embed 13 import bio_embeddings.extract ---> 14 import bio_embeddings.project 15 import bio_embeddings.utilities 16 import bio_embeddings.visualize /usr/local/lib/python3.7/dist-packages/bio_embeddings/project/__init__.py in () 3 from bio_embeddings.project.pb_tucker import PBTucker, PBTuckerModel 4 from bio_embeddings.project.tsne import tsne_reduce ----> 5 from bio_embeddings.project.umap import umap_reduce 6 7 __all__ = [ /usr/local/lib/python3.7/dist-packages/bio_embeddings/project/umap.py in () ----> 1 from umap import UMAP 2 3 4 def umap_reduce(embeddings, **kwargs): 5 """Wrapper around :meth:`umap.UMAP` with defaults for bio_embeddings""" /usr/local/lib/python3.7/dist-packages/umap/__init__.py in () 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/dist-packages/umap/umap_.py in () 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/dist-packages/pynndescent/__init__.py in () 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) 778 779 # push the new requirements onto the stack --> 780 new_requirements = dist.requires(req.extras)[::-1] 781 requirements.extend(new_requirements) 782 /usr/local/lib/python3.7/dist-packages/pkg_resources/__init__.py in requires(self, extras) 2732 def requires(self, extras=()): 2733 """List of Requirements needed for this distro if `extras` are used""" -> 2734 dm = self._dep_map 2735 deps = [] 2736 deps.extend(dm.get(None, ())) /usr/local/lib/python3.7/dist-packages/pkg_resources/__init__.py in _dep_map(self) 3016 return self.__dep_map 3017 except AttributeError: -> 3018 self.__dep_map = self._compute_dependencies() 3019 return self.__dep_map 3020 /usr/local/lib/python3.7/dist-packages/pkg_resources/__init__.py in _compute_dependencies(self) 3025 reqs = [] 3026 # Including any condition expressions -> 3027 for req in self._parsed_pkg_info.get_all('Requires-Dist') or []: 3028 reqs.extend(parse_requirements(req)) 3029 /usr/local/lib/python3.7/dist-packages/pkg_resources/__init__.py in _parsed_pkg_info(self) 3007 return self._pkg_info 3008 except AttributeError: -> 3009 metadata = self.get_metadata(self.PKG_INFO) 3010 self._pkg_info = email.parser.Parser().parsestr(metadata) 3011 return self._pkg_info /usr/local/lib/python3.7/dist-packages/pkg_resources/__init__.py in get_metadata(self, name) 1405 return "" 1406 path = self._get_metadata_path(name) -> 1407 value = self._get(path) 1408 try: 1409 return value.decode('utf-8') /usr/local/lib/python3.7/dist-packages/pkg_resources/__init__.py in _get(self, path) 1609 1610 def _get(self, path): -> 1611 with open(path, 'rb') as stream: 1612 return stream.read() 1613 FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/lib/python3.7/dist-packages/scikit_learn-0.22.2.post1.dist-info/METADATA' ```
sacdallago commented 3 years ago

Yeah, I guess this happens on Colab? I don't know, Colab remains a mistery to me, it does weird things. I happen to get some "errors" on there, too, and upon re-executing the same cell: error's gone. REALLY difficult to debug :(

konstin commented 3 years ago

This is essentially the same as #123, but with another package. I've filed https://github.com/lmcinnes/pynndescent/pull/137 to fix this upstream. If required I can also add some hacky solution to work around this before we get the upstream fix.