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

cloudpickle v1.5.0 breaks TensorFlow Probability #390

Open
matthewfeickert opened this issue Jul 2, 2020 · 4 comments
Open

cloudpickle v1.5.0 breaks TensorFlow Probability #390

matthewfeickert opened this issue Jul 2, 2020 · 4 comments

Comments

@matthewfeickert
Copy link

matthewfeickert commented Jul 2, 2020

Hi. I'm just reporting that cloudpickle v1.5.0 currently breaks TensorFlow Probability v0.10.0 entirely. This is more of a heads up as you'll probably be getting some other reports.

This is currenlty detailed in the following Issues:

A minimal failing example is found in pyhf Issue 913 but also reproduced here:

$ python --version
Python 3.7.5
$ python -m venv ${HOME}/debug-this
$ source ${HOME}/debug-this/bin/activate
(debug-this) $ python -m pip install --upgrade pip setuptools wheel
(debug-this) $ python -m pip install tensorflow tensorflow-probability
(debug-this) $ python -c "import tensorflow_probability"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/feickert/debug-this/lib/python3.7/site-packages/tensorflow_probability/__init__.py", line 76, in <module>
    from tensorflow_probability.python import *  # pylint: disable=wildcard-import
  File "/home/feickert/debug-this/lib/python3.7/site-packages/tensorflow_probability/python/__init__.py", line 23, in <module>
    from tensorflow_probability.python import distributions
  File "/home/feickert/debug-this/lib/python3.7/site-packages/tensorflow_probability/python/distributions/__init__.py", line 88, in <module>
    from tensorflow_probability.python.distributions.pixel_cnn import PixelCNN
  File "/home/feickert/debug-this/lib/python3.7/site-packages/tensorflow_probability/python/distributions/pixel_cnn.py", line 37, in <module>
    from tensorflow_probability.python.layers import weight_norm
  File "/home/feickert/debug-this/lib/python3.7/site-packages/tensorflow_probability/python/layers/__init__.py", line 31, in <module>
    from tensorflow_probability.python.layers.distribution_layer import CategoricalMixtureOfOneHotCategorical
  File "/home/feickert/debug-this/lib/python3.7/site-packages/tensorflow_probability/python/layers/distribution_layer.py", line 28, in <module>
    from cloudpickle.cloudpickle import CloudPickler
ImportError: cannot import name 'CloudPickler' from 'cloudpickle.cloudpickle' (/home/feickert/debug-this/lib/python3.7/site-packages/cloudpickle/cloudpickle.py)
(debug-this) $ pip list | grep cloudpickle
cloudpickle            1.5.0
(debug-this) $ pip list | grep tensor
tensorboard            2.2.2
tensorboard-plugin-wit 1.7.0
tensorflow             2.2.0
tensorflow-estimator   2.2.0
tensorflow-probability 0.10.0

This is obviously already known to the cloudpickle devs, but for anyone else, as can be seen above this fails because

from cloudpickle.cloudpickle import CloudPickler

is invalid and should be from cloudpickle.cloudpickle_fast import CloudPickler

(edit)

from cloudpickle import CloudPickler
@ogrisel
Copy link
Contributor

ogrisel commented Jul 2, 2020

CloudPickler should be imported from the top level package:

from cloudpickle import CloudPickler

@matthewfeickert
Copy link
Author

Thank you for the correction!

@ogrisel
Copy link
Contributor

ogrisel commented Jul 2, 2020

@pierreglaser we might need to implement the hack you suggested to implement a Python 3.6 compatible __getattr__...

@pierreglaser
Copy link
Member

Yes most probably.

matthewfeickert added a commit to scikit-hep/pyhf that referenced this issue Jul 2, 2020
* Explicitly disallow cloudpickle v1.5.0 to avoid breaking TensorFlow Probability 
   - This is a temporary solution to unblock development, but should be removed once TensorFlow Probability v0.11 has been released
   - tensorflow/probability#991
   - cloudpipe/cloudpickle#390
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

3 participants