AttributeError: module ‘murmurhash’ has no attribute ‘hash’

I’m unable to complete the first steps workflow. (https://prodi.gy/docs/workflow-first-steps)
I just installed the new 1.7.1 version and I’m receiving the following error when I got to localhost:8080

AttributeError: module ‘murmurhash’ has no attribute ‘hash’
(Full stack trace below)

I was successfully using Prodigy 1.6 previously.

I have removed and reinstalled Spacy, Prodigy and Murmurhash.
I’m using a conda environment, and have installed Prodigy with pip.

I had upgraded Spacy to the nightly build, but have since downgraded back to version 2.0.

Seems to be some kind of murmurhash issue. Please advise.

Stack trace:
Exception when serving /get_questions
Traceback (most recent call last):
File “/Users/mcoburn/anaconda3/envs/python3/lib/python3.6/site-packages/waitress/channel.py”, line 336, in service
task.service()
File “/Users/mcoburn/anaconda3/envs/python3/lib/python3.6/site-packages/waitress/task.py”, line 175, in service
self.execute()
File “/Users/mcoburn/anaconda3/envs/python3/lib/python3.6/site-packages/waitress/task.py”, line 452, in execute
app_iter = self.channel.server.application(env, start_response)
File “/Users/mcoburn/anaconda3/envs/python3/lib/python3.6/site-packages/hug/api.py”, line 423, in api_auto_instantiate
return module.hug_wsgi(*args, **kwargs)
File “/Users/mcoburn/anaconda3/envs/python3/lib/python3.6/site-packages/falcon/api.py”, line 244, in call
responder(req, resp, **params)
File “/Users/mcoburn/anaconda3/envs/python3/lib/python3.6/site-packages/hug/interface.py”, line 793, in call
raise exception
File “/Users/mcoburn/anaconda3/envs/python3/lib/python3.6/site-packages/hug/interface.py”, line 766, in call
self.render_content(self.call_function(input_parameters), context, request, response, **kwargs)
File “/Users/mcoburn/anaconda3/envs/python3/lib/python3.6/site-packages/hug/interface.py”, line 703, in call_function
return self.interface(**parameters)
File “/Users/mcoburn/anaconda3/envs/python3/lib/python3.6/site-packages/hug/interface.py”, line 100, in call
return __hug_internal_self._function(*args, **kwargs)
File “/Users/mcoburn/anaconda3/envs/python3/lib/python3.6/site-packages/prodigy/app.py”, line 173, in get_questions
tasks = controller.get_questions()
File “cython_src/prodigy/core.pyx”, line 129, in prodigy.core.Controller.get_questions
File “cython_src/prodigy/components/feeds.pyx”, line 56, in prodigy.components.feeds.SharedFeed.get_questions
File “cython_src/prodigy/components/feeds.pyx”, line 61, in prodigy.components.feeds.SharedFeed.get_next_batch
File “cython_src/prodigy/components/feeds.pyx”, line 131, in prodigy.components.feeds.SessionFeed.get_session_stream
File “/Users/mcoburn/anaconda3/envs/python3/lib/python3.6/site-packages/toolz/itertoolz.py”, line 368, in first
return next(iter(seq))
File “cython_src/prodigy/components/sorters.pyx”, line 151, in iter
File “cython_src/prodigy/components/sorters.pyx”, line 61, in genexpr
File “cython_src/prodigy/models/ner.pyx”, line 292, in call
File “cython_src/prodigy/models/ner.pyx”, line 259, in get_tasks
File “cytoolz/itertoolz.pyx”, line 1047, in cytoolz.itertoolz.partition_all.next
File “cython_src/prodigy/models/ner.pyx”, line 209, in predict_spans
File “cytoolz/itertoolz.pyx”, line 1047, in cytoolz.itertoolz.partition_all.next
File “cython_src/prodigy/components/preprocess.pyx”, line 35, in split_sentences
File “/Users/mcoburn/anaconda3/envs/python3/lib/python3.6/site-packages/spacy/language.py”, line 548, in pipe
for doc, context in izip(docs, contexts):
File “/Users/mcoburn/anaconda3/envs/python3/lib/python3.6/site-packages/spacy/language.py”, line 572, in pipe
for doc in docs:
File “nn_parser.pyx”, line 367, in pipe
File “cytoolz/itertoolz.pyx”, line 1047, in cytoolz.itertoolz.partition_all.next
File “nn_parser.pyx”, line 367, in pipe
File “cytoolz/itertoolz.pyx”, line 1047, in cytoolz.itertoolz.partition_all.next
File “pipeline.pyx”, line 431, in pipe
File “cytoolz/itertoolz.pyx”, line 1047, in cytoolz.itertoolz.partition_all.next
File “/Users/mcoburn/anaconda3/envs/python3/lib/python3.6/site-packages/spacy/language.py”, line 746, in _pipe
for doc in docs:
File “/Users/mcoburn/anaconda3/envs/python3/lib/python3.6/site-packages/spacy/language.py”, line 551, in
docs = (self.make_doc(text) for text in texts)
File “/Users/mcoburn/anaconda3/envs/python3/lib/python3.6/site-packages/spacy/language.py”, line 544, in
texts = (tc[0] for tc in text_context1)
File “cython_src/prodigy/components/preprocess.pyx”, line 34, in genexpr
File “cython_src/prodigy/components/filters.pyx”, line 35, in filter_duplicates
File “cython_src/prodigy/components/filters.pyx”, line 16, in filter_empty
File “cython_src/prodigy/components/loaders.pyx”, line 23, in _rehash_stream
File “cython_src/prodigy/util.pyx”, line 167, in prodigy.util.set_hashes
File “cython_src/prodigy/util.pyx”, line 197, in prodigy.util.get_hash
AttributeError: module ‘murmurhash’ has no attribute ‘hash’

I think your instinct was right and it definitely sounds like you ended up with a messy environment somehow. Prodigy 1.7.1 dropped the mmh3 hashing library that was causing problems for some users and replaced it with a new method in our own library, murmurhash. But for some reason, it sounds like your environment still has an old murmurhash version.

It's not the most satisfying answer, but sometimes it just helps to start off with a clean, virtual environment and then install Prodigy first. If you're installing, uninstalling, upgrading and downgrading a lot, it's easy to end up in a weird state. You just need one small leftover pip artifact in your site packages and the whole thing breaks.

1 Like

I think if you upgrade murmurhash the error goes away. (e.g. I switched to murmurhash==1.0.2 when I encountered this error.)

3 Likes

Yeah, created a new condo env solves the problem.

In my case, I already had murmurhash==1.0.2 installed. To fix the problem, I uninstalled murmurhash and reinstalled the prodigy-1.9*.whl, fixed the problem for me. BTW, the new prodigy-1.9 upgrade fixed a lot of the Windows 10 install problems I was having. Thank you for making these improvements.

1 Like

Just adding a solution that worked for me for anyone struggling with this when using conda.

Having run into this problem I created a new condaenv, activated the env and installed spacy (using conda install -c conda-forge spacy) and then the models and prodigy into the env. However, I still ran into the murmurhash error when launching prodigy. The solution in my case was to then overwrite the murmurhash installed with spacy by using conda install -c anaconda murmurhash. Prodigy then worked as expected.

No idea what is going on under the hood here, but documenting in case it helps someone else.