Code Monkey home page Code Monkey logo

Comments (4)

erwincoumans avatar erwincoumans commented on August 14, 2024

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.

Arsmart123 avatar Arsmart123 commented on August 14, 2024

For me, my solution is to buy a ubuntu PC and install NVIDIA packages. And I can run the code!

from extension-cpp.

elephaint avatar elephaint commented on August 14, 2024

For those stumbling upon this thread, below works for me:

  1. Install Build Tools for Visual Studio
  2. 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
  3. Verify that Windows can find cl by executing where cl in a Windows command line terminal.

from extension-cpp.

JoelJohera avatar JoelJohera commented on August 14, 2024

For those stumbling upon this thread, below works for me:

  1. Install Build Tools for Visual Studio

  2. 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
  3. Verify that Windows can find cl by executing where 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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.