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

error when initializing the Geoparser #87

Open
ZhendongLiu opened this issue Dec 6, 2020 · 4 comments
Open

error when initializing the Geoparser #87

ZhendongLiu opened this issue Dec 6, 2020 · 4 comments

Comments

@ZhendongLiu
Copy link

Hi

I get the following error when initializing the Geoparser:

Traceback (most recent call last):
File "", line 1, in
File "/Users/ZhendongLiu/Desktop/CSC440/Project/mordecai-env/lib/python3.6/site-packages/mordecai/geoparse.py", line 53, in init
self.country_model = keras.models.load_model(models_path + "country_model.h5")
File "/Users/ZhendongLiu/Desktop/CSC440/Project/mordecai-env/lib/python3.6/site-packages/tensorflow/python/keras/saving/save.py", line 182, in load_model
return hdf5_format.load_model_from_hdf5(filepath, custom_objects, compile)
File "/Users/ZhendongLiu/Desktop/CSC440/Project/mordecai-env/lib/python3.6/site-packages/tensorflow/python/keras/saving/hdf5_format.py", line 176, in load_model_from_hdf5
model_config = json.loads(model_config.decode('utf-8'))
AttributeError: 'str' object has no attribute 'decode'

do you have any idea what's going on?

@ahalterman
Copy link
Member

It look like the error is coming from trying to decode a string that's already decoded (Stackoverflow link). Mordecai only works with Python 3, so you shouldn't have to do any string encoding/decoding.

@bdevore17
Copy link

bdevore17 commented Jan 13, 2021

@ahalterman I am having the same issue as @ZhendongLiu while using python 3.7. Any idea what could be going on here? Or how to fix it?

@ahalterman
Copy link
Member

This looks like a h5py and Keras incompatibility: tensorflow/tensorflow#44467. Changing the requirements file to h5py<3.0.0 should resolve it. I'll take a look over the weekend and push an update to pypi if that resolves it, but in the meantime, changing requirements.txt and installing from source should probably fix it (let me know either way!).

And @ZhendongLiu, I missed that you were using 3.6 already. Sorry about that.

@simonepstein
Copy link

simonepstein commented Jan 29, 2021

As a workaround I installed an earlier version of h5py after installin mordecai from pip.

pip install -I h5py==2.10.0

The eiffel tower example works fine now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants