Skip to content

Fix import dpnp on Win & python 3.10 #1189

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Sep 29, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions dpnp/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# *****************************************************************************
# Copyright (c) 2016-2020, Intel Corporation
# Copyright (c) 2016-2022, Intel Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -30,7 +30,16 @@
import dpctl
dpctlpath = os.path.dirname(dpctl.__file__)

os.environ["PATH"] += os.pathsep + mypath + os.pathsep + dpctlpath
# For Windows OS with Python >= 3.7, it is required to explicitly define a path
# where to search for DLLs towards both DPNP backend and DPCTL Sycl interface,
# otherwise DPNP import will be failing. This is because the libraries
# are not installed under any of default paths where Python is searching.
from platform import system
if system() == 'Windows':
if hasattr(os, "add_dll_directory"):
os.add_dll_directory(mypath)
os.add_dll_directory(dpctlpath)
os.environ["PATH"] = os.pathsep.join([os.getenv("PATH", ""), mypath, dpctlpath])


from dpnp.dpnp_array import dpnp_array as ndarray
Expand Down