4

I have installed DeepPoseKit using the guide on the github page.

I have the following tensorflow-gpu version:

[jalal@goku examples]$ python -c 'import tensorflow as tf; print(tf.__version__)'
/scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:526: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint8 = np.dtype([("qint8", np.int8, 1)])
/scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:527: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:528: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint16 = np.dtype([("qint16", np.int16, 1)])
/scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:529: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:530: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint32 = np.dtype([("qint32", np.int32, 1)])
/scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:535: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  np_resource = np.dtype([("resource", np.ubyte, 1)])
/scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters
1.13.1

How can I fix the following error:

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-4-1cceeb3fcd52> in <module>()
      5 import glob
      6 
----> 7 from deepposekit.io import TrainingGenerator, DataGenerator
      8 from deepposekit.augment import FlipAxis
      9 import imgaug.augmenters as iaa

/scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages/deepposekit/__init__.py in <module>()
     18 import warnings
     19 
---> 20 from deepposekit.io import TrainingGenerator, DataGenerator
     21 from deepposekit.augment.FlipAxis import FlipAxis
     22 

/scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages/deepposekit/io/__init__.py in <module>()
     16 from __future__ import absolute_import
     17 
---> 18 from deepposekit.io.BaseGenerator import BaseGenerator
     19 from deepposekit.io.DataGenerator import DataGenerator
     20 from deepposekit.io.ImageGenerator import ImageGenerator

/scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages/deepposekit/io/BaseGenerator.py in <module>()
     14 # limitations under the License.
     15 
---> 16 from tensorflow.keras.utils import Sequence
     17 import numpy as np
     18 

ModuleNotFoundError: No module named 'tensorflow.keras'

My keras version is:

[jalal@goku examples]$ which python 
/scratch/sjn-p3/anaconda/anaconda3/bin/python
[jalal@goku examples]$ python
Python 3.6.7 | packaged by conda-forge | (default, Feb 28 2019, 09:07:38) 
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import keras
/scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters
Using TensorFlow backend.
/scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:526: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint8 = np.dtype([("qint8", np.int8, 1)])
/scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:527: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:528: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint16 = np.dtype([("qint16", np.int16, 1)])
/scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:529: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:530: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint32 = np.dtype([("qint32", np.int32, 1)])
/scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:535: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  np_resource = np.dtype([("resource", np.ubyte, 1)])
>>> keras.__version__
'2.3.1'
$ uname -a
Linux goku.bu.edu 3.10.0-1062.4.3.el7.x86_64 #1 SMP Wed Nov 13 23:58:53 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

$ lsb_release -a
LSB Version:    :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description:    CentOS Linux release 7.7.1908 (Core)
Release:    7.7.1908
Codename:   Core

My DeepPoseKit version is:

>>> import deepposekit
/scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:526: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint8 = np.dtype([("qint8", np.int8, 1)])
/scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:527: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:528: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint16 = np.dtype([("qint16", np.int16, 1)])
/scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:529: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:530: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint32 = np.dtype([("qint32", np.int32, 1)])
/scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:535: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  np_resource = np.dtype([("resource", np.ubyte, 1)])
/scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters
>>> deepposekit.__version__
'0.3.4'
Mona Jalal
  • 34,860
  • 64
  • 239
  • 408
  • as I know in the newest `tensorflow` (`2.x`) `keras` is part of `tensorflow` and it can be imported `import tensorflow.keras` like in your error message. Maybe you have to update `tensorflow` to `2.x` - [Keras vs. tf.keras: What’s the difference in TensorFlow 2.0?](https://www.pyimagesearch.com/2019/10/21/keras-vs-tf-keras-whats-the-difference-in-tensorflow-2-0/) – furas Dec 08 '19 at 03:40
  • I want to install 1.15 or 1.14 not 2 – Mona Jalal Dec 08 '19 at 03:45
  • the author suggested ~=1.14 – Mona Jalal Dec 08 '19 at 03:45
  • 2
    do you have problem to run `import tensorflow.keras` in current version ? I checked right now I can run `import tensorflow.keras` with `tensorflow 1.14.0` – furas Dec 08 '19 at 03:49
  • thanks @furas for your reply. While I was trying different TFs, I came across ~=1.14 suggested by the repo's author. Now I have this problem. I have to be honest that I cannot reproduce the problem above anymore https://stackoverflow.com/questions/59232286/error-cannot-uninstall-wrapt-when-installing-tensorflow-gpu-1-14 thanks for having a look! – Mona Jalal Dec 08 '19 at 03:52
  • seems the one that author has said, aka ~=1.14 installs 1.15 – Mona Jalal Dec 08 '19 at 03:52
  • 1
    I installed `DeepPoseKit` and I can import it - ie. `from deepposekit.io import TrainingGenerator, DataGenerator` – furas Dec 08 '19 at 03:53
  • could you please tell me what is the version of tensorflow-gpu and keras that you have? also what is your CUDA version? – Mona Jalal Dec 08 '19 at 03:53
  • 1
    I have so old computer that I don't have GPU which could run with CUDA. I use tensorflow-cpu 1.14.0 because it is probably last version which can run on my computer. – furas Dec 08 '19 at 03:55
  • yeah even in this SO post I could initially import deepposekit. The problem started when I imported keras. – Mona Jalal Dec 08 '19 at 03:56
  • I have no problem to run `from tensorflow.keras.utils import Sequence` – furas Dec 08 '19 at 04:01
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/203829/discussion-between-mona-jalal-and-furas). – Mona Jalal Dec 08 '19 at 04:17

1 Answers1

1

That's because you have an older version of TensorFlow.

pip install tensorflow==1.14.0

This will uninstall the previous version and will install 1.14.0.

This worked for me :)

Sai Krishnadas
  • 2,863
  • 9
  • 36
  • 69
  • 1
    As of February 2022, can't install `pip install tensorflow==1.14`, because `Could not find a version that satisfies the requirement` –  Feb 07 '22 at 17:40
  • 1
    Version 2.2.1 works fine, `pip install tensorflow==2.2.1` –  Feb 07 '22 at 18:21