Skip to content

Instantly share code, notes, and snippets.

@peterjc123
peterjc123 / check_import.py
Last active Jan 20, 2020
Help to detect import errors for PyTorch on Windows
View check_import.py
# This script tries to figure out the reason of
# `ImportError` on Windows.
# Run it with `python check_import.py`.
import ctypes
import glob
import os
import sys
import subprocess
@peterjc123
peterjc123 / solution.md
Last active May 12, 2020
For #4518 from torch._C import * (ImportError: DLL load failed: The specified module could not be found
View solution.md

It was caused by the missing of some of the dependencies: mkl, mkl-fft, intel-openmp and VC 2017 Redist.

For conda packages:

conda install mkl mkl-fft intel-openmp numpy
# If package not found, do this
conda update conda

For wheel packages:

@peterjc123
peterjc123 / build.py
Last active Dec 27, 2017
Diff for function `compile` in _msvccompiler.py
View build.py
def win_compile(self, sources,
output_dir=None, macros=None, include_dirs=None, debug=0,
extra_preargs=None, extra_postargs=None, depends=None):
if not self.initialized:
self.initialize()
compile_info = self._setup_compile(output_dir, macros, include_dirs,
sources, depends, extra_postargs)
macros, objects, extra_postargs, pp_opts, build = compile_info
compile_opts = extra_preargs or []
@peterjc123
peterjc123 / build.ps1
Last active Nov 12, 2018
Setup script for Windows PyTorch
View build.ps1
# Prerequisites
# 1. MSVC 2017 C++ Build Tools
# 2. CMAKE 3.0 or up
# 3. 64 bits of Windows
# 4. Anaconda / MiniConda 64 bits
# Prerequisites for CUDA
# 1. CUDA 8.0 or up
# 2. NVTX( in CUDA as Visual Studio Integration. if fail to install, you can extract
# the CUDA installer exe and found the NVTX installer under the CUDAVisualStudioIntegration)
@peterjc123
peterjc123 / debug.log
Created Aug 31, 2017
Log for stuck in backward
View debug.log
This file has been truncated, but you can view the full file.
# Time of Day Thread Module API Return Value Error Duration
1 12:23:24.115 AM 1 KERNELBASE.dll NtDeviceIoControlFile ( 0x0000000000000040, NULL, NULL, NULL, 0x000000884f3ef0b0, 5242902, 0x000000884f3ef0c0, 48, NULL, 0 ) STATUS_SUCCESS 0.0000237
2 12:23:24.115 AM 1 KERNEL32.DLL RtlSetLastWin32Error ( ERROR_SUCCESS ) 0.0000000
3 12:23:24.115 AM 1 KERNELBASE.dll RtlSetLastWin32Error ( ERROR_SUCCESS ) 0.0000004
4 12:23:24.115 AM 1 KERNELBASE.dll RtlAcquirePebLock ( ) 0.0000004
5 12:23:24.115 AM 1 KERNELBASE.dll RtlAllocateHeap ( 0x000001a005a30000, 1572864, 7770 ) 0x000001a005a4ac70 0.0000051
6 12:23:24.115 AM 1 KERNELBASE.dll memcpy ( 0x000001a005a4ac70, 0x000001a005a30fc0, 7770 ) 0x000001a005a4ac70 0.0000004
7 12:23:24.115 AM 1 KERNELBASE.dll RtlReleasePebLock ( ) 0.0000004
8 12:23:24.115 AM 1 KERNELBASE.dll RtlFreeHeap ( 0x000001a005a30000, 0, 0x000001a005a4ac70 ) TRUE 0.0000000
You can’t perform that action at this time.