Skip to content

Backport gh-2242 #2243

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 2 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
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
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.16.2] - 12/20/2024

### Fixed

* Enabled `dpnp` in virtual environment on Windows platform [#2242](https://github.com/IntelPython/dpnp/pull/2242)


## [0.16.1] - 12/06/2024

This is a bug-fix release.
Expand Down
13 changes: 13 additions & 0 deletions dpnp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
# *****************************************************************************

import os
import sys

mypath = os.path.dirname(os.path.realpath(__file__))

Expand All @@ -45,10 +46,22 @@
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]
)

# For virtual environments on Windows, add folder with DPC++ libraries
# to the DLL search path
if sys.base_exec_prefix != sys.exec_prefix and os.path.isfile(
os.path.join(sys.exec_prefix, "pyvenv.cfg")
):
dll_path = os.path.join(sys.exec_prefix, "Library", "bin")
if os.path.isdir(dll_path):
os.environ["PATH"] = os.pathsep.join(
[os.getenv("PATH", ""), dll_path]
)

# Borrowed from DPCTL
from dpctl.tensor import DLDeviceType

Expand Down
Loading