biobricks-ai / biobricks

BioBricks makes loading data from biological datasets and databases easy. Python and R interfaces, data version control, and an API for pulling datasets that have been converted to easy-to-use formats.
https://docs.biobricks.ai
MIT License
5 stars 2 forks source link

Issue with loading CTDbase brick #8

Closed Larsdegroot closed 8 months ago

Larsdegroot commented 1 year ago

I'm trying to install the brick for ctdbase but it ends with this error:

Code & output:

import biobricks as bb
bb.install("ctdbase")

out:

[14/Apr/2023 14:07:15] INFO - getting latest version of https://github.com/biobricks-ai/ctdbase
[14/Apr/2023 14:07:16] INFO - running checks on brick
[14/Apr/2023 14:07:17] INFO - git clone https://github.com/biobricks-ai/ctdbase biobricks-ai/ctdbase/6703707d91477202eea193b9130f2854ada4cb86 in bricks_storage
[14/Apr/2023 14:07:17] INFO - adding brick to dvc cache
[14/Apr/2023 14:07:18] INFO - setting up credentials for dvc.biobricks.ai
[14/Apr/2023 14:07:20] INFO - discovering brick assets dvc.biobricks.ai

Error message:

---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
Cell In[1], line 2
      1 import biobricks as bb
----> 2 bb.install("ctdbase")

File ~/Documents/GitHub/bio_bricks/venv/lib/python3.10/site-packages/biobricks/api.py:23, in install(brick)
     21 """Install a brick from a remote repository"""
     22 check_configured()
---> 23 return Brick.Resolve(brick).install()

File ~/Documents/GitHub/bio_bricks/venv/lib/python3.10/site-packages/biobricks/brick.py:146, in Brick.install(self)
    143 rsys(f"dvc remote modify --local biobricks.ai password {token()}")
    145 logger.info(f"discovering brick assets dvc.biobricks.ai")
--> 146 fs = dvc.api.DVCFileSystem(self.path())
    147 paths = fs.find("data",maxdepth=1) + fs.find("brick",maxdepth=1)
    148 parquet_paths = [x for x in paths if x.endswith('.parquet')]

File ~/Documents/GitHub/bio_bricks/venv/lib/python3.10/site-packages/fsspec/spec.py:76, in _Cached.__call__(cls, *args, **kwargs)
     74     return cls._cache[token]
     75 else:
---> 76     obj = super().__call__(*args, **kwargs)
     77     # Setting _fs_token here causes some static linters to complain.
     78     obj._fs_token_ = token

File ~/Documents/GitHub/bio_bricks/venv/lib/python3.10/site-packages/dvc/fs/dvc.py:120, in _DVCFileSystem.__init__(self, url, rev, repo, subrepos, repo_factory, **repo_kwargs)
    118 super().__init__()
    119 if repo is None:
--> 120     repo = self._make_repo(url=url, rev=rev, subrepos=subrepos, **repo_kwargs)
    121     assert repo is not None
    122     # pylint: disable=protected-access

File ~/Documents/GitHub/bio_bricks/venv/lib/python3.10/site-packages/dvc/fs/dvc.py:179, in _DVCFileSystem._make_repo(cls, **kwargs)
    175 @classmethod
    176 def _make_repo(cls, **kwargs) -> "Repo":
    177     from dvc.repo import Repo
--> 179     with Repo.open(uninitialized=True, **kwargs) as repo:
    180         return repo

File ~/Documents/GitHub/bio_bricks/venv/lib/python3.10/site-packages/dvc/repo/__init__.py:293, in Repo.open(url, *args, **kwargs)
    291 if os.path.exists(url):
    292     try:
--> 293         return Repo(url, *args, **kwargs)
    294     except NotDvcRepoError:
    295         pass  # fallthrough to external_repo

File ~/Documents/GitHub/bio_bricks/venv/lib/python3.10/site-packages/dvc/repo/__init__.py:222, in Repo.__init__(self, root_dir, fs, rev, subrepos, uninitialized, config, url, repo_factory, scm)
    218     self.cache = CacheManager(self)
    220     self.stage_cache = StageCache(self)
--> 222     self._ignore()
    224 self.metrics: Metrics = Metrics(self)
    225 self.plots: Plots = Plots(self)

File ~/Documents/GitHub/bio_bricks/venv/lib/python3.10/site-packages/dvc/repo/__init__.py:435, in Repo._ignore(self)
    432     flist.append(self.cache.repo.path)
    434 for file in flist:
--> 435     self.scm_context.ignore(file)

File ~/Documents/GitHub/bio_bricks/venv/lib/python3.10/site-packages/dvc/repo/scm_context.py:77, in SCMContext.ignore(self, path)
     74 from dvc.scm import SCMError
     76 try:
---> 77     gitignore_file = self.scm.ignore(path)
     78 except FileNotInRepoError as exc:
     79     raise SCMError(str(exc))  # noqa: B904

File ~/Documents/GitHub/bio_bricks/venv/lib/python3.10/site-packages/scmrepo/git/__init__.py:193, in Git.ignore(self, path)
    190 if self.is_ignored(path):
    191     return None
--> 193 self._add_entry_to_gitignore(entry, gitignore)
    194 return gitignore

File ~/Documents/GitHub/bio_bricks/venv/lib/python3.10/site-packages/scmrepo/git/__init__.py:199, in Git._add_entry_to_gitignore(self, entry, gitignore)
    196 def _add_entry_to_gitignore(self, entry, gitignore):
    197     entry = GitWildMatchPattern.escape(entry)
--> 199     with open(gitignore, "a+", encoding="utf-8") as fobj:
    200         unique_lines = set(fobj.readlines())
    201         fobj.seek(0, os.SEEK_END)

FileNotFoundError: [Errno 2] No such file or directory: '/Users/lars/Documents/GitHub/bio_bricks/bricks_storage/biobricks-ai/ctdbase/6703707d91477202eea193b9130f2854ada4cb86/.dvc/../bricks_storage/.gitignore'
tomlue commented 9 months ago

Does the directory /Users/lars/Documents/GitHub/bio_bricks/bricks_storage/ exist on your machine?

tomlue commented 8 months ago

bb.install is no longer recommended, please use biobricks install <brick> with the command line tool and then in python

import biobricks as bb
assets = bb.assets('brickref')