Skip to content

Instantly share code, notes, and snippets.

@peterjc123
peterjc123 / solution.md
Last active May 12, 2020 19:44
For #4518 from torch._C import * (ImportError: DLL load failed: The specified module could not be found

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 / check_import.py
Last active January 20, 2020 09:41
Help to detect import errors for PyTorch on Windows
# 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 / build.ps1
Last active November 12, 2018 16:29
Setup script for Windows PyTorch
# 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 / build.py
Last active December 27, 2017 09:48
Diff for function `compile` in _msvccompiler.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 / debug.log
Created August 31, 2017 03:22
Log for stuck in backward
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
9 12:23:24.115 AM 1 KERNELBASE.dll NtQueryVirtualMemory ( GetCurrentProcess(), 0x000000001c811ed8, MemoryBasicInformati