question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AttributeError: 'ZarrStore' object has no attribute '_append_dim'

See original GitHub issue

My code is like this:

def compute_a_year(year, data=data, datatype=datatype):
            return map_decrease_rate(data=data, datatype=datatype, year=year)

def lmap(f, x):
    futures = dask_client.map(f, x)
    return dask_client.gather(futures)
        
return xr.concat(lmap(compute_a_year, years),
                         dim=xr.DataArray(years, dims='year', name='year'))

map_decrease_rate is a function that make a lengthy calculation.

I get the following error raised by dask_client.gather

AttributeError: 'ZarrStore' object has no attribute '_append_dim'

No calculation is performed, the error seems to be raised after moving the data, before the calculation is started.

the full traceback is:

~/anaconda3/lib/python3.7/site-packages/distributed/client.py in gather(self, futures, errors, direct, asynchronous)
   1989                 direct=direct,
   1990                 local_worker=local_worker,
-> 1991                 asynchronous=asynchronous,
   1992             )
   1993 

~/anaconda3/lib/python3.7/site-packages/distributed/client.py in sync(self, func, asynchronous, callback_timeout, *args, **kwargs)
    830         else:
    831             return sync(
--> 832                 self.loop, func, *args, callback_timeout=callback_timeout, **kwargs
    833             )
    834 

~/anaconda3/lib/python3.7/site-packages/distributed/utils.py in sync(loop, func, callback_timeout, *args, **kwargs)
    338     if error[0]:
    339         typ, exc, tb = error[0]
--> 340         raise exc.with_traceback(tb)
    341     else:
    342         return result[0]

~/anaconda3/lib/python3.7/site-packages/distributed/utils.py in f()
    322             if callback_timeout is not None:
    323                 future = asyncio.wait_for(future, callback_timeout)
--> 324             result[0] = yield future
    325         except Exception as exc:
    326             error[0] = sys.exc_info()

~/anaconda3/lib/python3.7/site-packages/tornado/gen.py in run(self)
    760 
    761                     try:
--> 762                         value = future.result()
    763                     except Exception:
    764                         exc_info = sys.exc_info()

~/anaconda3/lib/python3.7/site-packages/distributed/client.py in _gather(self, futures, errors, direct, local_worker)
   1848                             exc = CancelledError(key)
   1849                         else:
-> 1850                             raise exception.with_traceback(traceback)
   1851                         raise exc
   1852                     if errors == "skip":

~/.conda/envs/rsrt/lib/python3.7/site-packages/distributed/utils.py in offload()

~/.conda/envs/rsrt/lib/python3.7/concurrent/futures/thread.py in run()

~/.conda/envs/rsrt/lib/python3.7/site-packages/distributed/utils.py in <lambda>()

~/.conda/envs/rsrt/lib/python3.7/site-packages/distributed/worker.py in _deserialize()

~/.conda/envs/rsrt/lib/python3.7/site-packages/distributed/worker.py in loads_function()

~/.conda/envs/rsrt/lib/python3.7/site-packages/distributed/protocol/pickle.py in loads()

What happened:

AttributeError

What you expected to happen:

the calculation should stard in the “web status page”, but no, it does not.

Minimal Complete Verifiable Example:

I don’t have one, I’m not able to isolate the problem.

Anything else we need to know?:

Environment:

  • Dask version: - dask=2020.12.0=pyhd3eb1b0_0 - dask-core=2020.12.0=pyhd3eb1b0_0
  • Python version: 3.7.6
  • Operating System: linux
  • Install method (conda, pip, source): conda

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
jacobtomlinsoncommented, Jan 13, 2021

I hope you don’t mind I’ve just had a quick pass through this issue and added code fences and highlighting to make things a little more readable.

It looks like parts of the original comment had also been placed within a <!-- HTML comment --> block, which is why bits appeared to be missing.

0reactions
ghislainpcommented, Jan 20, 2021

I have remove dask.delayed and I have measured the time. The line: print(int((specialzone*mask).sum().compute())) takes 33s on my laptop and 190s on the cluster (i.e. from my laptop when using dask.distributed)

I don’t know how to measure graph size, but the following: len(pickle.dumps(sigma.data.dask.keyset())) gives 1.9Mb, which should reach the cluster in a few seconds from home.

The data to transfer are the ‘mask’ which is 5Mb.

The big zarr data is on the cluster (and on my laptop), in the same directory on both machines. It is not clear to me how dask determines that the file on the cluster should be used instead of the file on my machine. Is there some magic ? In any case, it is certain that the whole data are not transferred, otherwise it would take much much more than 190s. But still 190s is much more than 33s.

My problem is that the remaining of the processing (code not show) is much more expensive than 33s, and I really need the power of the cluster. I may give up and go for running directly the whole code on the cluster with joblib, but this is not so nice.

Read more comments on GitHub >

github_iconTop Results From Across the Web

'int' object has no attribute 'append' with no real reason for this
I recently started learning the python language, and was completing my "homework", i found an error and i cant realy find any solution,...
Read more >
How to Fix: 'numpy.ndarray' object has no attribute 'append'
This error occurs when you attempt to append one or more values to the end of a NumPy array by using the append()...
Read more >
Source code for zarr.storage
"""This module contains storage classes for use with Zarr arrays and groups. ... AttributeError as e: raise BadCompressorError(compressor) from e elif not ......
Read more >
xarray.Dataset.to_zarr
From the chunks attribute in each variable's encoding (can be set via ... read existing stores with consolidated metadata; if False, do not....
Read more >
Python AttributeError: 'str' object has no attribute 'append'
On Career Karma, learn about the Python AttributeError: 'str' object has no attribute 'append', how the error works, and how to solve the ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found