Comments (4)
You need a visual studio command prompt, for example for Visual Studio 2019, you would run (Windows-key and R )
%comspec% /k "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
or start typing 'x64 Native Tools Command Prompt for VS 2019' in the search bar.
You also need ninja binary in the path, download it from here: https://github.com/ninja-build/ninja/releases unzip and copy it in your path (type 'path' to find some directory)
Then run
set DISTUTILS_USE_SDK=1
python setup.py build
python setup.py install
In case of an error related to lltm.o not found, you can rename the lltm.obj to lltm.o, in my case in the build\temp.win-amd64-3.7\Release folder.
Then, after the extension builds and installs fine, it will report an error, not finding the torch dlls, the error is like:
ImportError: DLL load failed: The specified module could not be found.
Just copy the dlls from Python37\Lib\site-packages\torch\lib or start python from that directory
Then you can run python and import lltm_cpp and find the forward and backward extension:
C:\Python37\Lib\site-packages\torch\lib>python
Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import lltm_cpp
>>> print(dir(lltm_cpp))
['__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', 'backward', 'forward']
The developers of extension-cpp probably care mostly about Linux, not Windows.
from extension-cpp.
For me, my solution is to buy a ubuntu PC and install NVIDIA packages. And I can run the code!
from extension-cpp.
For those stumbling upon this thread, below works for me:
- Install Build Tools for Visual Studio
- Make sure you add compiler
cl
to your PATH environment variable (see here). Steps:- Go to your environment variables in Windows
- select the PATH environment variable
- Add the path to your MSVC compiler. Example for VS2019 Build Tools: C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\Hostx64\x64
- Verify that Windows can find
cl
by executingwhere cl
in a Windows command line terminal.
from extension-cpp.
For those stumbling upon this thread, below works for me:
Install Build Tools for Visual Studio
Make sure you add compiler
cl
to your PATH environment variable (see here). Steps:
- Go to your environment variables in Windows
- select the PATH environment variable
- Add the path to your MSVC compiler. Example for VS2019 Build Tools: C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\Hostx64\x64
Verify that Windows can find
cl
by executingwhere cl
in a Windows command line terminal.
I have the cl PATH on the User variables and the System variables but still where cl
returns INFO: Could not find files for the given patterns(s)
What else can I do?
from extension-cpp.
Related Issues (20)
- www.facebook.com/rozi.khatun.961
- This repo can not compile using Pytorch 1.6.0 HOT 1
- This repo can not compile using Pytorch 1.6.0 HOT 1
- A question about backward propagation speed in cpp extension in tutorial
- Error when building cpp extension HOT 1
- AttributeError: module 'depthwise' has no attribute 'forward'
- cuda does not install HOT 17
- How does the layer of C++ extensions translate to TorchScript or onnx? HOT 1
- Cannot Unpack, Too Many Items
- How to debug in cuda-pytorch env?
- Writing a custom C++ extension with variants for both CPU and GPU? HOT 2
- Custom CUDA operator only work well on cuda:0 HOT 3
- How can I access data in cuda kernel like in pytorch?
- error LNK2001 undefined reference to `__cudaRegisterLinkedBinary
- Relation between at::Half and __half
- Deprecation warning
- Scikit-build-core / scikit-build support for binding
- `TORCH_LIBRARY` and `m.def` Not Working as Documented
- [feature request] Instruction on how to setup compile-env for Windows
- JIT-compiling the extension results in non-functional Python module.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from extension-cpp.