ImportError: cannot import name '_runtime' from 'iree._runtime_libs' (unknown location)
What happened?
Traceback (most recent call last):
File "
Steps to reproduce your issue
- cmake -GNinja -B ../iree-build-base -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON -DCMAKE_C_COMPILER=/usr/bin/clang-9 -DCMAKE_CXX_COMPILER=/usr/bin/clang++-9 -DCMAKE_INSTALL_PREFIX=../iree-build-base/install -DCMAKE_BUILD_TYPE=RelWithDebInfo -DIREE_BUILD_PYTHON_BINDINGS=ON -DPython3_EXECUTABLE="$(which python)" .
- cmake --build ../iree-build-base --target install
- source ../iree-build-base/.env && export PYTHONPATH
- python -c "import iree.compiler"
- python -c "import iree.runtime"
- See error
What component(s) does this issue relate to?
Python
Version information
commit eda28bf01d10d13f86df9018cb1f35a2dcb1cadc (HEAD -> main, origin/main, origin/HEAD) Author: Lei Zhang [email protected] Date: Sun Mar 3 17:37:23 2024 -0800
[hip][rocm] Fix hipGetDeviceProperties usage after ROCm 6.0 (#16643)
ROCm 6.0 changes the `hipDeviceProp_t` struct, so we would need the new
`hipGetDevicePropertiesR0600()` API to query it--the existing
`hipGetDeviceProperties()`l API won't work for our case with dynamic
libraries.
Related to https://github.com/ROCm/ROCm/issues/2728
Additional context
No response
I'm not sure that the flag -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON
is going to work for a dev build like this as I think it sets up an rpath that does not match the organization of the build tree.
This can be verified by running ldd on the _runtime.*.so in the python path. If it shows that libraries were not found, that would be the problem. Note that when Python has an error loading a native library, it reports it as not found.
I'm not sure that the flag -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON
is going to work for a dev build like this as I think it sets up an rpath that does not match the organization of the build tree.
This can be verified by running
lddon the _runtime.*.so in the python path. If it shows that libraries were not found, that would be the problem. Note that when Python has an error loading a native library, it reports it as not found.
I used the following command, but the problem still persists: cmake -GNinja -B ../iree-build-base -DCMAKE_C_COMPILER=/usr/bin/clang-9 -DCMAKE_CXX_COMPILER=/usr/bin/clang++-9 -DCMAKE_BUILD_TYPE=RelWithDebInfo -DIREE_BUILD_PYTHON_BINDINGS=ON -DPython3_EXECUTABLE="$(which python)" .
I have any other step error?
Is this error solved?
This error occurs under conda virtual env, but it is fine under conda base env.
This error occurs under conda virtual env, but it is fine under conda base env.
I'm not sure,I have build python package to solve it.
You mean that you use pip install ? That still didn't solve the issue.
I don't have enough information to even speculate at the problem. The problem sounds environmental. I would need a docker image or equivalent information to reproduce.
Nine times out of ten this is due to an improper python setup, mismatched python versions or a basic inability for the os to load the shared library.
You mean that you use pip install ? That still didn't solve the issue.
I use ./build_tools/python_deploy/build_linux_packages.sh to build new version package then I use pip install the new version package in conda env, I can use package continue, but still didn't solve the issue, You are right. I have no idea for this problem
I don't have enough information to even speculate at the problem. The problem sounds environmental. I would need a docker image or equivalent information to reproduce.
Nine times out of ten this is due to an improper python setup, mismatched python versions or a basic inability for the os to load the shared library.
It seems like it's an environmental issue.
This error occurs under conda virtual env, but it is fine under conda base env.
I have same problem in conda base env
Though I didn't figure out why this happened, I strongly suggest stop using anaconda. I use pyvenv instead of conda, no error happened any more even under virtual envs.
This error occurs under conda virtual env, but it is fine under conda base env.
I have same problem in conda base env
do not use conda, it is not a good choice, in my opinion.
Though I didn't figure out why this happened, I strongly suggest stop using anaconda. I use pyvenv instead of conda, no error happened any more even under virtual envs.
thanks, I‘ll try it
I don't have enough information to even speculate at the problem. The problem sounds environmental. I would need a docker image or equivalent information to reproduce.
Nine times out of ten this is due to an improper python setup, mismatched python versions or a basic inability for the os to load the shared library.
I think I have found the reason. The python environment for building the python package needs to be the same as the python environment for python -c. If there is a difference, there will be problems.
Though I didn't figure out why this happened, I strongly suggest stop using anaconda. I use pyvenv instead of conda, no error happened any more even under virtual envs.
I think I have found the reason. The python environment for building the python package needs to be the same as the python environment for python -c. If there is a difference, there will be problems.
Maybe, but I have encountered several problem under conda, not only this one _
Maybe, but I have encountered several problem under conda, not only this one
_
I have solved this problem, previously I was building in the container and referencing the python package outside the container. Now after I set the python interpreter inside the container and outside the container to be consistent, the problem has not occurred.
I don't have enough information to even speculate at the problem. The problem sounds environmental. I would need a docker image or equivalent information to reproduce.
Nine times out of ten this is due to an improper python setup, mismatched python versions or a basic inability for the os to load the shared library.
I have solved this problem, previously I was building in the container and referencing the python package outside the container. Now after I set the python interpreter inside the container and outside the container to be consistent, the problem has not occurred. Thank you!