Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'CachedHTTPResponse' object has no attribute '__attrs_init__' #1392

Closed
gbloeb opened this issue Feb 3, 2022 · 5 comments
Closed
Labels
bug Something isn't working download nf-core download

Comments

@gbloeb
Copy link

gbloeb commented Feb 3, 2022

Description of the bug

When trying to run nf-core download (or nf-core list) I get the error:
AttributeError: 'CachedHTTPResponse' object has no attribute '__attrs_init__'

I have tried installing via bioconda or within a conda environment as suggested.

Full context below:

(nf-core) [gloeb@dev1 ~]$ nf-core download rnaseq

                                          ,--./,-.
          ___     __   __   __   ___     /,-._.--~\
    |\ | |__  __ /  ` /  \ |__) |__         }  {
    | \| |       \__, \__/ |  \ |___     \`-._,-`-,
                                          `._,._,'

    nf-core/tools version 2.2



╭────────────────────────────────────────────────────────────────────────────── Traceback (most recent call last) ──────────────────────────────────────────────────────────────────────────────╮
│                                                                                                                                                                                               │
│ /wynton/home/reiter/gloeb/miniconda3/envs/nf-core/bin/nf-core:10 in <module>                                                                                                                  │
│                                                                                                                                                                                               │
│    9sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])                                                                                                                     │
│ ❱ 10sys.exit(run_nf_core())                                                                                                                                                              │
│   11                                                                                                                                                                                          │
│ /wynton/home/reiter/gloeb/miniconda3/envs/nf-core/lib/python3.7/site-packages/nf_core/__main__.py:62 in run_nf_core                                                                           │
│                                                                                                                                                                                               │
│    61# Lanch the click cli                                                                                                                                                               │
│ ❱  62nf_core_cli()                                                                                                                                                                       │
│    63                                                                                                                                                                                         │
│                                                                                                                                                                                               │
│ /wynton/home/reiter/gloeb/miniconda3/envs/nf-core/lib/python3.7/site-packages/click/core.py:1128 in __call__                                                                                  │
│                                                                                                                                                                                               │
│   1127 │   │   """Alias for :meth:`main`."""                                                                                                                                                  │
│ ❱ 1128 │   │   return self.main(*args, **kwargs)                                                                                                                                              │
│   1129                                                                                                                                                                                        │
│                                                                                                                                                                                               │
│ /wynton/home/reiter/gloeb/miniconda3/envs/nf-core/lib/python3.7/site-packages/click/core.py:1053 in main                                                                                      │
│                                                                                                                                                                                               │
│   1052 │   │   │   │   with self.make_context(prog_name, args, **extra) as ctx:                                                                                                               │
│ ❱ 1053 │   │   │   │   │   rv = self.invoke(ctx)                                                                                                                                              │
│   1054 │   │   │   │   │   if not standalone_mode:                                                                                                                                            │
│                                                                                                                                                                                               │
│ /wynton/home/reiter/gloeb/miniconda3/envs/nf-core/lib/python3.7/site-packages/click/core.py:1659 in invoke                                                                                    │
│                                                                                                                                                                                               │
│   1658 │   │   │   │   with sub_ctx:                                                                                                                                                          │
│ ❱ 1659 │   │   │   │   │   return _process_result(sub_ctx.command.invoke(sub_ctx))                                                                                                            │
│   1660                                                                                                                                                                                        │
│                                                                                                                                                                                               │
│ /wynton/home/reiter/gloeb/miniconda3/envs/nf-core/lib/python3.7/site-packages/click/core.py:1395 in invoke                                                                                    │
│                                                                                                                                                                                               │
│   1394 │   │   if self.callback is not None:                                                                                                                                                  │
│ ❱ 1395 │   │   │   return ctx.invoke(self.callback, **ctx.params)                                                                                                                             │
│   1396                                                                                                                                                                                        │
│                                                                                                                                                                                               │
│ /wynton/home/reiter/gloeb/miniconda3/envs/nf-core/lib/python3.7/site-packages/click/core.py:754 in invoke                                                                                     │
│                                                                                                                                                                                               │
│    753 │   │   │   with ctx:                                                                                                                                                                  │
│ ❱  754 │   │   │   │   return __callback(*args, **kwargs)                                                                                                                                     │
│    755                                                                                                                                                                                        │
│                                                                                                                                                                                               │
│ /wynton/home/reiter/gloeb/miniconda3/envs/nf-core/lib/python3.7/site-packages/nf_core/__main__.py:234 in download                                                                             │
│                                                                                                                                                                                               │
│   233dl = nf_core.download.DownloadWorkflow(                                                                                                                                             │
│ ❱ 234 │   │   pipeline, revision, outdir, compress, force, container, singularity_cache_only,                                                                                                 │
│       parallel_downloads                                                                                                                                                                      │
│   235 │   )                                                                                                                                                                                   │
│                                                                                                                                                                                               │
│ /wynton/home/reiter/gloeb/miniconda3/envs/nf-core/lib/python3.7/site-packages/nf_core/download.py:109 in __init__                                                                             │
│                                                                                                                                                                                               │
│   108 │   │   self.wfs = nf_core.list.Workflows()                                                                                                                                             │
│ ❱ 109 │   │   self.wfs.get_remote_workflows()                                                                                                                                                 │
│   110                                                                                                                                                                                         │
│                                                                                                                                                                                               │
│ /wynton/home/reiter/gloeb/miniconda3/envs/nf-core/lib/python3.7/site-packages/nf_core/list.py:105 in get_remote_workflows                                                                     │
│                                                                                                                                                                                               │
│   104 │   │   nfcore_url = "https://nf-co.re/pipelines.json"                                                                                                                                  │
│ ❱ 105 │   │   response = requests.get(nfcore_url, timeout=10)                                                                                                                                 │
│   106 │   │   if response.status_code == 200:                                                                                                                                                 │
│                                                                                                                                                                                               │
│ /wynton/home/reiter/gloeb/miniconda3/envs/nf-core/lib/python3.7/site-packages/requests/api.py:75 in get                                                                                       │
│                                                                                                                                                                                               │
│    74 │                                                                                                                                                                                       │
│ ❱  75return request('get', url, params=params, **kwargs)                                                                                                                                 │
│    76                                                                                                                                                                                         │
│                                                                                                                                                                                               │
│ /wynton/home/reiter/gloeb/miniconda3/envs/nf-core/lib/python3.7/site-packages/requests/api.py:61 in request                                                                                   │
│                                                                                                                                                                                               │
│    60with sessions.Session() as session:                                                                                                                                                 │
│ ❱  61 │   │   return session.request(method=method, url=url, **kwargs)                                                                                                                        │
│    62                                                                                                                                                                                         │
│                                                                                                                                                                                               │
│ /wynton/home/reiter/gloeb/miniconda3/envs/nf-core/lib/python3.7/site-packages/requests_cache/session.py:115 in request                                                                        │
│                                                                                                                                                                                               │
│   114 │   │   with patch_form_boundary(**kwargs):                                                                                                                                             │
│ ❱ 115 │   │   │   return super().request(method, url, headers=headers, **kwargs)                                                                                                              │
│   116                                                                                                                                                                                         │
│                                                                                                                                                                                               │
│ /wynton/home/reiter/gloeb/miniconda3/envs/nf-core/lib/python3.7/site-packages/requests/sessions.py:529 in request                                                                             │
│                                                                                                                                                                                               │
│   528 │   │   send_kwargs.update(settings)                                                                                                                                                    │
│ ❱ 529 │   │   resp = self.send(prep, **send_kwargs)                                                                                                                                           │
│   530                                                                                                                                                                                         │
│                                                                                                                                                                                               │
│ /wynton/home/reiter/gloeb/miniconda3/envs/nf-core/lib/python3.7/site-packages/requests_cache/session.py:147 in send                                                                           │
│                                                                                                                                                                                               │
│   146 │   │   if cached_response is None:                                                                                                                                                     │
│ ❱ 147 │   │   │   response = self._send_and_cache(request, actions, **kwargs)                                                                                                                 │
│   148 │   │   elif is_expired and self.stale_if_error:                                                                                                                                        │
│                                                                                                                                                                                               │
│ /wynton/home/reiter/gloeb/miniconda3/envs/nf-core/lib/python3.7/site-packages/requests_cache/session.py:193 in _send_and_cache                                                                │
│                                                                                                                                                                                               │
│   192 │   │   if self._is_cacheable(response, actions):                                                                                                                                       │
│ ❱ 193 │   │   │   self.cache.save_response(response, actions.cache_key, actions.expires)                                                                                                      │
│   194 │   │   elif cached_response and response.status_code == 304:                                                                                                                           │
│                                                                                                                                                                                               │
│ /wynton/home/reiter/gloeb/miniconda3/envs/nf-core/lib/python3.7/site-packages/requests_cache/backends/base.py:95 in save_response                                                             │
│                                                                                                                                                                                               │
│    94 │   │   cache_key = cache_key or self.create_key(response.request)                                                                                                                      │
│ ❱  95 │   │   cached_response = CachedResponse.from_response(response, expires=expires)                                                                                                       │
│    96 │   │   cached_response = redact_response(cached_response, self.ignored_parameters)                                                                                                     │
│                                                                                                                                                                                               │
│ /wynton/home/reiter/gloeb/miniconda3/envs/nf-core/lib/python3.7/site-packages/requests_cache/models/response.py:59 in from_response                                                           │
│                                                                                                                                                                                               │
│    58 │   │   │   return attr.evolve(original_response, expires=expires)                                                                                                                      │
│ ❱  59 │   │   obj = cls(expires=expires, **kwargs)                                                                                                                                            │
│    60                                                                                                                                                                                         │
│ <attrs generated init requests_cache.models.response.CachedResponse>:30 in __init__                                                                                                           │
│                                                                                                                                                                                               │
│ /wynton/home/reiter/gloeb/miniconda3/envs/nf-core/lib/python3.7/site-packages/requests_cache/models/raw_response.py:36 in __init__                                                            │
│                                                                                                                                                                                               │
│   35 │   │   self.headers = HTTPHeaderDict(headers)                                                                                                                                           │
│ ❱ 36 │   │   self.__attrs_init__(*args, **kwargs)                                                                                                                                             │
│   37                                                                                                                                                                                          │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
AttributeError: 'CachedHTTPResponse' object has no attribute '__attrs_init__'

Command used and terminal output

No response

System information

No response

@gbloeb gbloeb added the bug Something isn't working label Feb 3, 2022
@oschwengers
Copy link

Same issue here...

@mashehu
Copy link
Contributor

mashehu commented Feb 3, 2022

Can you try the current dev version of nf-core/tools, which you can download via: pip install --upgrade --force-reinstall git+https://github.com/nf-core/tools.git@dev

@ewels
Copy link
Member

ewels commented Feb 4, 2022

We did fix some stuff to do with downloading the latest rnaseq release (#1385, #1379) but this looks different.. 🤔

This stack trace suggests that the error here is something to do with requests_cache and caching of API responses. It looks like it's coming from that dependency rather than any nf-core code.

Could you please try:

  • Deleting the nf-core API cache: ~/.nfcore/cache_3.7 (or something similar)
  • Installing the latest version of requests_cache: pip install --upgrade requests_cache
  • Running with the development branch of nf-core/tools, as suggested above by @mashehu

@gbloeb
Copy link
Author

gbloeb commented Feb 4, 2022 via email

@ewels
Copy link
Member

ewels commented Feb 7, 2022

Great stuff! I'll close for now, can reopen if more people hit the issue.

Should be releasing a new version of tools any day now.

@ewels ewels closed this as completed Feb 7, 2022
@edmundmiller edmundmiller added the download nf-core download label Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working download nf-core download
Projects
None yet
Development

No branches or pull requests

5 participants