Skip to content
This repository was archived by the owner on Oct 3, 2021. It is now read-only.
This repository was archived by the owner on Oct 3, 2021. It is now read-only.

Error when importing GPT2Client due to TensorFlow 2.0 #11

@AlbertSuarez

Description

@AlbertSuarez

After creating a virtualenv with Python 3.7.1 and installing gpt2-client w/o problems, as it shows here:

(env) ➜  test pip3 install gpt2-client       
Collecting gpt2-client
Collecting requests (from gpt2-client)
  Using cached https://files.pythonhosted.org/packages/51/bd/23c926cd341ea6b7dd0b2a00aba99ae0f828be89d72b2190f27c11d4b7fb/requests-2.22.0-py2.py3-none-any.whl
Collecting tqdm (from gpt2-client)
  Using cached https://files.pythonhosted.org/packages/e1/c1/bc1dba38b48f4ae3c4428aea669c5e27bd5a7642a74c8348451e0bd8ff86/tqdm-4.36.1-py2.py3-none-any.whl
Collecting numpy (from gpt2-client)
  Using cached https://files.pythonhosted.org/packages/b4/e8/5ececadd9cc220bb783b4ce6ffaa9266925d37ed41237bc23bc530ab4f3d/numpy-1.17.2-cp37-cp37m-macosx_10_6_intel.whl
Collecting regex (from gpt2-client)
Collecting tensorflow (from gpt2-client)
  Using cached https://files.pythonhosted.org/packages/2c/72/6b3264aa2889b7dde7663464b99587d95cd6a5f3b9b30181f14d78a63e64/tensorflow-2.0.0-cp37-cp37m-macosx_10_11_x86_64.whl
Collecting termcolor (from gpt2-client)
Collecting gpt-2-simple (from gpt2-client)
Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 (from requests->gpt2-client)
  Using cached https://files.pythonhosted.org/packages/e0/da/55f51ea951e1b7c63a579c09dd7db825bb730ec1fe9c0180fc77bfb31448/urllib3-1.25.6-py2.py3-none-any.whl
Collecting idna<2.9,>=2.5 (from requests->gpt2-client)
  Using cached https://files.pythonhosted.org/packages/14/2c/cd551d81dbe15200be1cf41cd03869a46fe7226e7450af7a6545bfc474c9/idna-2.8-py2.py3-none-any.whl
Collecting certifi>=2017.4.17 (from requests->gpt2-client)
  Using cached https://files.pythonhosted.org/packages/18/b0/8146a4f8dd402f60744fa380bc73ca47303cccf8b9190fd16a827281eac2/certifi-2019.9.11-py2.py3-none-any.whl
Collecting chardet<3.1.0,>=3.0.2 (from requests->gpt2-client)
  Using cached https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl
Collecting keras-applications>=1.0.8 (from tensorflow->gpt2-client)
  Using cached https://files.pythonhosted.org/packages/71/e3/19762fdfc62877ae9102edf6342d71b28fbfd9dea3d2f96a882ce099b03f/Keras_Applications-1.0.8-py3-none-any.whl
Collecting six>=1.10.0 (from tensorflow->gpt2-client)
  Using cached https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl
Collecting tensorflow-estimator<2.1.0,>=2.0.0 (from tensorflow->gpt2-client)
  Using cached https://files.pythonhosted.org/packages/95/00/5e6cdf86190a70d7382d320b2b04e4ff0f8191a37d90a422a2f8ff0705bb/tensorflow_estimator-2.0.0-py2.py3-none-any.whl
Collecting google-pasta>=0.1.6 (from tensorflow->gpt2-client)
  Using cached https://files.pythonhosted.org/packages/d0/33/376510eb8d6246f3c30545f416b2263eee461e40940c2a4413c711bdf62d/google_pasta-0.1.7-py3-none-any.whl
Requirement already satisfied: wheel>=0.26 in ./env/lib/python3.7/site-packages (from tensorflow->gpt2-client) (0.33.6)
Collecting absl-py>=0.7.0 (from tensorflow->gpt2-client)
Collecting astor>=0.6.0 (from tensorflow->gpt2-client)
  Using cached https://files.pythonhosted.org/packages/d1/4f/950dfae467b384fc96bc6469de25d832534f6b4441033c39f914efd13418/astor-0.8.0-py2.py3-none-any.whl
Collecting keras-preprocessing>=1.0.5 (from tensorflow->gpt2-client)
  Using cached https://files.pythonhosted.org/packages/28/6a/8c1f62c37212d9fc441a7e26736df51ce6f0e38455816445471f10da4f0a/Keras_Preprocessing-1.1.0-py2.py3-none-any.whl
Collecting tensorboard<2.1.0,>=2.0.0 (from tensorflow->gpt2-client)
  Using cached https://files.pythonhosted.org/packages/9b/a6/e8ffa4e2ddb216449d34cfcb825ebb38206bee5c4553d69e7bc8bc2c5d64/tensorboard-2.0.0-py3-none-any.whl
Collecting grpcio>=1.8.6 (from tensorflow->gpt2-client)
  Using cached https://files.pythonhosted.org/packages/75/07/f1d41d10519ca165b0e078949078f20beb57e7e46dc0f1d56b73bb01270a/grpcio-1.24.1-cp37-cp37m-macosx_10_9_x86_64.whl
Collecting wrapt>=1.11.1 (from tensorflow->gpt2-client)
Collecting opt-einsum>=2.3.2 (from tensorflow->gpt2-client)
Collecting gast==0.2.2 (from tensorflow->gpt2-client)
Collecting protobuf>=3.6.1 (from tensorflow->gpt2-client)
  Using cached https://files.pythonhosted.org/packages/a5/c6/a8b6a74ab1e165f0aaa673a46f5c895af8780976880c98934ae82060356d/protobuf-3.10.0-cp37-cp37m-macosx_10_9_intel.whl
Collecting toposort (from gpt-2-simple->gpt2-client)
  Using cached https://files.pythonhosted.org/packages/e9/8a/321cd8ea5f4a22a06e3ba30ef31ec33bea11a3443eeb1d89807640ee6ed4/toposort-1.5-py2.py3-none-any.whl
Collecting h5py (from keras-applications>=1.0.8->tensorflow->gpt2-client)
  Using cached https://files.pythonhosted.org/packages/1a/8b/4d01ae9a9d50a0bcc7b0b9aae41785d8d9de6fa9bba04dc20b1582181d2d/h5py-2.10.0-cp37-cp37m-macosx_10_6_intel.whl
Collecting markdown>=2.6.8 (from tensorboard<2.1.0,>=2.0.0->tensorflow->gpt2-client)
  Using cached https://files.pythonhosted.org/packages/c0/4e/fd492e91abdc2d2fcb70ef453064d980688762079397f779758e055f6575/Markdown-3.1.1-py2.py3-none-any.whl
Collecting werkzeug>=0.11.15 (from tensorboard<2.1.0,>=2.0.0->tensorflow->gpt2-client)
  Using cached https://files.pythonhosted.org/packages/ce/42/3aeda98f96e85fd26180534d36570e4d18108d62ae36f87694b476b83d6f/Werkzeug-0.16.0-py2.py3-none-any.whl
Requirement already satisfied: setuptools>=41.0.0 in ./env/lib/python3.7/site-packages (from tensorboard<2.1.0,>=2.0.0->tensorflow->gpt2-client) (41.2.0)
Installing collected packages: urllib3, idna, certifi, chardet, requests, tqdm, numpy, regex, six, h5py, keras-applications, termcolor, tensorflow-estimator, google-pasta, absl-py, astor, keras-preprocessing, markdown, protobuf, werkzeug, grpcio, tensorboard, wrapt, opt-einsum, gast, tensorflow, toposort, gpt-2-simple, gpt2-client
Successfully installed absl-py-0.8.0 astor-0.8.0 certifi-2019.9.11 chardet-3.0.4 gast-0.2.2 google-pasta-0.1.7 gpt-2-simple-0.6 gpt2-client-1.9.7 grpcio-1.24.1 h5py-2.10.0 idna-2.8 keras-applications-1.0.8 keras-preprocessing-1.1.0 markdown-3.1.1 numpy-1.17.2 opt-einsum-3.1.0 protobuf-3.10.0 regex-2019.8.19 requests-2.22.0 six-1.12.0 tensorboard-2.0.0 tensorflow-2.0.0 tensorflow-estimator-2.0.0 termcolor-1.1.0 toposort-1.5 tqdm-4.36.1 urllib3-1.25.6 werkzeug-0.16.0 wrapt-1.11.2

then when I try to import the GPT2Client class as it shows in the README:

from gpt2_client import GPT2Client

it blows up because can't find tensorflow.contrib

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/albert/Downloads/test/env/lib/python3.7/site-packages/gpt2_client/__init__.py", line 1, in <module>
    from gpt2_client.gpt2_client import GPT2Client
  File "/Users/albert/Downloads/test/env/lib/python3.7/site-packages/gpt2_client/gpt2_client.py", line 13, in <module>
    from tensorflow.contrib.training import HParams
ModuleNotFoundError: No module named 'tensorflow.contrib'

Maybe, I don't know, it's something related to the new 2.0 version of tensorflow.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions