Skip to content
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

Add userbase library dir to windows dll search path #125684

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion torch/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,11 @@ def _running_with_deploy():
################################################################################

if sys.platform == 'win32':
import sysconfig
pfiles_path = os.getenv('ProgramFiles', 'C:\\Program Files')
py_dll_path = os.path.join(sys.exec_prefix, 'Library', 'bin')
th_dll_path = os.path.join(os.path.dirname(__file__), 'lib')
usebase_path = os.path.join(sysconfig.get_config_var("userbase"), 'Library', 'bin')

# When users create a virtualenv that inherits the base environment,
# we will need to add the corresponding library directory into
Expand All @@ -79,7 +81,7 @@ def _running_with_deploy():
else:
base_py_dll_path = ''

dll_paths = list(filter(os.path.exists, [th_dll_path, py_dll_path, base_py_dll_path]))
dll_paths = list(filter(os.path.exists, [th_dll_path, py_dll_path, base_py_dll_path, usebase_path]))

if all(not os.path.exists(os.path.join(p, 'nvToolsExt64_1.dll')) for p in dll_paths):
nvtoolsext_dll_path = os.path.join(
Expand Down