zpzim / SCAMP

The fastest way to compute matrix profiles on CPU and GPU!
http://www.cs.ucr.edu/~eamonn/MatrixProfile.html
MIT License
155 stars 35 forks source link

nmake not found in Windows 11 on pyscamp install #98

Closed igrowing closed 2 years ago

igrowing commented 2 years ago

Guys, please, help to resolve the problem. Windows 11. Anaconda 3. Installing pyscamp in venv of conda. See the failure below.

pip install cmake --upgrade finished well. There is no nmake.exe file on the computer after the cmake install.

Tried to use set FORCE_NO_CUDA=1 - no luck. Tried set CC=C:\Users\user\anaconda3\Scripts\cmake.exe and set CXX=C:\Users\user\anaconda3\Scripts\cmake.exe - no luck. I see in docs that different compiler can be specified. What's recommended on Win11 system? Thanks!

 c:\>pip install pyscamp
Collecting pyscamp
  Using cached pyscamp-3.0.0.tar.gz (42.0 MB)
Building wheels for collected packages: pyscamp
  Building wheel for pyscamp (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: 'C:\Users\user\anaconda3\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\user\\AppData\\Local\\Temp\\pip-install-y5ijp52n\\pyscamp_ee5e5714af814e0ebd0d79fe7848c9d3\\setup.py'"'"'; __file__='"'"'C:\\Users\\user\\AppData\\Local\\Temp\\pip-install-y5ijp52n\\pyscamp_ee5e5714af814e0ebd0d79fe7848c9d3\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\user\AppData\Local\Temp\pip-wheel-ci87g8s8'
       cwd: C:\Users\user\AppData\Local\Temp\pip-install-y5ijp52n\pyscamp_ee5e5714af814e0ebd0d79fe7848c9d3\
  Complete output (49 lines):
  running bdist_wheel
  running build
  running build_ext
  Warning: Environment variable CMAKE_GENERATOR_PLATFORM will be ignored, because CMAKE_GENERATOR is not set.
  -- Building for: NMake Makefiles
  CMake Error at CMakeLists.txt:44 (project):
    Running

     'nmake' '-?'

    failed with:

     The system cannot find the file specified

  CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
  -- Configuring incomplete, errors occurred!
  See also "C:/Users/user/AppData/Local/Temp/pip-install-y5ijp52n/pyscamp_ee5e5714af814e0ebd0d79fe7848c9d3/build/temp.win-amd64-3.9/Release/CMakeFiles/CMakeOutput.log".
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "C:\Users\user\AppData\Local\Temp\pip-install-y5ijp52n\pyscamp_ee5e5714af814e0ebd0d79fe7848c9d3\setup.py", line 91, in <module>
      setup(
    File "C:\Users\user\anaconda3\lib\site-packages\setuptools\__init__.py", line 153, in setup
      return distutils.core.setup(**attrs)
    File "C:\Users\user\anaconda3\lib\distutils\core.py", line 148, in setup
      dist.run_commands()
    File "C:\Users\user\anaconda3\lib\distutils\dist.py", line 966, in run_commands
      self.run_command(cmd)
    File "C:\Users\user\anaconda3\lib\distutils\dist.py", line 985, in run_command
      cmd_obj.run()
    File "C:\Users\user\anaconda3\lib\site-packages\wheel\bdist_wheel.py", line 299, in run
      self.run_command('build')
    File "C:\Users\user\anaconda3\lib\distutils\cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "C:\Users\user\anaconda3\lib\distutils\dist.py", line 985, in run_command
      cmd_obj.run()
    File "C:\Users\user\anaconda3\lib\distutils\command\build.py", line 135, in run
      self.run_command(cmd_name)
    File "C:\Users\user\anaconda3\lib\distutils\cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "C:\Users\user\anaconda3\lib\distutils\dist.py", line 985, in run_command
      cmd_obj.run()
    File "C:\Users\user\AppData\Local\Temp\pip-install-y5ijp52n\pyscamp_ee5e5714af814e0ebd0d79fe7848c9d3\setup.py", line 38, in run
      self.build_extension(ext)
    File "C:\Users\user\AppData\Local\Temp\pip-install-y5ijp52n\pyscamp_ee5e5714af814e0ebd0d79fe7848c9d3\setup.py", line 84, in build_extension
      subprocess.check_call(['cmake', ext.sourcedir] + cmake_args, cwd=self.build_temp, env=env)
    File "C:\Users\user\anaconda3\lib\subprocess.py", line 373, in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\user\\AppData\\Local\\Temp\\pip-install-y5ijp52n\\pyscamp_ee5e5714af814e0ebd0d79fe7848c9d3', '-DPYTHON_EXECUTABLE=C:\\Users\\user\\anaconda3\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\user\\AppData\\Local\\Temp\\pip-install-y5ijp52n\\pyscamp_ee5e5714af814e0ebd0d79fe7848c9d3\\build\\lib.win-amd64-3.9', '-DCMAKE_BUILD_WITH_INSTALL_RPATH=TRUE', '-DCMAKE_INSTALL_RPATH=$ORIGIN', '-DBUILD_PYTHON_MODULE=TRUE', '-DFORCE_NO_CUDA=1', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\user\\AppData\\Local\\Temp\\pip-install-y5ijp52n\\pyscamp_ee5e5714af814e0ebd0d79fe7848c9d3\\build\\lib.win-amd64-3.9']' returned non-zero exit status 1.
  ----------------------------------------
  ERROR: Failed building wheel for pyscamp
  Running setup.py clean for pyscamp
Failed to build pyscamp
Installing collected packages: pyscamp
    Running setup.py install for pyscamp ... error
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\user\anaconda3\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\user\\AppData\\Local\\Temp\\pip-install-y5ijp52n\\pyscamp_ee5e5714af814e0ebd0d79fe7848c9d3\\setup.py'"'"'; __file__='"'"'C:\\Users\\user\\AppData\\Local\\Temp\\pip-install-y5ijp52n\\pyscamp_ee5e5714af814e0ebd0d79fe7848c9d3\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\user\AppData\Local\Temp\pip-record-j7gcxbb6\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\user\anaconda3\Include\pyscamp'
         cwd: C:\Users\user\AppData\Local\Temp\pip-install-y5ijp52n\pyscamp_ee5e5714af814e0ebd0d79fe7848c9d3\
    Complete output (51 lines):
    running install
    running build
    running build_ext
    Warning: Environment variable CMAKE_GENERATOR_PLATFORM will be ignored, because CMAKE_GENERATOR is not set.
    -- Building for: NMake Makefiles
    CMake Error at CMakeLists.txt:44 (project):
      Running

       'nmake' '-?'

      failed with:

       The system cannot find the file specified

    CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
    -- Configuring incomplete, errors occurred!
    See also "C:/Users/user/AppData/Local/Temp/pip-install-y5ijp52n/pyscamp_ee5e5714af814e0ebd0d79fe7848c9d3/build/temp.win-amd64-3.9/Release/CMakeFiles/CMakeOutput.log".
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\user\AppData\Local\Temp\pip-install-y5ijp52n\pyscamp_ee5e5714af814e0ebd0d79fe7848c9d3\setup.py", line 91, in <module>
        setup(
      File "C:\Users\user\anaconda3\lib\site-packages\setuptools\__init__.py", line 153, in setup
        return distutils.core.setup(**attrs)
      File "C:\Users\user\anaconda3\lib\distutils\core.py", line 148, in setup
        dist.run_commands()
      File "C:\Users\user\anaconda3\lib\distutils\dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "C:\Users\user\anaconda3\lib\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "C:\Users\user\anaconda3\lib\site-packages\setuptools\command\install.py", line 61, in run
        return orig.install.run(self)
      File "C:\Users\user\anaconda3\lib\distutils\command\install.py", line 546, in run
        self.run_command('build')
      File "C:\Users\user\anaconda3\lib\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "C:\Users\user\anaconda3\lib\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "C:\Users\user\anaconda3\lib\distutils\command\build.py", line 135, in run
        self.run_command(cmd_name)
      File "C:\Users\user\anaconda3\lib\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "C:\Users\user\anaconda3\lib\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "C:\Users\user\AppData\Local\Temp\pip-install-y5ijp52n\pyscamp_ee5e5714af814e0ebd0d79fe7848c9d3\setup.py", line 38, in run
        self.build_extension(ext)
      File "C:\Users\user\AppData\Local\Temp\pip-install-y5ijp52n\pyscamp_ee5e5714af814e0ebd0d79fe7848c9d3\setup.py", line 84, in build_extension
        subprocess.check_call(['cmake', ext.sourcedir] + cmake_args, cwd=self.build_temp, env=env)
      File "C:\Users\user\anaconda3\lib\subprocess.py", line 373, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\user\\AppData\\Local\\Temp\\pip-install-y5ijp52n\\pyscamp_ee5e5714af814e0ebd0d79fe7848c9d3', '-DPYTHON_EXECUTABLE=C:\\Users\\user\\anaconda3\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\user\\AppData\\Local\\Temp\\pip-install-y5ijp52n\\pyscamp_ee5e5714af814e0ebd0d79fe7848c9d3\\build\\lib.win-amd64-3.9', '-DCMAKE_BUILD_WITH_INSTALL_RPATH=TRUE', '-DCMAKE_INSTALL_RPATH=$ORIGIN', '-DBUILD_PYTHON_MODULE=TRUE', '-DFORCE_NO_CUDA=1', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\user\\AppData\\Local\\Temp\\pip-install-y5ijp52n\\pyscamp_ee5e5714af814e0ebd0d79fe7848c9d3\\build\\lib.win-amd64-3.9']' returned non-zero exit status 1.
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\user\anaconda3\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\user\\AppData\\Local\\Temp\\pip-install-y5ijp52n\\pyscamp_ee5e5714af814e0ebd0d79fe7848c9d3\\setup.py'"'"'; __file__='"'"'C:\\Users\\user\\AppData\\Local\\Temp\\pip-install-y5ijp52n\\pyscamp_ee5e5714af814e0ebd0d79fe7848c9d3\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\user\AppData\Local\Temp\pip-record-j7gcxbb6\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\user\anaconda3\Include\pyscamp' Check the logs for full command output.
zpzim commented 2 years ago

Thanks for reaching out. Windows has always caused me a bit of trouble.

I see you are pointing the at cmake to be used as the compiler. Unfortunately this won't work, cmake is a build system, not a compiler.

Do you have a C++ compiler installed on your system? E.g. the Visual Studio Build Tools here?

You will need a C++ compiler, and the above toolkit is the only way to get cuda support to work on windows as well so I recommend that one.

Once the build tools are installed, cmake should be able to find the compiler on its own without needing to specify it. However you may still run into problems where the anaconda shell does not see the build tools without some work unfortunately.

I'm not currently in a spot where I can do testing but I can try to reproduce this behavior later tonight.

Working on mobile sorry for the terse comment.

zpzim commented 2 years ago

Another suggestion: this may not work for you, but you can also try to install pyscamp under WSL.

In the meantime let me know if installing the MS build tools helps at all.

igrowing commented 2 years ago

Thanks for ideas, @zpzim . Indeed WSL was my first mind but it dropped because I need to run pyscamp and visualize the results under the same conda environment on Windows. Switch to Linux was better option however it would require several hours of installations and configurations. Tried to install mingw and then:

(base) C:\Users\user>set CC=C:\msys64\mingw64\bin\gcc.exe
(base) C:\Users\user>set CXX=C:\msys64\mingw64\bin\gcc.exe
(base) C:\Users\user>pip install pyscamp

This still failed on the same nmake error. As solution pip install stumpy until I figure out how to compile this on windows.

zpzim commented 2 years ago

Okay, so if you are using minGW can you try adding the following to your environment (In addition to the CC an CXX flags):

set CMAKE_GENERATOR="MinGW Makefiles"

Nmake is the default generator on windows which is probably why you are seeing that error.

Let me know if that helps. I will also try to test this when I get home.

zpzim commented 2 years ago

Okay so I did some testing on my Windows 11 machine.

I installed msys2 via the link and instructions you mentioned in your earlier comment. Once I added C:\msys64\mingw64\bin to my system PATH, I was able to open the anaconda prompt and do the following:

set CMAKE_GENERATOR=MinGW Makefiles
pip install pyscamp

This worked and built/installed pyscamp with mingw. However, when I tried to import pyscamp I got a DLL import error.

It turns out that there are some conda packages which can install their own versions of the mingw dlls under the anaconda directory (e.g. C:\Users\...\anaconda3\Library\mingw-w64\bin) these DLLs conflict with the ones used to build mingw applications built with msys. I'm not sure which packages these are, and I need to do more testing to see if these packages show up on a fresh install of Anaconda.

The problem is that these DLLs are the first to load in a conda environment. I was able to get pyscamp to work by renaming anaconda3\Library\mingw-w64\bin to something else like bin-renamed. Unfortunately, this would probably break any conda packages that rely on those versions of the libs.

I am going to do some more investigation and see if I can determine a clean list of troubleshooting steps which will allow for mingw installations in a conda environment but for now I think you have the following options:

  1. Follow the procedure outlined in this comment: Add C:\msys64\mingw64\bin to your PATH and then install pyscamp in your conda environment by specifying set CMAKE_GENERATOR=MinGW Makefiles, no need to specify the compilers, cmake should figure everything out. If after installation you are unable to import pyscamp due to a missing DLL, check your anaconda directory for anaconda3\Library\mingw-w64\bin and try moving or renaming the directory temporarily.
  2. Install the Visual Studio Build Tools mentioned in my previous comment, these shouldn't have any conflicts with conda, and should just work by default.

FYI I am hoping to list pyscamp on conda-forge soon, and hopfully doing this will make the windows install process more seamless.

zpzim commented 2 years ago

@igrowing pyscamp is now available on conda-forge with native Windows binaries available.

You can install it via conda install -c conda-forge pyscamp-gpu (you don't actually need a GPU to install/use this; it will try to use GPUs by default if it can find them and fall back to CPU if not)

Or if you only want CPU support conda install -c conda-forge pyscamp-cpu

Closing this now as the issue should be resolved. Let me know if you have any problems! Thanks!