conda-forge/conda-forge.github.io

conda install conda-forge::tensorflow-gpu

Closed this issue · 4 comments

Your question:

In the conda environment, use the following command to install tensorflow:
conda install conda-forge::tensorflow-gpu==2.15.0

Run: import tensorflow as tf
Report an error:

import tensorflow as tf
Traceback (most recent call last):

Cell In[1], line 1
import tensorflow as tf

File ~/Software/Miniconda3/envs/DLC/lib/python3.11/site-packages/tensorflow/init.py:40
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import

File ~/Software/Miniconda3/envs/DLC/lib/python3.11/site-packages/tensorflow/python/pywrap_tensorflow.py:34
self_check.preload_check()

File ~/Software/Miniconda3/envs/DLC/lib/python3.11/site-packages/tensorflow/python/platform/self_check.py:63 in preload_check
from tensorflow.python.platform import _pywrap_cpu_feature_guard

ImportError: /home/hhh/Software/Miniconda3/envs/DLC/lib/python3.11/site-packages/tensorflow/python/platform/../../libtensorflow_framework.so.2: undefined symbol: _ZTIN6snappy4SinkE

How to solve?
Thank you.

All packages in the environment should be sourced from conda-forge channel.

It's from the conda-forge channel.

(tf2) hhh@hhh49:~$ conda list
# packages in environment at /home/hhh/Software/Miniconda3/envs/tf2:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       2_gnu    conda-forge
absl-py                   1.4.0           py311h06a4308_0  
aiohttp                   3.9.3           py311h5eee18b_0  
aiosignal                 1.2.0              pyhd3eb1b0_0  
astunparse                1.6.3                      py_0  
attrs                     23.1.0          py311h06a4308_0  
blas                      1.0                    openblas  
blinker                   1.6.2           py311h06a4308_0  
brotli-python             1.0.9           py311h6a678d5_7  
bzip2                     1.0.8                h5eee18b_5  
c-ares                    1.28.1               hd590300_0    conda-forge
ca-certificates           2024.3.11            h06a4308_0  
cachetools                4.2.2              pyhd3eb1b0_0  
certifi                   2024.2.2        py311h06a4308_0  
cffi                      1.16.0          py311h5eee18b_0  
charset-normalizer        2.0.4              pyhd3eb1b0_0  
click                     8.1.7           py311h06a4308_0  
cryptography              42.0.5          py311hdda0065_0  
cuda-crt-tools            12.3.107             ha770c72_0    conda-forge
cuda-cudart               12.3.101             hd3aeb46_1    conda-forge
cuda-cudart_linux-64      12.3.101             h59595ed_1    conda-forge
cuda-nvcc-tools           12.3.107             hd3aeb46_0    conda-forge
cuda-nvrtc                12.3.107             hd3aeb46_1    conda-forge
cuda-nvtx                 12.3.101             h59595ed_0    conda-forge
cuda-nvvm-tools           12.3.107             h59595ed_0    conda-forge
cuda-version              12.3                 h55a0123_2  
cudnn                     8.9.7.29             h092f7fd_3    conda-forge
flatbuffers               23.5.26              h59595ed_1    conda-forge
frozenlist                1.4.0           py311h5eee18b_0  
gast                      0.5.3              pyhd3eb1b0_0  
giflib                    5.2.1                h5eee18b_3  
google-auth               2.22.0          py311h06a4308_0  
google-auth-oauthlib      0.5.2           py311h06a4308_0  
google-pasta              0.2.0              pyhd3eb1b0_0  
grpcio                    1.59.3          py311ha6695c7_0    conda-forge
h5py                      3.9.0           py311hdd6beaf_0  
hdf5                      1.12.1               h2b7332f_3  
icu                       73.2                 h59595ed_0    conda-forge
idna                      3.4             py311h06a4308_0  
keras                     2.15.0             pyhd8ed1ab_0    conda-forge
krb5                      1.20.1               h143b758_1  
ld_impl_linux-64          2.38                 h1181459_1  
libabseil                 20230802.1      cxx17_h59595ed_0    conda-forge
libcublas                 12.3.4.1             hd3aeb46_1    conda-forge
libcufft                  11.0.12.1            hd3aeb46_1    conda-forge
libcurand                 10.3.4.107           hd3aeb46_1    conda-forge
libcurl                   8.5.0                h251f7ec_0  
libcusolver               11.5.4.101           hd3aeb46_1    conda-forge
libcusparse               12.2.0.103           hd3aeb46_1    conda-forge
libedit                   3.1.20230828         h5eee18b_0  
libev                     4.33                 h7f8727e_1  
libffi                    3.4.4                h6a678d5_0  
libgcc-ng                 13.2.0               h807b86a_5    conda-forge
libgfortran-ng            11.2.0               h00389a5_1  
libgfortran5              11.2.0               h1234567_1  
libgomp                   13.2.0               h807b86a_5    conda-forge
libgrpc                   1.59.3               hd6c4280_0    conda-forge
libjpeg-turbo             3.0.0                hd590300_1    conda-forge
libnghttp2                1.57.0               h2d74bed_0  
libnvjitlink              12.3.101             hd3aeb46_1    conda-forge
libopenblas               0.3.21               h043d6bf_0  
libpng                    1.6.39               h5eee18b_0  
libprotobuf               4.24.4               hf27288f_0    conda-forge
libre2-11                 2023.09.01           h7a70373_1    conda-forge
libsqlite                 3.45.2               h2797004_0    conda-forge
libssh2                   1.10.0               hdbd6064_2  
libstdcxx-ng              13.2.0               h7e041cc_5    conda-forge
libuuid                   1.41.5               h5eee18b_0  
libzlib                   1.2.13               hd590300_5    conda-forge
markdown                  3.4.1           py311h06a4308_0  
markupsafe                2.1.3           py311h5eee18b_0  
ml_dtypes                 0.2.0           py311ha02d727_0  
multidict                 6.0.4           py311h5eee18b_0  
nccl                      2.20.5.1             h3a97aeb_0    conda-forge
ncurses                   6.4                  h6a678d5_0  
numpy                     1.26.4          py311h24aa872_0  
numpy-base                1.26.4          py311hbfb1bba_0  
oauthlib                  3.2.2           py311h06a4308_0  
openssl                   3.2.1                hd590300_1    conda-forge
opt_einsum                3.3.0              pyhd3eb1b0_1  
packaging                 23.2            py311h06a4308_0  
pip                       23.3.1          py311h06a4308_0  
protobuf                  4.24.4          py311h46cbc50_0    conda-forge
pyasn1                    0.4.8              pyhd3eb1b0_0  
pyasn1-modules            0.2.8                      py_0  
pycparser                 2.21               pyhd3eb1b0_0  
pyjwt                     2.4.0           py311h06a4308_0  
pyopenssl                 24.0.0          py311h06a4308_0  
pysocks                   1.7.1           py311h06a4308_0  
python                    3.11.8               h955ad1f_0  
python-flatbuffers        24.3.25            pyh59ac667_0    conda-forge
python_abi                3.11                    2_cp311    conda-forge
re2                       2023.09.01           h7f4b329_1    conda-forge
readline                  8.2                  h5eee18b_0  
requests                  2.31.0          py311h06a4308_1  
requests-oauthlib         1.3.0                      py_0  
rsa                       4.7.2              pyhd3eb1b0_1  
setuptools                68.2.2          py311h06a4308_0  
six                       1.16.0             pyhd3eb1b0_1  
snappy                    1.1.10               h6a678d5_1  
sqlite                    3.41.2               h5eee18b_0  
tensorboard               2.15.2             pyhd8ed1ab_0    conda-forge
tensorboard-data-server   0.7.0           py311h52d8a92_0  
tensorflow                2.15.0          cuda120py311h5cbd639_3    conda-forge
tensorflow-base           2.15.0          cuda120py311h43b5e44_3    conda-forge
tensorflow-estimator      2.15.0          cuda120py311hf663016_3    conda-forge
tensorflow-gpu            2.15.0          cuda120py311hb76ca00_3    conda-forge
termcolor                 2.1.0           py311h06a4308_0  
tk                        8.6.12               h1ccaba5_0  
typing_extensions         4.9.0           py311h06a4308_1  
tzdata                    2024a                h04d1e81_0  
urllib3                   1.26.18         py311h06a4308_0  
werkzeug                  2.3.8           py311h06a4308_0  
wheel                     0.41.2          py311h06a4308_0  
wrapt                     1.14.1          py311h5eee18b_0  
xz                        5.4.6                h5eee18b_0  
yarl                      1.9.3           py311h5eee18b_0  
zlib                      1.2.13               hd590300_5    conda-forge
(tf2) hhh@hhh49:~$ python
Python 3.11.8 (main, Feb 26 2024, 21:39:34) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/hhh/Software/Miniconda3/envs/tf2/lib/python3.11/site-packages/tensorflow/__init__.py", line 40, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/hhh/Software/Miniconda3/envs/tf2/lib/python3.11/site-packages/tensorflow/python/pywrap_tensorflow.py", line 34, in <module>
    self_check.preload_check()
  File "/home/hhh/Software/Miniconda3/envs/tf2/lib/python3.11/site-packages/tensorflow/python/platform/self_check.py", line 63, in preload_check
    from tensorflow.python.platform import _pywrap_cpu_feature_guard
ImportError: /home/hhh/Software/Miniconda3/envs/tf2/lib/python3.11/site-packages/tensorflow/python/platform/../../libtensorflow_framework.so.2: undefined symbol: _ZTIN6snappy4SinkE
>>> exit()

half your packages are coming from the default channel for which the text is "hidden".

if the following command works:

conda create --name tf2cf --channel conda-forge --override-channels tensorflow-gpu=2.15.0 python=3.11

and you can activate and run the environment then the conda-forge package "works".

We cannot really support mixed channel configurations.

conda create --name tf2cf --channel conda-forge --override-channels tensorflow-gpu=2.15.0 python=3.11

This command is OK.
Thanks for your reply!