neurodata / SPORF

This is the implementation of Sparse Projection Oblique Randomer Forest
https://neurodata.io/forests/
97 stars 46 forks source link

Error installing rerf Windows 10 (python) #351

Open Merudo opened 4 years ago

Merudo commented 4 years ago

Describe the bug I am unable to install rerf on Windows 10 (python).

I tried updating pip, setuptools, and wheel, and reinstalling Visual Studio BuildTools but nothing seems to work.

To Reproduce Type pip install rerf to install rerf.

I get the following error:

Collecting rerf
  Using cached rerf-2.0.5.tar.gz (70 kB)
Requirement already satisfied: pybind11>=2.2.4 in d:\anaconda3\lib\site-packages (from rerf) (2.5.0)
Requirement already satisfied: numpy>=1.16.3 in d:\anaconda3\lib\site-packages (from rerf) (1.19.1)
Requirement already satisfied: scikit-learn>=0.21.0 in d:\anaconda3\lib\site-packages (from rerf) (0.23.1)
Requirement already satisfied: requests>=2.22.0 in d:\anaconda3\lib\site-packages (from rerf) (2.24.0)
Note: you may need to restart the kernel to use updated packages.Requirement already satisfied: joblib>=0.11 in d:\anaconda3\lib\site-packages (from scikit-learn>=0.21.0->rerf) (0.16.0)
Requirement already satisfied: scipy>=0.19.1 in d:\anaconda3\lib\site-packages (from scikit-learn>=0.21.0->rerf) (1.5.2)
Requirement already satisfied: threadpoolctl>=2.0.0 in d:\anaconda3\lib\site-packages (from scikit-learn>=0.21.0->rerf) (2.1.0)
Requirement already satisfied: idna<3,>=2.5 in d:\anaconda3\lib\site-packages (from requests>=2.22.0->rerf) (2.10)
Requirement already satisfied: certifi>=2017.4.17 in d:\anaconda3\lib\site-packages (from requests>=2.22.0->rerf) (2020.6.20)
Requirement already satisfied: chardet<4,>=3.0.2 in d:\anaconda3\lib\site-packages (from requests>=2.22.0->rerf) (3.0.4)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in d:\anaconda3\lib\site-packages (from requests>=2.22.0->rerf) (1.25.9)
Building wheels for collected packages: rerf
  Building wheel for rerf (setup.py): started

  Building wheel for rerf (setup.py): finished with status 'error'
  Running setup.py clean for rerf
Failed to build rerf
  ERROR: Command errored out with exit status 1:
   command: 'd:\anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\myself\\AppData\\Local\\Temp\\pip-install-4wjqge0b\\rerf\\setup.py'"'"'; __file__='"'"'C:\\Users\\myself\\AppData\\Local\\Temp\\pip-install-4wjqge0b\\rerf\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\myself\AppData\Local\Temp\pip-wheel-jha_kb_w'
       cwd: C:\Users\myself\AppData\Local\Temp\pip-install-4wjqge0b\rerf\
  Complete output (44 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.8
  creating build\lib.win-amd64-3.8\rerf
  copying rerf\RerF.py -> build\lib.win-amd64-3.8\rerf
  copying rerf\rerfClassifier.py -> build\lib.win-amd64-3.8\rerf
  copying rerf\urerf.py -> build\lib.win-amd64-3.8\rerf
  copying rerf\__init__.py -> build\lib.win-amd64-3.8\rerf
  running egg_info
  writing rerf.egg-info\PKG-INFO
  writing dependency_links to rerf.egg-info\dependency_links.txt
  writing requirements to rerf.egg-info\requires.txt
  writing top-level names to rerf.egg-info\top_level.txt
  reading manifest file 'rerf.egg-info\SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  writing manifest file 'rerf.egg-info\SOURCES.txt'
  running build_ext
  building 'pyfp' extension
  creating build\temp.win-amd64-3.8
  creating build\temp.win-amd64-3.8\Release
  creating build\temp.win-amd64-3.8\Release\src
  D:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.27.29110\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Id:\anaconda3\lib\site-packages\pybind11\include -Id:\anaconda3\lib\site-packages\pybind11\include -Isrc/src/ -Id:\anaconda3\include -Id:\anaconda3\include "-ID:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.27.29110\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /EHsc /Tpsrc/packedForest.cpp /Fobuild\temp.win-amd64-3.8\Release\src/packedForest.obj /EHsc /openmp /DVERSION_INFO=\"2.0.5\"
  packedForest.cpp
  C:\Users\myself\AppData\Local\Temp\pip-install-4wjqge0b\rerf\src\src\fpSingleton\fpInfo.h(187): warning C4244: '=': conversion from 'double' to 'int', possible loss of data
  C:\Users\myself\AppData\Local\Temp\pip-install-4wjqge0b\rerf\src\src\fpSingleton\fpInfo.h(189): warning C4244: '=': conversion from 'double' to 'int', possible loss of data
  C:\Users\myself\AppData\Local\Temp\pip-install-4wjqge0b\rerf\src\src\forestTypes\basicForests\rerf\../classTotals.h(55): warning C4267: 'return': conversion from 'size_t' to 'int', possible loss of data
  C:\Users\myself\AppData\Local\Temp\pip-install-4wjqge0b\rerf\src\src\forestTypes\basicForests\stratifiedInNodeClassIndices.h(32): warning C4267: '+=': conversion from 'size_t' to 'int', possible loss of data
  C:\Users\myself\AppData\Local\Temp\pip-install-4wjqge0b\rerf\src\src\forestTypes\basicForests\stratifiedInNodeClassIndices.h(37): warning C4267: '+=': conversion from 'size_t' to 'int', possible loss of data
  C:\Users\myself\AppData\Local\Temp\pip-install-4wjqge0b\rerf\src\src\forestTypes\basicForests\stratifiedInNodeClassIndices.h(81): warning C4267: '+=': conversion from 'size_t' to 'unsigned int', possible loss of data
  C:\Users\myself\AppData\Local\Temp\pip-install-4wjqge0b\rerf\src\src\forestTypes\basicForests\stratifiedInNodeClassIndices.h(146): warning C4267: 'return': conversion from 'size_t' to 'int', possible loss of data
  C:\Users\myself\AppData\Local\Temp\pip-install-4wjqge0b\rerf\src\src\forestTypes\basicForests\stratifiedInNodeClassIndices.h(155): warning C4267: '+=': conversion from 'size_t' to 'int', possible loss of data
  C:\Users\myself\AppData\Local\Temp\pip-install-4wjqge0b\rerf\src\src\forestTypes\basicForests\stratifiedInNodeClassIndices.h(191): warning C4267: 'argument': conversion from 'size_t' to '_Ty', possible loss of data
          with
          [
              _Ty=int
          ]
  C:\Users\myself\AppData\Local\Temp\pip-install-4wjqge0b\rerf\src\src\forestTypes\basicForests\stratifiedInNodeClassIndices.h(200): warning C4267: 'return': conversion from 'size_t' to 'int', possible loss of data
  C:\Users\myself\AppData\Local\Temp\pip-install-4wjqge0b\rerf\src\src\forestTypes\unsupervisedForests\stratifiedInNodeClassIndicesUnsupervised.h(32): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data
  C:\Users\myself\AppData\Local\Temp\pip-install-4wjqge0b\rerf\src\src\forestTypes\unsupervisedForests\stratifiedInNodeClassIndicesUnsupervised.h(33): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data
  C:\Users\myself\AppData\Local\Temp\pip-install-4wjqge0b\rerf\src\src\forestTypes\unsupervisedForests\stratifiedInNodeClassIndicesUnsupervised.h(195): warning C4267: 'return': conversion from 'size_t' to 'int', possible loss of data
  C:\Users\myself\AppData\Local\Temp\pip-install-4wjqge0b\rerf\src\src\forestTypes\unsupervisedForests\urf\urfTree.h(9): fatal error C1083: Cannot open include file: 'eigen3/Eigen/Dense': No such file or directory
  error: command 'D:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.27.29110\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
  ----------------------------------------
Installing collected packages: rerf
    Running setup.py install for rerf: started
    Running setup.py install for rerf: finished with status 'error'
  ERROR: Failed building wheel for rerf
DEPRECATION: Could not build wheels for rerf which do not use PEP 517. pip will fall back to legacy 'setup.py install' for these. pip 21.0 will remove support for this functionality. A possible replacement is to fix the wheel build issue reported above. You can find discussion regarding this at https://github.com/pypa/pip/issues/8368.
    ERROR: Command errored out with exit status 1:
     command: 'd:\anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\myself\\AppData\\Local\\Temp\\pip-install-4wjqge0b\\rerf\\setup.py'"'"'; __file__='"'"'C:\\Users\\myself\\AppData\\Local\\Temp\\pip-install-4wjqge0b\\rerf\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\myself\AppData\Local\Temp\pip-record-iip01d0x\install-record.txt' --single-version-externally-managed --compile --install-headers 'd:\anaconda3\Include\rerf'
         cwd: C:\Users\myself\AppData\Local\Temp\pip-install-4wjqge0b\rerf\
    Complete output (44 lines):
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.8
    creating build\lib.win-amd64-3.8\rerf
    copying rerf\RerF.py -> build\lib.win-amd64-3.8\rerf
    copying rerf\rerfClassifier.py -> build\lib.win-amd64-3.8\rerf
    copying rerf\urerf.py -> build\lib.win-amd64-3.8\rerf
    copying rerf\__init__.py -> build\lib.win-amd64-3.8\rerf
    running egg_info
    writing rerf.egg-info\PKG-INFO
    writing dependency_links to rerf.egg-info\dependency_links.txt
    writing requirements to rerf.egg-info\requires.txt
    writing top-level names to rerf.egg-info\top_level.txt
    reading manifest file 'rerf.egg-info\SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    writing manifest file 'rerf.egg-info\SOURCES.txt'
    running build_ext
    building 'pyfp' extension
    creating build\temp.win-amd64-3.8
    creating build\temp.win-amd64-3.8\Release
    creating build\temp.win-amd64-3.8\Release\src
    D:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.27.29110\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Id:\anaconda3\lib\site-packages\pybind11\include -Id:\anaconda3\lib\site-packages\pybind11\include -Isrc/src/ -Id:\anaconda3\include -Id:\anaconda3\include "-ID:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.27.29110\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /EHsc /Tpsrc/packedForest.cpp /Fobuild\temp.win-amd64-3.8\Release\src/packedForest.obj /EHsc /openmp /DVERSION_INFO=\"2.0.5\"
    packedForest.cpp
    C:\Users\myself\AppData\Local\Temp\pip-install-4wjqge0b\rerf\src\src\fpSingleton\fpInfo.h(187): warning C4244: '=': conversion from 'double' to 'int', possible loss of data
    C:\Users\myself\AppData\Local\Temp\pip-install-4wjqge0b\rerf\src\src\fpSingleton\fpInfo.h(189): warning C4244: '=': conversion from 'double' to 'int', possible loss of data
    C:\Users\myself\AppData\Local\Temp\pip-install-4wjqge0b\rerf\src\src\forestTypes\basicForests\rerf\../classTotals.h(55): warning C4267: 'return': conversion from 'size_t' to 'int', possible loss of data
    C:\Users\myself\AppData\Local\Temp\pip-install-4wjqge0b\rerf\src\src\forestTypes\basicForests\stratifiedInNodeClassIndices.h(32): warning C4267: '+=': conversion from 'size_t' to 'int', possible loss of data
    C:\Users\myself\AppData\Local\Temp\pip-install-4wjqge0b\rerf\src\src\forestTypes\basicForests\stratifiedInNodeClassIndices.h(37): warning C4267: '+=': conversion from 'size_t' to 'int', possible loss of data
    C:\Users\myself\AppData\Local\Temp\pip-install-4wjqge0b\rerf\src\src\forestTypes\basicForests\stratifiedInNodeClassIndices.h(81): warning C4267: '+=': conversion from 'size_t' to 'unsigned int', possible loss of data
    C:\Users\myself\AppData\Local\Temp\pip-install-4wjqge0b\rerf\src\src\forestTypes\basicForests\stratifiedInNodeClassIndices.h(146): warning C4267: 'return': conversion from 'size_t' to 'int', possible loss of data
    C:\Users\myself\AppData\Local\Temp\pip-install-4wjqge0b\rerf\src\src\forestTypes\basicForests\stratifiedInNodeClassIndices.h(155): warning C4267: '+=': conversion from 'size_t' to 'int', possible loss of data
    C:\Users\myself\AppData\Local\Temp\pip-install-4wjqge0b\rerf\src\src\forestTypes\basicForests\stratifiedInNodeClassIndices.h(191): warning C4267: 'argument': conversion from 'size_t' to '_Ty', possible loss of data
            with
            [
                _Ty=int
            ]
    C:\Users\myself\AppData\Local\Temp\pip-install-4wjqge0b\rerf\src\src\forestTypes\basicForests\stratifiedInNodeClassIndices.h(200): warning C4267: 'return': conversion from 'size_t' to 'int', possible loss of data
    C:\Users\myself\AppData\Local\Temp\pip-install-4wjqge0b\rerf\src\src\forestTypes\unsupervisedForests\stratifiedInNodeClassIndicesUnsupervised.h(32): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data
    C:\Users\myself\AppData\Local\Temp\pip-install-4wjqge0b\rerf\src\src\forestTypes\unsupervisedForests\stratifiedInNodeClassIndicesUnsupervised.h(33): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data
    C:\Users\myself\AppData\Local\Temp\pip-install-4wjqge0b\rerf\src\src\forestTypes\unsupervisedForests\stratifiedInNodeClassIndicesUnsupervised.h(195): warning C4267: 'return': conversion from 'size_t' to 'int', possible loss of data
    C:\Users\myself\AppData\Local\Temp\pip-install-4wjqge0b\rerf\src\src\forestTypes\unsupervisedForests\urf\urfTree.h(9): fatal error C1083: Cannot open include file: 'eigen3/Eigen/Dense': No such file or directory
    error: command 'D:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.27.29110\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'd:\anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\myself\\AppData\\Local\\Temp\\pip-install-4wjqge0b\\rerf\\setup.py'"'"'; __file__='"'"'C:\\Users\\myself\\AppData\\Local\\Temp\\pip-install-4wjqge0b\\rerf\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\myself\AppData\Local\Temp\pip-record-iip01d0x\install-record.txt' --single-version-externally-managed --compile --install-headers 'd:\anaconda3\Include\rerf' Check the logs for full command output.

Expected behavior The package should install properly.

Desktop (please complete the following information):

pobo123 commented 4 years ago

When will this be available for use on Windows (not WSL) please?

burhr2 commented 3 years ago

I have been getting the same error in both windows and ubuntu when calling pip install rerf

I am missing something?

Env Windows 10, Ubuntu 18.04 with anaconda

burhr2 commented 3 years ago

I have been getting the same error in both windows and ubuntu when calling pip install rerf

I am missing something?

Env Windows 10, Ubuntu 18.04 with anaconda

Successfully running on Ubuntu machine

To correct my self I was trying to install the rerf package using WSL 2 on windows but I kept receiving this error. I then used another machine with Ubuntu installed and everything went fine.

OS

steps as explained in the doc i just added the first command $ sudo apt-get install $ sudo apt-get install build-essential cmake python3-dev libomp-dev libeigen3-dev $ pip install rerf

Note: By default when using sklearn random forest, the y variables are encoded if they are categorical, for the case of Rerf the package doesn't do that automatically. So don't forget to encode your y variable else you may get null output eg when using cross_val_score method. (i used sklearn labelEncoder for encoding my y variables).

pepetikesavasiddhardha commented 1 year ago

Identified my mistake, Thanks @burhr2 for the idea initially we have to install a virtual environment in the google colab notebook then we have to use following commands for installing rerf library !sudo apt-get install ! sudo apt-get install build-essential cmake python3-dev libomp-dev libeigen3-dev ! pip install rerf Then these 3 commands will finish the task of installing rerf library which we use for oblique random forest implementation. Then we can import it and use rerf classifier/regressor as per our need. import rerf from rerf.rerfClassifier import rerfClassifier

Important thing to note here is it is better to create a virtual environment in colab notebook before installing library as I faced some problems because of it and process will be smooth if u install virtual env and work in it. Also these lines of code will work in both windows/Linux, also I think it would work on macOS but not exactly sure