Skip to content

dpctl installed into virtual env fails to import #1892

@oleksandr-pavlyk

Description

@oleksandr-pavlyk

I executed the following steps;

conda create -n py312 -c conda-forge --override-channels python=3.12 virtualenv
conda activate py312
python -m venv pypi_venv
source pypi_venv/bin/activate
pip install --no-cache-dir --index-url https://software.repos.intel.com/python/pypi  dpctl==0.18.1
python -c "import dpctl"

Observed output:

(pypi_venv) (py312) opavlyk@opavlyk-mobl:~/tmp$ python -c "import dpctl"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/opavlyk/tmp/pypi_venv/lib/python3.12/site-packages/dpctl/__init__.py", line 29, in <module>
    from ._device_selection import select_device_with_aspects
  File "/home/opavlyk/tmp/pypi_venv/lib/python3.12/site-packages/dpctl/_device_selection.py", line 20, in <module>
    from ._sycl_device import SyclDevice, SyclDeviceCreationError
ImportError: libintlc.so.5: cannot open shared object file: No such file or directory

Executing patchelf --set-rpath '$ORIGIN:$ORIGIN/../../../' --force-rpath $VIRTUAL_ENV/lib/python3.12/site-packages/dpctl/*.cpython*.so fixes the problem, because it allows Python modules to find the dependent DPC++ runtime libraries in Python prefix's lib folder.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions