Search code examples
tensorflowcondaminicondatensorflow-probabilitymamba

conda/mamba can't solve tensorflow_probability and tensorflow dependencies


Problem

I am trying to create a conda environment and it seems that conda/mamba can't resolve tensorflow_probability dependencies with respect to tensorflow.

More context

I am trying to create a conda environment with the following requirements using mamba:

numpy
pandas
mitosheet
jupyter
tensorflow-gpu
tensorflow-probability
scikit-learn
matplotlib 
scikit-survival
openpyx
wandb

All works fine during the installation and I end up with the following installed versions:

$ conda list tensorflow
# packages in environment at /home/luca/miniconda3/envs/liver:
#
# Name                    Version                   Build  Channel
tensorflow                2.4.1           gpu_py39h8236f22_0  
tensorflow-base           2.4.1           gpu_py39h29c2da4_0  
tensorflow-estimator      2.6.0            py39he80948d_0    conda-forge
tensorflow-gpu            2.4.1                h30adc30_0  
tensorflow-probability    0.15.0             pyhd8ed1ab_0    conda-forge

However, when I try to use it I get a version incompatibility error. Precisely, when I run:

import tensorflow as tf
import tensorflow_probability as tfp

I get this error:

2022-12-21 11:32:29.516053: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudart.so.10.1

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
Input In [1], in <cell line: 2>()
      1 import tensorflow as tf
----> 2 import tensorflow_probability as tfp

File ~/miniconda3/envs/liver/lib/python3.9/site-packages/tensorflow_probability/__init__.py:20, in <module>
     15 """Tools for probabilistic reasoning in TensorFlow."""
     17 # Contributors to the `python/` dir should not alter this file; instead update
     18 # `python/__init__.py` as necessary.
---> 20 from tensorflow_probability import substrates
     21 # from tensorflow_probability.google import staging  # DisableOnExport
     22 # from tensorflow_probability.google import tfp_google  # DisableOnExport
     23 from tensorflow_probability.python import *  # pylint: disable=wildcard-import

File ~/miniconda3/envs/liver/lib/python3.9/site-packages/tensorflow_probability/substrates/__init__.py:17, in <module>
      1 # Copyright 2019 The TensorFlow Probability Authors.
      2 #
      3 # Licensed under the Apache License, Version 2.0 (the "License");
   (...)
     13 # limitations under the License.
     14 # ============================================================================
     15 """TensorFlow Probability alternative substrates."""
---> 17 from tensorflow_probability.python.internal import all_util
     18 from tensorflow_probability.python.internal import lazy_loader  # pylint: disable=g-direct-tensorflow-import
     21 jax = lazy_loader.LazyLoader(
     22     'jax', globals(),
     23     'tensorflow_probability.substrates.jax')

File ~/miniconda3/envs/liver/lib/python3.9/site-packages/tensorflow_probability/python/__init__.py:138, in <module>
    135 if _tf_loaded():
    136   # Non-lazy load of packages that register with tensorflow or keras.
    137   for pkg_name in _maybe_nonlazy_load:
--> 138     dir(globals()[pkg_name])  # Forces loading the package from its lazy loader.
    141 all_util.remove_undocumented(__name__, _lazy_load + _maybe_nonlazy_load)

File ~/miniconda3/envs/liver/lib/python3.9/site-packages/tensorflow_probability/python/internal/lazy_loader.py:57, in LazyLoader.__dir__(self)
     56 def __dir__(self):
---> 57   module = self._load()
     58   return dir(module)

File ~/miniconda3/envs/liver/lib/python3.9/site-packages/tensorflow_probability/python/internal/lazy_loader.py:37, in LazyLoader._load(self)
     35 """Load the module and insert it into the parent's globals."""
     36 if callable(self._on_first_access):
---> 37   self._on_first_access()
     38   self._on_first_access = None
     39 # Import the target module and insert it into the parent's namespace

File ~/miniconda3/envs/liver/lib/python3.9/site-packages/tensorflow_probability/python/__init__.py:59, in _validate_tf_environment(package)
     55 #   required_tensorflow_version = '1.15'  # Needed internally -- DisableOnExport
     57   if (distutils.version.LooseVersion(tf.__version__) <
     58       distutils.version.LooseVersion(required_tensorflow_version)):
---> 59     raise ImportError(
     60         'This version of TensorFlow Probability requires TensorFlow '
     61         'version >= {required}; Detected an installation of version {present}. '
     62         'Please upgrade TensorFlow to proceed.'.format(
     63             required=required_tensorflow_version,
     64             present=tf.__version__))
     66   if (package == 'mcmc' and
     67       tf.config.experimental.tensor_float_32_execution_enabled()):
     68     # Must import here, because symbols get pruned to __all__.
     69     import warnings

ImportError: This version of TensorFlow Probability requires TensorFlow version >= 2.7; Detected an installation of version 2.4.1. Please upgrade TensorFlow to proceed.

Solving attempts

Looking online I found some related discussions in [1] and [2], where they seem to point at some problem in resolving dependencies of tensorflow/tensorflow_probability packages on conda repositories (unfortunately I am not sufficiently competent to fully understand the whole thread).

The same conclusion seems suggested also in conda-forge documentation with some additional reference to cudatoolkit.

From here, I tried to:

  1. upgrade tensorflow:
$ CONDA_OVERRIDE_CUDA="11.2" mamba install -c conda-forge tensorflow-gpu==2.7=cuda112*

Looking for: ['tensorflow-gpu==2.7[build=cuda112*]']

pkgs/r/linux-64                                               No change
pkgs/main/noarch                                              No change
pkgs/main/linux-64                                            No change
pkgs/r/noarch                                                 No change
conda-forge/noarch                                 @   3.4MB/s  3.5s
conda-forge/linux-64                               @   3.3MB/s  9.8s

Pinned packages:
  - python 3.9.*


Could not solve for environment specs
Encountered problems while solving:
  - package libxml2-2.10.3-h7463322_0 requires icu >=70.1,<71.0a0, but none of the providers can be installed

The environment can't be solved, aborting the operation

I also tried with conda directly but this is what I get:

$ CONDA_OVERRIDE_CUDA="11.2" conda install -c conda-forge tensorflow-gpu==2.7=cuda112*
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: - / 
Found conflicts! Looking for incompatible packages.
This can take several minutes.  Press CTRL-C to abort.
failed                                                                          

UnsatisfiableError: The following specifications were found to be incompatible with each other:

Output in format: Requested package -> Available versionsThe following specifications were found to be incompatible with your system:

  - feature:/linux-64::__cuda==11.2=0
  - feature:|@/linux-64::__cuda==11.2=0
  - tensorflow-gpu==2.7[build=cuda112*] -> tensorflow==2.7.0=cuda112py37h01c6645_0 -> __cuda

Your installed version is: 11.2

Additional info

I installed the packages one by one manually using Miniconda with conda==4.12.0 and running mamba install (mamba=1.1.0). I followed the order in the above requirements.

If I check the evolution of versions at each step with conda list --revisions, I can see that tensorflow VS tensorflow_probability probability was first resolved correctly as it installed tensorflow==2.10.0 and tensorflow_probability=0.19.0 (see rev 1 and rev 2 in the output below). However, I guess the environment was broken when installing matplotlib (see rev 4).

Here's the full output, where rev 0 comes from cloning another environment:

2022-12-20 17:16:58  (rev 0)
    +_libgcc_mutex-0.1 (conda-forge/linux-64)
    +_openmp_mutex-4.5 (conda-forge/linux-64)
    +alsa-lib-1.2.8 (conda-forge/linux-64)
    +anyio-3.5.0 (anaconda/linux-64)
    +argon2-cffi-21.3.0 (anaconda/noarch)
    +argon2-cffi-bindings-21.2.0 (anaconda/linux-64)
    +asttokens-2.0.5 (anaconda/noarch)
    +attr-2.5.1 (conda-forge/linux-64)
    +attrs-21.4.0 (anaconda/noarch)
    +autopep8-2.0.1 (conda-forge/noarch)
    +babel-2.9.1 (anaconda/noarch)
    +backcall-0.2.0 (anaconda/noarch)
    +beautifulsoup4-4.11.1 (anaconda/linux-64)
    +blas-1.0 (defaults/linux-64)
    +bleach-4.1.0 (anaconda/noarch)
    +bottleneck-1.3.5 (defaults/linux-64)
    +brotlipy-0.7.0 (defaults/linux-64)
    +bzip2-1.0.8 (defaults/linux-64)
    +c-ares-1.18.1 (defaults/linux-64)
    +ca-certificates-2022.12.7 (conda-forge/linux-64)
    +certifi-2022.12.7 (conda-forge/noarch)
    +cffi-1.15.1 (defaults/linux-64)
    +charset-normalizer-2.0.4 (defaults/noarch)
    +conda-package-handling-1.9.0 (defaults/linux-64)
    +cryptography-38.0.1 (defaults/linux-64)
    +dbus-1.13.18 (anaconda/linux-64)
    +debugpy-1.5.1 (anaconda/linux-64)
    +decorator-5.1.1 (anaconda/noarch)
    +defusedxml-0.7.1 (anaconda/noarch)
    +entrypoints-0.4 (anaconda/linux-64)
    +executing-0.8.3 (anaconda/noarch)
    +expat-2.5.0 (conda-forge/linux-64)
    +fftw-3.3.10 (conda-forge/linux-64)
    +fmt-9.1.0 (conda-forge/linux-64)
    +font-ttf-dejavu-sans-mono-2.37 (conda-forge/noarch)
    +font-ttf-inconsolata-3.000 (conda-forge/noarch)
    +font-ttf-source-code-pro-2.038 (conda-forge/noarch)
    +font-ttf-ubuntu-0.83 (conda-forge/noarch)
    +fontconfig-2.14.1 (conda-forge/linux-64)
    +fonts-conda-ecosystem-1 (conda-forge/noarch)
    +fonts-conda-forge-1 (conda-forge/noarch)
    +freetype-2.12.1 (conda-forge/linux-64)
    +gettext-0.21.1 (conda-forge/linux-64)
    +giflib-5.2.1 (anaconda/linux-64)
    +glib-2.74.1 (conda-forge/linux-64)
    +glib-tools-2.74.1 (conda-forge/linux-64)
    +gst-plugins-base-1.21.2 (conda-forge/linux-64)
    +gstreamer-1.21.2 (conda-forge/linux-64)
    +gstreamer-orc-0.4.33 (conda-forge/linux-64)
    +icu-70.1 (conda-forge/linux-64)
    +idna-3.4 (defaults/linux-64)
    +intel-openmp-2021.4.0 (defaults/linux-64)
    +ipykernel-6.9.1 (anaconda/linux-64)
    +ipython-8.4.0 (anaconda/linux-64)
    +ipython_genutils-0.2.0 (anaconda/noarch)
    +ipywidgets-7.6.5 (anaconda/noarch)
    +jack-1.9.21 (conda-forge/linux-64)
    +jedi-0.18.1 (anaconda/linux-64)
    +jinja2-3.0.3 (anaconda/noarch)
    +jpeg-9e (anaconda/linux-64)
    +json5-0.9.6 (anaconda/noarch)
    +jsonschema-4.4.0 (anaconda/linux-64)
    +jupyter-1.0.0 (anaconda/linux-64)
    +jupyter_client-7.2.2 (anaconda/linux-64)
    +jupyter_console-6.4.3 (anaconda/noarch)
    +jupyter_contrib_core-0.4.0 (conda-forge/noarch)
    +jupyter_contrib_nbextensions-0.7.0 (conda-forge/noarch)
    +jupyter_core-4.10.0 (anaconda/linux-64)
    +jupyter_highlight_selected_word-0.2.0 (conda-forge/linux-64)
    +jupyter_latex_envs-1.4.6 (conda-forge/linux-64)
    +jupyter_nbextensions_configurator-0.6.1 (conda-forge/noarch)
    +jupyter_server-1.18.1 (anaconda/linux-64)
    +jupyterlab-3.4.4 (anaconda/linux-64)
    +jupyterlab_pygments-0.1.2 (anaconda/noarch)
    +jupyterlab_server-2.12.0 (anaconda/linux-64)
    +jupyterlab_widgets-1.0.0 (anaconda/noarch)
    +keyutils-1.6.1 (conda-forge/linux-64)
    +krb5-1.20.1 (conda-forge/linux-64)
    +lame-3.100 (conda-forge/linux-64)
    +ld_impl_linux-64-2.38 (defaults/linux-64)
    +lerc-4.0.0 (conda-forge/linux-64)
    +libarchive-3.5.2 (conda-forge/linux-64)
    +libcap-2.66 (conda-forge/linux-64)
    +libclang-15.0.6 (conda-forge/linux-64)
    +libclang13-15.0.6 (conda-forge/linux-64)
    +libcups-2.3.3 (conda-forge/linux-64)
    +libcurl-7.86.0 (conda-forge/linux-64)
    +libdb-6.2.32 (conda-forge/linux-64)
    +libdeflate-1.14 (conda-forge/linux-64)
    +libedit-3.1.20221030 (defaults/linux-64)
    +libev-4.33 (defaults/linux-64)
    +libevent-2.1.10 (conda-forge/linux-64)
    +libffi-3.4.2 (conda-forge/linux-64)
    +libflac-1.4.2 (conda-forge/linux-64)
    +libgcc-ng-12.2.0 (conda-forge/linux-64)
    +libgcrypt-1.10.1 (conda-forge/linux-64)
    +libgfortran-ng-12.2.0 (conda-forge/linux-64)
    +libgfortran5-12.2.0 (conda-forge/linux-64)
    +libglib-2.74.1 (conda-forge/linux-64)
    +libgomp-12.2.0 (conda-forge/linux-64)
    +libgpg-error-1.45 (conda-forge/linux-64)
    +libiconv-1.17 (conda-forge/linux-64)
    +libllvm10-10.0.1 (anaconda/linux-64)
    +libllvm15-15.0.6 (conda-forge/linux-64)
    +libmamba-1.1.0 (conda-forge/linux-64)
    +libmambapy-1.1.0 (conda-forge/linux-64)
    +libnghttp2-1.47.0 (conda-forge/linux-64)
    +libnsl-2.0.0 (conda-forge/linux-64)
    +libogg-1.3.4 (conda-forge/linux-64)
    +libopus-1.3.1 (conda-forge/linux-64)
    +libpng-1.6.39 (conda-forge/linux-64)
    +libpq-15.1 (conda-forge/linux-64)
    +libsndfile-1.1.0 (conda-forge/linux-64)
    +libsodium-1.0.18 (anaconda/linux-64)
    +libsolv-0.7.22 (defaults/linux-64)
    +libsqlite-3.40.0 (conda-forge/linux-64)
    +libssh2-1.10.0 (conda-forge/linux-64)
    +libstdcxx-ng-12.2.0 (conda-forge/linux-64)
    +libsystemd0-252 (conda-forge/linux-64)
    +libtiff-4.5.0 (conda-forge/linux-64)
    +libtool-2.4.6 (conda-forge/linux-64)
    +libudev1-252 (conda-forge/linux-64)
    +libuuid-2.32.1 (conda-forge/linux-64)
    +libvorbis-1.3.7 (conda-forge/linux-64)
    +libwebp-1.2.4 (conda-forge/linux-64)
    +libwebp-base-1.2.4 (conda-forge/linux-64)
    +libxcb-1.13 (conda-forge/linux-64)
    +libxkbcommon-1.0.3 (conda-forge/linux-64)
    +libxml2-2.10.3 (conda-forge/linux-64)
    +libxslt-1.1.37 (conda-forge/linux-64)
    +libzlib-1.2.13 (conda-forge/linux-64)
    +lxml-4.9.2 (conda-forge/linux-64)
    +lz4-c-1.9.4 (defaults/linux-64)
    +lzo-2.10 (conda-forge/linux-64)
    +markupsafe-2.1.1 (anaconda/linux-64)
    +matplotlib-inline-0.1.2 (anaconda/noarch)
    +mistune-0.8.4 (anaconda/linux-64)
    +mkl-2021.4.0 (defaults/linux-64)
    +mkl-service-2.4.0 (defaults/linux-64)
    +mkl_fft-1.3.1 (defaults/linux-64)
    +mkl_random-1.2.2 (defaults/linux-64)
    +mpg123-1.31.1 (conda-forge/linux-64)
    +mysql-common-8.0.31 (conda-forge/linux-64)
    +mysql-libs-8.0.31 (conda-forge/linux-64)
    +nb_conda_kernels-2.3.1 (conda-forge/linux-64)
    +nbclassic-0.3.5 (anaconda/noarch)
    +nbclient-0.5.13 (anaconda/linux-64)
    +nbconvert-6.4.4 (anaconda/linux-64)
    +nbformat-5.3.0 (anaconda/linux-64)
    +ncurses-6.3 (defaults/linux-64)
    +nest-asyncio-1.5.5 (anaconda/linux-64)
    +notebook-6.4.12 (anaconda/linux-64)
    +nspr-4.35 (conda-forge/linux-64)
    +nss-3.82 (conda-forge/linux-64)
    +numexpr-2.8.4 (defaults/linux-64)
    +numpy-1.23.4 (defaults/linux-64)
    +numpy-base-1.23.4 (defaults/linux-64)
    +openssl-3.0.7 (conda-forge/linux-64)
    +packaging-21.3 (anaconda/noarch)
    +pandas-1.5.2 (defaults/linux-64)
    +pandocfilters-1.5.0 (anaconda/noarch)
    +parso-0.8.3 (anaconda/noarch)
    +pcre-8.45 (anaconda/linux-64)
    +pcre2-10.37 (defaults/linux-64)
    +pexpect-4.8.0 (anaconda/noarch)
    +pickleshare-0.7.5 (anaconda/noarch)
    +pip-22.3.1 (conda-forge/noarch)
    +ply-3.11 (anaconda/linux-64)
    +prometheus_client-0.14.1 (anaconda/linux-64)
    +prompt-toolkit-3.0.20 (anaconda/noarch)
    +prompt_toolkit-3.0.20 (anaconda/noarch)
    +pthread-stubs-0.4 (conda-forge/linux-64)
    +ptyprocess-0.7.0 (anaconda/noarch)
    +pulseaudio-16.1 (conda-forge/linux-64)
    +pure_eval-0.2.2 (anaconda/noarch)
    +pybind11-abi-4 (conda-forge/noarch)
    +pycodestyle-2.10.0 (conda-forge/noarch)
    +pycosat-0.6.4 (defaults/linux-64)
    +pycparser-2.21 (defaults/noarch)
    +pygments-2.11.2 (anaconda/noarch)
    +pyopenssl-22.0.0 (defaults/noarch)
    +pyparsing-3.0.4 (anaconda/noarch)
    +pyqt-5.15.7 (conda-forge/linux-64)
    +pyqt5-sip-12.11.0 (conda-forge/linux-64)
    +pyrsistent-0.18.0 (anaconda/linux-64)
    +pysocks-1.7.1 (defaults/linux-64)
    +python-3.9.15 (conda-forge/linux-64)
    +python-dateutil-2.8.2 (anaconda/noarch)
    +python-fastjsonschema-2.15.1 (anaconda/noarch)
    +python_abi-3.9 (conda-forge/linux-64)
    +pytz-2022.1 (anaconda/linux-64)
    +pyyaml-6.0 (conda-forge/linux-64)
    +pyzmq-23.2.0 (anaconda/linux-64)
    +qt-main-5.15.6 (conda-forge/linux-64)
    +qt-webengine-5.15.4 (conda-forge/linux-64)
    +qtconsole-5.3.1 (anaconda/linux-64)
    +qtpy-2.0.1 (anaconda/noarch)
    +qtwebkit-5.212 (conda-forge/linux-64)
    +readline-8.2 (defaults/linux-64)
    +reproc-14.2.4 (defaults/linux-64)
    +reproc-cpp-14.2.4 (defaults/linux-64)
    +requests-2.28.1 (defaults/linux-64)
    +ruamel_yaml-0.15.100 (defaults/linux-64)
    +send2trash-1.8.0 (anaconda/noarch)
    +setuptools-65.5.0 (defaults/linux-64)
    +sip-6.7.5 (conda-forge/linux-64)
    +six-1.16.0 (anaconda/noarch)
    +sniffio-1.2.0 (anaconda/linux-64)
    +soupsieve-2.3.1 (anaconda/noarch)
    +sqlite-3.40.0 (defaults/linux-64)
    +stack_data-0.2.0 (anaconda/noarch)
    +terminado-0.13.1 (anaconda/linux-64)
    +testpath-0.6.0 (anaconda/linux-64)
    +tk-8.6.12 (defaults/linux-64)
    +toml-0.10.2 (anaconda/noarch)
    +tomli-2.0.1 (conda-forge/noarch)
    +tornado-6.1 (anaconda/linux-64)
    +tqdm-4.64.1 (defaults/linux-64)
    +traitlets-5.1.1 (anaconda/noarch)
    +typing-extensions-4.3.0 (anaconda/linux-64)
    +typing_extensions-4.3.0 (anaconda/linux-64)
    +tzdata-2022g (defaults/noarch)
    +urllib3-1.26.13 (defaults/linux-64)
    +wcwidth-0.2.5 (anaconda/noarch)
    +webencodings-0.5.1 (anaconda/linux-64)
    +websocket-client-0.58.0 (anaconda/linux-64)
    +wheel-0.38.4 (conda-forge/noarch)
    +widgetsnbextension-3.5.2 (anaconda/linux-64)
    +xcb-util-0.4.0 (conda-forge/linux-64)
    +xcb-util-image-0.4.0 (conda-forge/linux-64)
    +xcb-util-keysyms-0.4.0 (conda-forge/linux-64)
    +xcb-util-renderutil-0.3.9 (conda-forge/linux-64)
    +xcb-util-wm-0.4.1 (conda-forge/linux-64)
    +xorg-libxau-1.0.9 (conda-forge/linux-64)
    +xorg-libxdmcp-1.1.3 (conda-forge/linux-64)
    +xz-5.2.8 (defaults/linux-64)
    +yaml-0.2.5 (defaults/linux-64)
    +yaml-cpp-0.7.0 (conda-forge/linux-64)
    +yapf-0.32.0 (conda-forge/noarch)
    +zeromq-4.3.4 (anaconda/linux-64)
    +zlib-1.2.13 (conda-forge/linux-64)
    +zstd-1.5.2 (defaults/linux-64)

2022-12-20 17:18:38  (rev 1)
     krb5  {1.20.1 (conda-forge/linux-64) -> 1.20.1 (conda-forge/linux-64)}
     libarchive  {3.5.2 (conda-forge/linux-64) -> 3.5.2 (conda-forge/linux-64)}
     libcurl  {7.86.0 (conda-forge/linux-64) -> 7.86.0 (conda-forge/linux-64)}
     libevent  {2.1.10 (conda-forge/linux-64) -> 2.1.10 (conda-forge/linux-64)}
     libmamba  {1.1.0 (conda-forge/linux-64) -> 1.1.0 (conda-forge/linux-64)}
     libmambapy  {1.1.0 (conda-forge/linux-64) -> 1.1.0 (conda-forge/linux-64)}
     libnghttp2  {1.47.0 (conda-forge/linux-64) -> 1.47.0 (conda-forge/linux-64)}
     libpq  {15.1 (conda-forge/linux-64) -> 15.1 (conda-forge/linux-64)}
     libssh2  {1.10.0 (conda-forge/linux-64) -> 1.10.0 (conda-forge/linux-64)}
     mysql-common  {8.0.31 (conda-forge/linux-64) -> 8.0.31 (conda-forge/linux-64)}
     mysql-libs  {8.0.31 (conda-forge/linux-64) -> 8.0.31 (conda-forge/linux-64)}
     openssl  {3.0.7 (conda-forge/linux-64) -> 1.1.1s (conda-forge/linux-64)}
     pulseaudio  {16.1 (conda-forge/linux-64) -> 16.1 (conda-forge/linux-64)}
     python  {3.9.15 (conda-forge/linux-64) -> 3.9.15 (conda-forge/linux-64)}
     qt-main  {5.15.6 (conda-forge/linux-64) -> 5.15.6 (conda-forge/linux-64)}
    +absl-py-1.3.0 (conda-forge/noarch)
    +aiohttp-3.8.3 (conda-forge/linux-64)
    +aiosignal-1.3.1 (conda-forge/noarch)
    +astunparse-1.6.3 (conda-forge/noarch)
    +async-timeout-4.0.2 (conda-forge/noarch)
    +blinker-1.5 (conda-forge/noarch)
    +cached-property-1.5.2 (conda-forge/noarch)
    +cached_property-1.5.2 (conda-forge/noarch)
    +cachetools-5.2.0 (conda-forge/noarch)
    +click-8.1.3 (conda-forge/noarch)
    +cudatoolkit-11.8.0 (conda-forge/linux-64)
    +cudnn-8.4.1.50 (conda-forge/linux-64)
    +flatbuffers-2.0.8 (conda-forge/linux-64)
    +frozenlist-1.3.3 (conda-forge/linux-64)
    +gast-0.4.0 (conda-forge/noarch)
    +google-auth-2.15.0 (conda-forge/noarch)
    +google-auth-oauthlib-0.4.6 (conda-forge/noarch)
    +google-pasta-0.2.0 (conda-forge/noarch)
    +grpc-cpp-1.47.1 (conda-forge/linux-64)
    +grpcio-1.47.1 (conda-forge/linux-64)
    +h5py-3.7.0 (conda-forge/linux-64)
    +hdf5-1.12.2 (conda-forge/linux-64)
    +importlib-metadata-5.2.0 (conda-forge/noarch)
    +keras-2.10.0 (conda-forge/noarch)
    +keras-preprocessing-1.1.2 (conda-forge/noarch)
    +libabseil-20220623.0 (conda-forge/linux-64)
    +libblas-3.9.0 (conda-forge/linux-64)
    +libcblas-3.9.0 (conda-forge/linux-64)
    +liblapack-3.9.0 (conda-forge/linux-64)
    +libprotobuf-3.21.11 (conda-forge/linux-64)
    +markdown-3.4.1 (conda-forge/noarch)
    +multidict-6.0.2 (conda-forge/linux-64)
    +nccl-2.14.3.1 (conda-forge/linux-64)
    +oauthlib-3.2.2 (conda-forge/noarch)
    +opt_einsum-3.3.0 (conda-forge/noarch)
    +protobuf-4.21.11 (conda-forge/linux-64)
    +pyasn1-0.4.8 (conda-forge/noarch)
    +pyasn1-modules-0.2.7 (conda-forge/noarch)
    +pyjwt-2.6.0 (conda-forge/noarch)
    +python-flatbuffers-22.12.6 (conda-forge/noarch)
    +pyu2f-0.1.5 (conda-forge/noarch)
    +re2-2022.06.01 (conda-forge/linux-64)
    +requests-oauthlib-1.3.1 (conda-forge/noarch)
    +rsa-4.9 (conda-forge/noarch)
    +scipy-1.9.3 (conda-forge/linux-64)
    +snappy-1.1.9 (conda-forge/linux-64)
    +tensorboard-2.10.1 (conda-forge/noarch)
    +tensorboard-data-server-0.6.1 (conda-forge/linux-64)
    +tensorboard-plugin-wit-1.8.1 (conda-forge/noarch)
    +tensorflow-2.10.0 (conda-forge/linux-64)
    +tensorflow-base-2.10.0 (conda-forge/linux-64)
    +tensorflow-estimator-2.10.0 (conda-forge/linux-64)
    +tensorflow-gpu-2.10.0 (conda-forge/linux-64)
    +termcolor-2.1.1 (conda-forge/noarch)
    +werkzeug-2.2.2 (conda-forge/noarch)
    +wrapt-1.14.1 (conda-forge/linux-64)
    +yarl-1.8.1 (conda-forge/linux-64)
    +zipp-3.11.0 (conda-forge/noarch)

2022-12-20 17:20:43  (rev 2)
    +cloudpickle-2.2.0 (conda-forge/noarch)
    +dm-tree-0.1.7 (conda-forge/linux-64)
    +etils-0.9.0 (conda-forge/noarch)
    +importlib_resources-5.10.1 (conda-forge/noarch)
    +jax-0.3.17 (conda-forge/noarch)
    +jaxlib-0.3.15 (conda-forge/linux-64)
    +tensorflow-probability-0.19.0 (conda-forge/noarch)

2022-12-20 17:21:31  (rev 3)
    +joblib-1.1.0 (anaconda/noarch)
    +scikit-learn-1.1.1 (anaconda/linux-64)
    +threadpoolctl-2.2.0 (anaconda/noarch)

2022-12-20 17:24:10  (rev 4)
     cudatoolkit  {11.8.0 (conda-forge/linux-64) -> 10.1.243 (conda-forge/linux-64)}
     cudnn  {8.4.1.50 (conda-forge/linux-64) -> 7.6.5.32 (conda-forge/linux-64)}
     grpc-cpp  {1.47.1 (conda-forge/linux-64) -> 1.51.1 (conda-forge/linux-64)}
     grpcio  {1.47.1 (conda-forge/linux-64) -> 1.51.1 (conda-forge/linux-64)}
     h5py  {3.7.0 (conda-forge/linux-64) -> 2.10.0 (conda-forge/linux-64)}
     hdf5  {1.12.2 (conda-forge/linux-64) -> 1.10.6 (defaults/linux-64)}
     jax  {0.3.17 (conda-forge/noarch) -> 0.4.1 (conda-forge/noarch)}
     jaxlib  {0.3.15 (conda-forge/linux-64) -> 0.4.1 (conda-forge/linux-64)}
     keras  {2.10.0 (conda-forge/noarch) -> 2.4.3 (conda-forge/noarch)}
     krb5  {1.20.1 (conda-forge/linux-64) -> 1.20.1 (conda-forge/linux-64)}
     libarchive  {3.5.2 (conda-forge/linux-64) -> 3.5.2 (conda-forge/linux-64)}
     libcurl  {7.86.0 (conda-forge/linux-64) -> 7.86.0 (conda-forge/linux-64)}
     libevent  {2.1.10 (conda-forge/linux-64) -> 2.1.10 (conda-forge/linux-64)}
     libmamba  {1.1.0 (conda-forge/linux-64) -> 1.1.0 (conda-forge/linux-64)}
     libmambapy  {1.1.0 (conda-forge/linux-64) -> 1.1.0 (conda-forge/linux-64)}
     libnghttp2  {1.47.0 (conda-forge/linux-64) -> 1.47.0 (conda-forge/linux-64)}
     libpq  {15.1 (conda-forge/linux-64) -> 15.1 (conda-forge/linux-64)}
     libssh2  {1.10.0 (conda-forge/linux-64) -> 1.10.0 (conda-forge/linux-64)}
     mysql-common  {8.0.31 (conda-forge/linux-64) -> 8.0.31 (conda-forge/linux-64)}
     mysql-libs  {8.0.31 (conda-forge/linux-64) -> 8.0.31 (conda-forge/linux-64)}
     nccl  {2.14.3.1 (conda-forge/linux-64) -> 2.11.4.1 (conda-forge/linux-64)}
     openssl  {1.1.1s (conda-forge/linux-64) -> 3.0.7 (conda-forge/linux-64)}
     pulseaudio  {16.1 (conda-forge/linux-64) -> 16.1 (conda-forge/linux-64)}
     python  {3.9.15 (conda-forge/linux-64) -> 3.9.15 (conda-forge/linux-64)}
     qt-main  {5.15.6 (conda-forge/linux-64) -> 5.15.6 (conda-forge/linux-64)}
     tensorboard-data-server  {0.6.1 (conda-forge/linux-64) -> 0.6.1 (conda-forge/linux-64)}
     tensorflow  {2.10.0 (conda-forge/linux-64) -> 2.4.1 (defaults/linux-64)}
     tensorflow-base  {2.10.0 (conda-forge/linux-64) -> 2.4.1 (defaults/linux-64)}
     tensorflow-estimator  {2.10.0 (conda-forge/linux-64) -> 2.6.0 (conda-forge/linux-64)}
     tensorflow-gpu  {2.10.0 (conda-forge/linux-64) -> 2.4.1 (defaults/linux-64)}
     tensorflow-probability  {0.19.0 (conda-forge/noarch) -> 0.15.0 (conda-forge/noarch)}
    +_tflow_select-2.1.0 (defaults/linux-64)
    +astor-0.8.1 (conda-forge/noarch)
    +brotli-1.0.9 (conda-forge/linux-64)
    +brotli-bin-1.0.9 (conda-forge/linux-64)
    +contourpy-1.0.6 (conda-forge/linux-64)
    +cupti-10.1.168 (defaults/linux-64)
    +cycler-0.11.0 (conda-forge/noarch)
    +fonttools-4.38.0 (conda-forge/linux-64)
    +kiwisolver-1.4.4 (conda-forge/linux-64)
    +lcms2-2.14 (conda-forge/linux-64)
    +libbrotlicommon-1.0.9 (conda-forge/linux-64)
    +libbrotlidec-1.0.9 (conda-forge/linux-64)
    +libbrotlienc-1.0.9 (conda-forge/linux-64)
    +libgrpc-1.51.1 (conda-forge/linux-64)
    +matplotlib-3.6.2 (conda-forge/linux-64)
    +matplotlib-base-3.6.2 (conda-forge/linux-64)
    +munkres-1.1.4 (conda-forge/noarch)
    +openjpeg-2.5.0 (conda-forge/linux-64)
    +pillow-9.2.0 (conda-forge/linux-64)
    +unicodedata2-15.0.0 (conda-forge/linux-64)

2022-12-20 17:25:29  (rev 5)
     scikit-learn  {1.1.1 (anaconda/linux-64) -> 1.1.3 (conda-forge/linux-64)}
    +ecos-2.0.11 (conda-forge/linux-64)
    +libqdldl-0.1.5 (conda-forge/linux-64)
    +osqp-0.6.2.post0 (conda-forge/linux-64)
    +qdldl-python-0.1.5.post2 (conda-forge/linux-64)
    +scikit-survival-0.19.0.post1 (conda-forge/linux-64)

2022-12-20 17:34:12  (rev 6)
    +docker-pycreds-0.4.0 (conda-forge/noarch)
    +gitdb-4.0.10 (conda-forge/noarch)
    +gitpython-3.1.29 (conda-forge/noarch)
    +pathtools-0.1.2 (conda-forge/noarch)
    +promise-2.3 (conda-forge/linux-64)
    +psutil-5.9.4 (conda-forge/linux-64)
    +sentry-sdk-1.12.1 (conda-forge/noarch)
    +setproctitle-1.3.2 (conda-forge/linux-64)
    +shortuuid-1.0.11 (conda-forge/noarch)
    +smmap-3.0.5 (conda-forge/noarch)
    +wandb-0.13.7 (conda-forge/noarch)

Edit: the imports apparently work with inverted order:

import tensorflow_probability as tfp
import tensorflow as tf

print(f"{tf.__version__=}, {tfp.__version__=}")

gives tf.__version__='2.4.1', tfp.__version__='0.15.0'


Solution

  • At the end I solved by creating the conda environment and then installing all packages via pip directly, as per tensorflow documentation.

    IMPORTANTLY: I figured that in general it is advised to install as many packages as possible using conda and then use pip for the unresolved dependencies. After that, the environment should better be freezed, and a new environment should be created for installing new packages.