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.

Importing dask.distributed.Client causes `TypeError: unhashable type: 'types.SimpleNamespace'` (not using it)

See original GitHub issue

My alive_bar was working quite well for some time. Then, I implemented an optional branch in my program for parallel execution of some stuff using a Dask dataframe. In the course of implementing that branch, the alive_bar stopped working even in the serial-only branch. Turns out, it’s due to the import statement importing the dask.distributed.Client class. See my MWE below. Thanks!

import time
import dask
from dask.distributed import Client                        # this is the one that breaks alive_progress!
from alive_progress import alive_bar

total_reps = 100

with alive_bar(total=total_reps, force_tty=True) as bar:
    for i in range(total_reps):
        time.sleep(0.5)
        bar()

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
rsalmeicommented, Nov 7, 2022

Thanks @chrsdrdt, but this ticket is specific for that Dask Client. The correct place would probably be #155. Please post it there, along with whether your setup might be reusing log handlers…

0reactions
chrsdrdtcommented, Nov 7, 2022

I do habe the same problem, running on version 2.4.1. If I run the code again, it works fine for the failed setting. I’m running my code several times, but it seems that it fails randomly

  File "**censored***/experiments.py", line 57, in <module>
    train(log_file=log_file_list_train,
  File "**censored***/venv/lib/python3.10/site-packages/**censored***/__init__.py", line 77, in train
    la.run()
  File "**censored***/venv/lib/python3.10/site-packages/**censored***/backend/LogAnalyzer/LogAnalyzer.py", line 146, in run
    self.analyze_event_log_characteristics()
  File "**censored***/venv/lib/python3.10/site-packages/**censored***/backend/LogAnalyzer/LogAnalyzer.py", line 233, in analyze_event_log_characteristics
    with alive_progress.alive_bar(len(self.log_file_imported), title="Analyzing basic characteristics") as bar:
  File "/usr/lib/python3.10/contextlib.py", line 142, in __exit__
    next(self.gen)
  File "**censored***/venv/lib/python3.10/site-packages/alive_progress/core/progress.py", line 284, in __alive_bar
    stop_monitoring()
  File "**censored***/venv/lib/python3.10/site-packages/alive_progress/core/progress.py", line 170, in stop_monitoring
    hook_manager.uninstall()
  File "**censored***/venv/lib/python3.10/site-packages/alive_progress/core/hook_manager.py", line 85, in uninstall
    [_set_stream(handler, original_stream)
  File "**censored***/venv/lib/python3.10/site-packages/alive_progress/core/hook_manager.py", line 85, in <listcomp>
    [_set_stream(handler, original_stream)
  File "**censored***/venv/lib/python3.10/site-packages/alive_progress/core/hook_manager.py", line 134, in _set_stream
    return handler.setStream(stream)
  File "/usr/lib/python3.10/logging/__init__.py", line 1124, in setStream
    self.flush()
  File "/usr/lib/python3.10/logging/__init__.py", line 1084, in flush
    self.stream.flush()
  File "**censored***/venv/lib/python3.10/site-packages/alive_progress/core/hook_manager.py", line 33, in flush
    if buffers[stream]:
TypeError: unhashable type: 'types.SimpleNamespace'
Read more comments on GitHub >

github_iconTop Results From Across the Web

Array compute method fails with "TypeError: unhashable type ...
from dask.core import flatten import dask.array as da from distributed import Client c = Client(resources={'a':2}) A = da.ones((100,100), ...
Read more >
TypeError : Unhashable type - python - Stack Overflow
You are creating a set via set(...) call, and set needs hashable items. You can't have set of lists. Because list's arent hashable....
Read more >
How to Handle Unhashable Type List Exceptions in Python
The Python TypeError: Unhashable Type: 'list' happens when a mutable list, instead of an immutable tuple, is used as a hash argument.
Read more >
Unhashable Type Python Error Explained: How To Fix It
The message “TypeError: unhashable type” appears in a Python program when you try to use a data type that is not hashable in...
Read more >
TypeError: unhashable type: 'dict' - Discussions on Python.org
Hello, Here is my error: TypeError: unhashable type: 'dict' Here is the source that is used to handle such an output error: #...
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