mlfpm / deepof

DeepLabCut based data analysis package including pose estimation and representation learning mediated behavior recognition
MIT License
39 stars 6 forks source link

AttributeError: module 'google.protobuf.descriptor' has no attribute '_internal_create_key' #2

Closed chemarestrepoCB closed 1 year ago

chemarestrepoCB commented 1 year ago

deepof installation

I have tried installing deepof using pip install deepof, as well as cloning the git repository and installing the packages specified in the requirements.txt file, but I cannot manage to make deepof work on my machine. Here are the versions of python, pip and deepof of my environment

python 3.8.8 pip 22.2.2 deepof 0.1.85. pypi_0. pypi (Name, Version, Build, Channel)

I have been trying to install and use deepof for the past month (December 2022) without any luck.

Issue when trying to use deepof

When I try to import deepof into a session, I get the following error:

Python 3.8.8 (default, Apr 13 2021, 12:59:45) 
Type "copyright", "credits" or "license" for more information.

IPython 7.31.1 -- An enhanced Interactive Python.

In [1]: import deepof.data
Traceback (most recent call last):

  File "/var/folders/17/s91l3_md40jb4_ntdrcps71h0000gn/T/ipykernel_7564/2015942522.py", line 1, in <module>
    import deepof.data

  File "/Users/chemarestrepo/opt/anaconda3/lib/python3.8/site-packages/deepof/data.py", line 40, in <module>
    import deepof.unsupervised_utils

  File "/Users/chemarestrepo/opt/anaconda3/lib/python3.8/site-packages/deepof/unsupervised_utils.py", line 22, in <module>
    from keras_tuner import BayesianOptimization, Hyperband, Objective

  File "/Users/chemarestrepo/opt/anaconda3/lib/python3.8/site-packages/keras_tuner/__init__.py", line 17, in <module>
    from keras_tuner import oracles

  File "/Users/chemarestrepo/opt/anaconda3/lib/python3.8/site-packages/keras_tuner/oracles/__init__.py", line 17, in <module>
    from keras_tuner.tuners.bayesian import BayesianOptimizationOracle

  File "/Users/chemarestrepo/opt/anaconda3/lib/python3.8/site-packages/keras_tuner/tuners/__init__.py", line 16, in <module>
    from keras_tuner.tuners.bayesian import BayesianOptimization

  File "/Users/chemarestrepo/opt/anaconda3/lib/python3.8/site-packages/keras_tuner/tuners/bayesian.py", line 27, in <module>
    from keras_tuner.engine import hyperparameters as hp_module

  File "/Users/chemarestrepo/opt/anaconda3/lib/python3.8/site-packages/keras_tuner/engine/hyperparameters.py", line 27, in <module>
    from keras_tuner.engine import conditions as conditions_mod

  File "/Users/chemarestrepo/opt/anaconda3/lib/python3.8/site-packages/keras_tuner/engine/conditions.py", line 21, in <module>
    from keras_tuner.protos import keras_tuner_pb2

  File "/Users/chemarestrepo/opt/anaconda3/lib/python3.8/site-packages/keras_tuner/protos/keras_tuner_pb2.py", line 35, in <module>
    create_key=_descriptor._internal_create_key,

AttributeError: module 'google.protobuf.descriptor' has no attribute '_internal_create_key'

Issue trying to use the Docker image

I downloaded the Docker to avoid issues with environment inconsistencies. However, when trying to import deepof I get the following error:

root@8f1704bbcf86:/# python3
Python 3.9.14 (main, Oct  5 2022, 15:15:02) 
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import deepof
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'deepof'
>>> import deepof.data
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'deepof'

Any suggestions you might have, or if you require more information on my installation, please let me know

lucasmiranda42 commented 1 year ago

Hi, thank you very much for your interest in deepof, and apologies for the delay! I was unfortunately out of office.

The package is undergoing strong modifications at the moment, with new features and tutorials being added before its official release (scheduled for early February).

In the meantime, you should be able to install deepof in one of two ways:

1) By cloning the repo and installing the project with poetry:

Once the repository is cloned and poetry installed in a fresh environment (I suggest installing poetry with pipx; instructions can be found in the link above), just run poetry install in the main directory where you cloned the repo. After that, you should be able to open python and import deepof.

If the error with protobuf persists, try pip install protobuf~=3.20. There is a bug with TensorFlow and protobuf that we're still trying to fix.

2) Using the docker image.

The docker image was likely not up to date at the time you downloaded it. Feel free to try again, and let us know if you have any issues!

Last but not least, pip install should hopefully be up and running within the next two weeks.

Thanks again, and sorry for the trouble! Lucas

chemarestrepoCB commented 1 year ago

Hi Lucas,

Thank you for your thorough answer. I tried using poetry and all I can say is thank you for making me aware of this amazing resource. It worked perfectly.

Best

lucasmiranda42 commented 1 year ago

Wonderful! Please let us know if you have any further issues. Documentation will be shortly updated :)

Best, Lucas