Comments (6)
Hi Junpeng, that's a great question! The install works for me just running "!pip3 install tfp-nightly" -- I believe the '--user' flag isn't necessary in colab since everything is run in a sandbox by default. However, once installed, I'm seeing the import itself still fail with "ImportError: cannot import name 'seed_stream'" from tensorflow.contrib.distributions.python.ops, which seems to indicate that Colab is preferring its own version of TensorFlow over the nightly package which TFP depends on.
We're certainly interested in making sure TFP works from Colab; we'll engage with the Colab team internally to work this out, and keep you posted. If you or anyone else discovers a workaround in the meantime, feel free to share!
from probability.
After some discussion with the Colab team: there's a TF release bug that's causing Python 3 colabs to pull in an outdated version of tf-nightly
. When this is fixed, !pip install tfp-nightly
will work in Python 3 colabs just as it currently does in Python 2 colabs.
(in the slightly longer term we hope to include TFP in the default colab install, but this should wait until we have a release that depends on stable Tensorflow).
from probability.
For what it's worth, using a Python2.7 colab seems to work fine for me, running "!pip install tfp-nightly", so that's an (admittedly imperfect) potential workaround.
from probability.
It looks like the Colabs now update with more up-to-date TFP packages. This one can probably be closed.
from probability.
On Google Colab Python 2 without GPU, I run
!pip install --upgrade tfp-nightly
Then in import tensorflow as tf
I got the error in #46.
In import tensorflow_probability as tfp
, I got
ImportErrorTraceback (most recent call last)
<ipython-input-2-41494c8c96ff> in <module>()
----> 1 import tensorflow_probability as tfp
/usr/local/lib/python2.7/dist-packages/tensorflow_probability/__init__.py in <module>()
19
20 # from tensorflow_probability.google import staging # DisableOnExport
---> 21 from tensorflow_probability.python import * # pylint: disable=wildcard-import
/usr/local/lib/python2.7/dist-packages/tensorflow_probability/python/__init__.py in <module>()
19 from __future__ import print_function
20
---> 21 from tensorflow_probability.python import distributions
22 from tensorflow_probability.python import edward2
23 from tensorflow_probability.python import glm
/usr/local/lib/python2.7/dist-packages/tensorflow_probability/python/distributions/__init__.py in <module>()
20 # pylint: disable=unused-import,line-too-long,g-importing-member
21
---> 22 from tensorflow_probability.python.distributions import bijectors
23
24 from tensorflow_probability.python.distributions.autoregressive import Autoregressive
/usr/local/lib/python2.7/dist-packages/tensorflow_probability/python/distributions/bijectors/__init__.py in <module>()
21 # pylint: disable=unused-import,wildcard-import,line-too-long,g-importing-member
22
---> 23 from tensorflow_probability.python.distributions.bijectors.absolute_value import AbsoluteValue
24 from tensorflow_probability.python.distributions.bijectors.affine import Affine
25 from tensorflow_probability.python.distributions.bijectors.affine_linear_operator import AffineLinearOperator
/usr/local/lib/python2.7/dist-packages/tensorflow_probability/python/distributions/bijectors/absolute_value.py in <module>()
19 from __future__ import print_function
20
---> 21 import tensorflow as tf
22 from tensorflow.python.ops import control_flow_ops
23 from tensorflow.python.ops.distributions import bijector
/usr/local/lib/python2.7/dist-packages/tensorflow/__init__.py in <module>()
20
21 # pylint: disable=g-bad-import-order
---> 22 from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
23 from . import app
24 from . import bitwise
/usr/local/lib/python2.7/dist-packages/tensorflow/python/__init__.py in <module>()
47 import numpy as np
48
---> 49 from tensorflow.python import pywrap_tensorflow
50
51 # Protocol buffers
ImportError: cannot import name pywrap_tensorflow
On Google Colab Python 3 without GPU, I do the same thing.
Not sure why, after !pip
, I need to "Restart runtime..." before import tensorflow and tensorflow_probability. Then I can successfully import them without the errors appear in Python 2 Colab.
from probability.
FYI: TFP releases are now installed by default in Colab, so import tensorflow_probability as tfp
should 'just work' now without any installation steps.
Closing this issue; feel free to reopen if you run into problems.
from probability.
Related Issues (20)
- Piecewise distribution
- Keras not accepting character `/` from build_factored_surrogate_posterior HOT 4
- A bug in Linear_Mixed_Effects_Models.ipynb
- Conditional input with multiple flows HOT 1
- mlx backend HOT 1
- Can't jit PoissonLogNormalQuadratureCompound log_prob
- autobnn error HOT 2
- Addition of "location" type parameter in the Gamma distribution HOT 2
- Unexpected Symbolic tensor in Tensorflow Probability tensor_coercible object (mixture layer)
- TFP JAX: The transition kernel drastically decreases speed. HOT 3
- jax.dtypes.prng_key gives `AttributeError: module 'jax.dtypes' has no attribute 'prng_key'` HOT 1
- MultivariateNormalTriL Layer appears to be incompatible with tf.keras in tf 2.16.1 and tfp 0.24 HOT 2
- how to fix this error
- Error in documentation of experimental.sequential.extended_kalman_filter
- tfp.math.scan_associative doesn't work for all associative functions (it should be using `vmap` for `lowered_fn`)
- Variational inference for Conv2D layers
- MultivariateNormal* constructor crashes with Numpy 2.0 HOT 1
- Please clean up [email protected] mailing list. HOT 1
- instructions to build wheel from source not working HOT 1
- Mixture of tuple-valued distributions for TFP on JAX raises a TypeError
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from probability.