You are not logged in.
Running `python -c "import tensorflow"` from console results in error messages below:
RuntimeError: module compiled against API version 0xf but this version of numpy is 0xe
RuntimeError: module compiled against API version 0xf but this version of numpy is 0xe
ImportError: numpy.core._multiarray_umath failed to import
ImportError: numpy.core.umath failed to import
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/python3.10/site-packages/tensorflow/__init__.py", line 37, in <module>
from tensorflow.python.tools import module_util as _module_util
File "/usr/lib/python3.10/site-packages/tensorflow/python/__init__.py", line 42, in <module>
from tensorflow.python import data
File "/usr/lib/python3.10/site-packages/tensorflow/python/data/__init__.py", line 21, in <module>
from tensorflow.python.data import experimental
File "/usr/lib/python3.10/site-packages/tensorflow/python/data/experimental/__init__.py", line 95, in <module>
from tensorflow.python.data.experimental import service
File "/usr/lib/python3.10/site-packages/tensorflow/python/data/experimental/service/__init__.py", line 387, in <module>
from tensorflow.python.data.experimental.ops.data_service_ops import distribute
File "/usr/lib/python3.10/site-packages/tensorflow/python/data/experimental/ops/data_service_ops.py", line 23, in <module>
from tensorflow.python.data.experimental.ops import compression_ops
File "/usr/lib/python3.10/site-packages/tensorflow/python/data/experimental/ops/compression_ops.py", line 16, in <module>
from tensorflow.python.data.util import structure
File "/usr/lib/python3.10/site-packages/tensorflow/python/data/util/structure.py", line 22, in <module>
from tensorflow.python.data.util import nest
File "/usr/lib/python3.10/site-packages/tensorflow/python/data/util/nest.py", line 36, in <module>
from tensorflow.python.framework import sparse_tensor as _sparse_tensor
File "/usr/lib/python3.10/site-packages/tensorflow/python/framework/sparse_tensor.py", line 24, in <module>
from tensorflow.python.framework import constant_op
File "/usr/lib/python3.10/site-packages/tensorflow/python/framework/constant_op.py", line 25, in <module>
from tensorflow.python.eager import execute
File "/usr/lib/python3.10/site-packages/tensorflow/python/eager/execute.py", line 23, in <module>
from tensorflow.python.framework import dtypes
File "/usr/lib/python3.10/site-packages/tensorflow/python/framework/dtypes.py", line 29, in <module>
_np_bfloat16 = _pywrap_bfloat16.TF_bfloat16_type()
TypeError: Unable to convert function return value to a Python type! The signature was
() -> handle
Related packages:
python-numpy: 1.22.3-1
python-tensorflow-opt-cuda: 2.8.0-4
Last edited by feng (2022-04-12 12:49:44)
Offline
What does the following return:
python -c 'import numpy; print(numpy.version.version)'
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
What does the following return:
python -c 'import numpy; print(numpy.version.version)'
This works well. But it produces
1.21.5
. I was expecting
1.22.3
.
Last edited by feng (2022-04-10 21:58:01)
Offline
So you installed numpy with pip (or some other route outside pacman). Remove it.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
So you installed numpy with pip (or some other route outside pacman). Remove it.
I reinstalled python-numpy and python-tensorflow-cuda, but could not solve this problem. Can it be some other package(s) causing this problem?
[~]$ sudo pacman -Sy python-numpy python-tensorflow-opt-cuda && python -c "import tensorflow"
:: Synchronizing package databases...
04/12 14:39:04 [NOTICE] Downloading 1 item(s)
04/12 14:39:04 [NOTICE] Download complete: //var/lib/pacman/sync/core.db.part
Download Results:
gid |stat|avg speed |path/URI
======+====+===========+=======================================================
9d4e8c|OK | 3.0MiB/s|//var/lib/pacman/sync/core.db.part
Status Legend:
(OK):download completed.
04/12 14:39:04 [NOTICE] Downloading 1 item(s)
04/12 14:39:05 [NOTICE] Download complete: //var/lib/pacman/sync/extra.db.part
Download Results:
gid |stat|avg speed |path/URI
======+====+===========+=======================================================
5a7287|OK | 5.0MiB/s|//var/lib/pacman/sync/extra.db.part
Status Legend:
(OK):download completed.
04/12 14:39:05 [NOTICE] Downloading 1 item(s)
[#66262c 3.9MiB/6.5MiB(60%) CN:1 DL:4.8MiB]
04/12 14:39:07 [NOTICE] Download complete: //var/lib/pacman/sync/community.db.part
Download Results:
gid |stat|avg speed |path/URI
======+====+===========+=======================================================
66262c|OK | 4.2MiB/s|//var/lib/pacman/sync/community.db.part
Status Legend:
(OK):download completed.
04/12 14:39:07 [NOTICE] Downloading 1 item(s)
04/12 14:39:07 [NOTICE] Download complete: //var/lib/pacman/sync/multilib.db.part
Download Results:
gid |stat|avg speed |path/URI
======+====+===========+=======================================================
1eeeec|OK | 2.4MiB/s|//var/lib/pacman/sync/multilib.db.part
Status Legend:
(OK):download completed.
warning: python-numpy-1.22.3-1 is up to date -- reinstalling
warning: python-tensorflow-opt-cuda-2.8.0-4 is up to date -- reinstalling
resolving dependencies...
looking for conflicting packages...
Package (2) Old Version New Version Net Change Download Size
extra/python-numpy 1.22.3-1 1.22.3-1 0.00 MiB
community/python-tensorflow-opt-cuda 2.8.0-4 2.8.0-4 0.00 MiB 250.03 MiB
Total Download Size: 250.03 MiB
Total Installed Size: 1003.81 MiB
Net Upgrade Size: 0.00 MiB
:: Proceed with installation? [Y/n]
:: Retrieving packages...
04/12 14:39:09 [NOTICE] Downloading 1 item(s)
[#8b2bd2 4.7MiB/5.4MiB(86%) CN:1 DL:5.4MiB]
04/12 14:39:10 [NOTICE] Download complete: //var/cache/pacman/pkg/python-numpy-1.22.3-1-x86_64.pkg.tar.zst.part
Download Results:
gid |stat|avg speed |path/URI
======+====+===========+=======================================================
8b2bd2|OK | 4.0MiB/s|//var/cache/pacman/pkg/python-numpy-1.22.3-1-x86_64.pkg.tar.zst.part
Status Legend:
(OK):download completed.
04/12 14:39:11 [NOTICE] Downloading 1 item(s)
*** Download Progress Summary as of Tue Apr 12 14:40:11 2022 ***
=============================================================================================================================================================================================
[#dd502b 155MiB/250MiB(62%) CN:2 DL:2.4MiB ETA:38s]
FILE: //var/cache/pacman/pkg/python-tensorflow-opt-cuda-2.8.0-4-x86_64.pkg.tar.zst.part
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[#dd502b 249MiB/250MiB(99%) CN:2 DL:2.8MiB]
04/12 14:40:49 [NOTICE] Download complete: //var/cache/pacman/pkg/python-tensorflow-opt-cuda-2.8.0-4-x86_64.pkg.tar.zst.part
Download Results:
gid |stat|avg speed |path/URI
======+====+===========+=======================================================
dd502b|OK | 2.5MiB/s|//var/cache/pacman/pkg/python-tensorflow-opt-cuda-2.8.0-4-x86_64.pkg.tar.zst.part
Status Legend:
(OK):download completed.
Total (0/2) 250.0 MiB 2.50 MiB/s 01:40 [####################################################################] 100%
(2/2) checking keys in keyring [####################################################################] 100%
(2/2) checking package integrity [####################################################################] 100%
(2/2) loading package files [####################################################################] 100%
(2/2) checking for file conflicts [####################################################################] 100%
(2/2) checking available disk space [####################################################################] 100%
:: Processing package changes...
(1/2) reinstalling python-numpy [####################################################################] 100%
(2/2) reinstalling python-tensorflow-opt-cuda [####################################################################] 100%
:: Running post-transaction hooks...
(1/1) Arming ConditionNeedsUpdate...
RuntimeError: module compiled against API version 0xf but this version of numpy is 0xe
RuntimeError: module compiled against API version 0xf but this version of numpy is 0xe
ImportError: numpy.core._multiarray_umath failed to import
ImportError: numpy.core.umath failed to import
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/python3.10/site-packages/tensorflow/__init__.py", line 37, in <module>
from tensorflow.python.tools import module_util as _module_util
File "/usr/lib/python3.10/site-packages/tensorflow/python/__init__.py", line 42, in <module>
from tensorflow.python import data
File "/usr/lib/python3.10/site-packages/tensorflow/python/data/__init__.py", line 21, in <module>
from tensorflow.python.data import experimental
File "/usr/lib/python3.10/site-packages/tensorflow/python/data/experimental/__init__.py", line 95, in <module>
from tensorflow.python.data.experimental import service
File "/usr/lib/python3.10/site-packages/tensorflow/python/data/experimental/service/__init__.py", line 387, in <module>
from tensorflow.python.data.experimental.ops.data_service_ops import distribute
File "/usr/lib/python3.10/site-packages/tensorflow/python/data/experimental/ops/data_service_ops.py", line 23, in <module>
from tensorflow.python.data.experimental.ops import compression_ops
File "/usr/lib/python3.10/site-packages/tensorflow/python/data/experimental/ops/compression_ops.py", line 16, in <module>
from tensorflow.python.data.util import structure
File "/usr/lib/python3.10/site-packages/tensorflow/python/data/util/structure.py", line 22, in <module>
from tensorflow.python.data.util import nest
File "/usr/lib/python3.10/site-packages/tensorflow/python/data/util/nest.py", line 36, in <module>
from tensorflow.python.framework import sparse_tensor as _sparse_tensor
File "/usr/lib/python3.10/site-packages/tensorflow/python/framework/sparse_tensor.py", line 24, in <module>
from tensorflow.python.framework import constant_op
File "/usr/lib/python3.10/site-packages/tensorflow/python/framework/constant_op.py", line 25, in <module>
from tensorflow.python.eager import execute
File "/usr/lib/python3.10/site-packages/tensorflow/python/eager/execute.py", line 23, in <module>
from tensorflow.python.framework import dtypes
File "/usr/lib/python3.10/site-packages/tensorflow/python/framework/dtypes.py", line 29, in <module>
_np_bfloat16 = _pywrap_bfloat16.TF_bfloat16_type()
TypeError: Unable to convert function return value to a Python type! The signature was
() -> handle
[~]$ python -c 'import numpy; print(numpy.version.version)'
1.21.5
Offline
So you installed numpy with pip (or some other route outside pacman). Remove it.
You are quite right. It is a pip installed numpy causing this problem, and it lies in .local directory, which is very difficult to find out.
I removed it and solved my problem.
Many thanks.
[~]$ pip uninstall numpy
Found existing installation: numpy 1.21.5
Uninstalling numpy-1.21.5:
Would remove:
/home/feng/.local/bin/f2py
/home/feng/.local/bin/f2py3
/home/feng/.local/bin/f2py3.10
/home/feng/.local/lib/python3.10/site-packages/numpy-1.21.5.dist-info/*
/home/feng/.local/lib/python3.10/site-packages/numpy.libs/libgfortran-040039e1.so.5.0.0
/home/feng/.local/lib/python3.10/site-packages/numpy.libs/libopenblasp-r0-8b9e111f.3.17.so
/home/feng/.local/lib/python3.10/site-packages/numpy.libs/libquadmath-96973f99.so.0.0.0
/home/feng/.local/lib/python3.10/site-packages/numpy/*
Proceed (y/n)?
Your response ('') was not one of the expected responses: y, n
Proceed (y/n)? y
Successfully uninstalled numpy-1.21.5
Offline