implementation on windows
Hi Hiroyuki, Very powerful and impressive work! The author of tf2rl (Kei Ohta) suggested me to be here! Here follows my problem. I tried to install your project on Windows but I failed. Even I cannot install it with pip. I tried a lot on the cython work converting pyx to pyd manually but not succeed. Do you have some practical suggestions?
I want to use Windows because of our requirement of one software. here is the output when installing it.
C:\Users\MSI-PC>pip install cpprb
Collecting cpprb
Using cached https://files.pythonhosted.org/packages/3d/84/5c20aab0dd10a08037cc27c93242395350edae22cc5af5664eb189d5f918/cpprb-8.1.1.tar.gz
Requirement already satisfied: numpy in e:\anaconda\lib\site-packages (from cpprb) (1.17.3)
Building wheels for collected packages: cpprb
Building wheel for cpprb (setup.py) ... error
ERROR: Complete output from command 'E:\anaconda\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\MSI-PC\\AppData\\Local\\Temp\\pip-install-nyudb675\\cpprb\\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\MSI-PC\AppData\Local\Temp\pip-wheel-m_s63k4i' --python-tag cp36:
ERROR: running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.6
creating build\lib.win-amd64-3.6\cpprb
copying cpprb\__init__.py -> build\lib.win-amd64-3.6\cpprb
creating build\lib.win-amd64-3.6\cpprb\gym
copying cpprb\gym\Animation.py -> build\lib.win-amd64-3.6\cpprb\gym
copying cpprb\gym\__init__.py -> build\lib.win-amd64-3.6\cpprb\gym
running build_ext
building 'cpprb.PyReplayBuffer' extension
creating build\temp.win-amd64-3.6
creating build\temp.win-amd64-3.6\Release
creating build\temp.win-amd64-3.6\Release\cpprb
E:\VS\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Icpprb -IE:\anaconda\include -IE:\anaconda\include -IE:\anaconda\lib\site-packages\numpy\core\include -IE:\VS\VC\Tools\MSVC\14.16.27023\ATLMFC\include -IE:\VS\VC\Tools\MSVC\14.16.27023\include "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IE:\Windows Kits\10\include\10.0.17763.0\ucrt" "-IE:\Windows Kits\10\include\10.0.17763.0\shared" "-IE:\Windows Kits\10\include\10.0.17763.0\um" "-IE:\Windows Kits\10\include\10.0.17763.0\winrt" "-IE:\Windows Kits\10\include\10.0.17763.0\cppwinrt" /EHsc /Tpcpprb/PyReplayBuffer.cpp /Fobuild\temp.win-amd64-3.6\Release\cpprb/PyReplayBuffer.obj -std=c++17 -march=native
cl: 命令行 warning D9002 :忽略未知选项“-std=c++17”
cl: 命令行 warning D9002 :忽略未知选项“-march=native”
PyReplayBuffer.cpp
e:\anaconda\lib\site-packages\numpy\core\include\numpy\npy_1_7_deprecated_api.h(14) : Warning Msg: Using deprecated NumPy API, disable it with #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
cpprb/PyReplayBuffer.cpp(3112): warning C4804: “>”: 在操作中使用类型“bool”不安全
cpprb/PyReplayBuffer.cpp(10902): warning C4018: “<=”: 有符号/无符号不匹配
cpprb/PyReplayBuffer.cpp(11913): warning C4018: “<=”: 有符号/无符号不匹配
cpprb/PyReplayBuffer.cpp(12466): warning C4018: “<”: 有符号/无符号不匹配
cpprb/PyReplayBuffer.cpp(12477): warning C4018: “<=”: 有符号/无符号不匹配
c:\users\msi-pc\appdata\local\temp\pip-install-nyudb675\cpprb\cpprb\ReplayBuffer.hh(363): warning C4305: “初始化”: 从“double”到“Priority”截断
with
[
Priority=float
]
c:\users\msi-pc\appdata\local\temp\pip-install-nyudb675\cpprb\cpprb\SegmentTree.hh(122): error C4984: "if constexpr" 是一种 C++17 语言扩展
c:\users\msi-pc\appdata\local\temp\pip-install-nyudb675\cpprb\cpprb\SegmentTree.hh(103): note: 编译 类 模板 成员函数 "ymd::SegmentTree<Priority,false>::SegmentTree(size_t,std::function<T (T,T)>,T,T *,bool *,bool *,bool)" 时
with
[
Priority=float,
T=float
]
c:\users\msi-pc\appdata\local\temp\pip-install-nyudb675\cpprb\cpprb\ReplayBuffer.hh(375): note: 参见对正在编译的函数 模板 实例化“ymd::SegmentTree<Priority,false>::SegmentTree(size_t,std::function<T (T,T)>,T,T *,bool *,bool *,bool)”的引用
with
[
Priority=float,
T=float
]
c:\users\msi-pc\appdata\local\temp\pip-install-nyudb675\cpprb\cpprb\ReplayBuffer.hh(308): note: 参见对正在编译的 类 模板 实例化 "ymd::SegmentTree<Priority,false>" 的引用
with
[
Priority=float
]
cpprb/PyReplayBuffer.cpp(17715): note: 参见对正在编译的 类 模板 实例化 "ymd::CppPrioritizedSampler<float,false>" 的引 用
cpprb/PyReplayBuffer.cpp(6305): note: 参见对正在编译的 类 模板 实例化 "ymd::CppSelectiveEnvironment<double,double,double,double>" 的引用
c:\users\msi-pc\appdata\local\temp\pip-install-nyudb675\cpprb\cpprb\SegmentTree.hh(138): error C4984: "if constexpr" 是一种 C++17 语言扩展
c:\users\msi-pc\appdata\local\temp\pip-install-nyudb675\cpprb\cpprb\SegmentTree.hh(222): error C4984: "if constexpr" 是一种 C++17 语言扩展
c:\users\msi-pc\appdata\local\temp\pip-install-nyudb675\cpprb\cpprb\SegmentTree.hh(220): note: 编译 类 模板 成员函数 "auto ymd::SegmentTree<Priority,false>::reduce(size_t,size_t)" 时
with
[
Priority=float
]
c:\users\msi-pc\appdata\local\temp\pip-install-nyudb675\cpprb\cpprb\ReplayBuffer.hh(333): note: 编译 类 模板 成员函数 "void ymd::CppPrioritizedSampler<float,false>::set_weights(const std::vector<size_t,std::allocator<_Ty>> &,Priority,std::vector<float,std::allocator<float>> &,size_t)" 时
with
[
_Ty=size_t,
Priority=float
]
c:\users\msi-pc\appdata\local\temp\pip-install-nyudb675\cpprb\cpprb\ReplayBuffer.hh(404): note: 参见对正在编译的函数 模板 实例化“void ymd::CppPrioritizedSampler<float,false>::set_weights(const std::vector<size_t,std::allocator<_Ty>> &,Priority,std::vector<float,std::allocator<float>> &,size_t)”的引用
with
[
_Ty=size_t,
Priority=float
]
c:\users\msi-pc\appdata\local\temp\pip-install-nyudb675\cpprb\cpprb\SegmentTree.hh(238): error C4984: "if constexpr" 是一种 C++17 语言扩展
c:\users\msi-pc\appdata\local\temp\pip-install-nyudb675\cpprb\cpprb\SegmentTree.hh(231): note: 编译 类 模板 成员函数 "auto ymd::SegmentTree<Priority,false>::largest_region_index(std::function<bool (T)>,size_t)" 时
with
[
Priority=float,
T=float
]
c:\users\msi-pc\appdata\local\temp\pip-install-nyudb675\cpprb\cpprb\ReplayBuffer.hh(315): note: 编译 类 模板 成员函数 "void ymd::CppPrioritizedSampler<float,false>::sample_proportional(size_t,std::vector<size_t,std::allocator<_Ty>> &,size_t)" 时
with
[
_Ty=size_t
]
c:\users\msi-pc\appdata\local\temp\pip-install-nyudb675\cpprb\cpprb\ReplayBuffer.hh(403): note: 参见对正在编译的函数 模板 实例化“void ymd::CppPrioritizedSampler<float,false>::sample_proportional(size_t,std::vector<size_t,std::allocator<_Ty>> &,size_t)”的引用
with
[
_Ty=size_t
]
c:\users\msi-pc\appdata\local\temp\pip-install-nyudb675\cpprb\cpprb\SegmentTree.hh(76): error C4984: "if constexpr" 是一种 C++17 语言扩展
c:\users\msi-pc\appdata\local\temp\pip-install-nyudb675\cpprb\cpprb\SegmentTree.hh(72): note: 编译 类 模板 成员函数 "void ymd::SegmentTree<Priority,false>::update_all(void)" 时
with
[
Priority=float
]
c:\users\msi-pc\appdata\local\temp\pip-install-nyudb675\cpprb\cpprb\SegmentTree.hh(263): note: 参见对正在编译的函数 模板 实例化“void ymd::SegmentTree<Priority,false>::update_all(void)”的引用
with
[
Priority=float
]
c:\users\msi-pc\appdata\local\temp\pip-install-nyudb675\cpprb\cpprb\ReplayBuffer.hh(207): error C2429: 语言功能 "if/switch 中的 init-statement" 需要编译器标志 "/std:c++17"
cpprb/PyReplayBuffer.cpp(6576): note: 参见对正在编译的函数 模板 实例化“size_t ymd::CppSelectiveEnvironment<double,double,double,double>::store<double,double,double,double,double>(Obs_t *,Act_t *,Rew_t *,Next_Obs_t *,Done_t *,size_t)”的 引用
with
[
Obs_t=double,
Act_t=double,
Rew_t=double,
Next_Obs_t=double,
Done_t=double
]
cpprb/PyReplayBuffer.cpp(6576): note: 参见对正在编译的函数 模板 实例化“size_t ymd::CppSelectiveEnvironment<double,double,double,double>::store<double,double,double,double,double>(Obs_t *,Act_t *,Rew_t *,Next_Obs_t *,Done_t *,size_t)”的 引用
with
[
Obs_t=double,
Act_t=double,
Rew_t=double,
Next_Obs_t=double,
Done_t=double
]
c:\users\msi-pc\appdata\local\temp\pip-install-nyudb675\cpprb\cpprb\ReplayBuffer.hh(459): error C2039: “accumulate”: 不是“std”的成员
E:\VS\VC\Tools\MSVC\14.16.27023\include\complex(40): note: 参见“std”的声明
cpprb/PyReplayBuffer.cpp(19613): note: 参见对正在编译的函数 模板 实例化“void ymd::CppPrioritizedSampler<float,false>::update_priorities<size_t,float,nullptr,nullptr>(I *,P *,size_t)”的引用
with
[
I=size_t,
P=float
]
cpprb/PyReplayBuffer.cpp(19613): note: 参见对正在编译的函数 模板 实例化“void ymd::CppPrioritizedSampler<float,false>::update_priorities<size_t,float,nullptr,nullptr>(I *,P *,size_t)”的引用
with
[
I=size_t,
P=float
]
c:\users\msi-pc\appdata\local\temp\pip-install-nyudb675\cpprb\cpprb\ReplayBuffer.hh(459): error C3861: “accumulate”: 找不到标识符
error: command 'E:\\VS\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
----------------------------------------
ERROR: Failed building wheel for cpprb
Running setup.py clean for cpprb
Failed to build cpprb
Installing collected packages: cpprb
Running setup.py install for cpprb ... error
ERROR: Complete output from command 'E:\anaconda\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\MSI-PC\\AppData\\Local\\Temp\\pip-install-nyudb675\\cpprb\\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\MSI-PC\AppData\Local\Temp\pip-record-7yhswc60\install-record.txt' --single-version-externally-managed --compile:
ERROR: running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.6
creating build\lib.win-amd64-3.6\cpprb
copying cpprb\__init__.py -> build\lib.win-amd64-3.6\cpprb
creating build\lib.win-amd64-3.6\cpprb\gym
copying cpprb\gym\Animation.py -> build\lib.win-amd64-3.6\cpprb\gym
copying cpprb\gym\__init__.py -> build\lib.win-amd64-3.6\cpprb\gym
running build_ext
building 'cpprb.PyReplayBuffer' extension
creating build\temp.win-amd64-3.6
creating build\temp.win-amd64-3.6\Release
creating build\temp.win-amd64-3.6\Release\cpprb
E:\VS\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Icpprb -IE:\anaconda\include -IE:\anaconda\include -IE:\anaconda\lib\site-packages\numpy\core\include -IE:\VS\VC\Tools\MSVC\14.16.27023\ATLMFC\include -IE:\VS\VC\Tools\MSVC\14.16.27023\include "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IE:\Windows Kits\10\include\10.0.17763.0\ucrt" "-IE:\Windows Kits\10\include\10.0.17763.0\shared" "-IE:\Windows Kits\10\include\10.0.17763.0\um" "-IE:\Windows Kits\10\include\10.0.17763.0\winrt" "-IE:\Windows Kits\10\include\10.0.17763.0\cppwinrt" /EHsc /Tpcpprb/PyReplayBuffer.cpp /Fobuild\temp.win-amd64-3.6\Release\cpprb/PyReplayBuffer.obj -std=c++17 -march=native
cl: 命令行 warning D9002 :忽略未知选项“-std=c++17”
cl: 命令行 warning D9002 :忽略未知选项“-march=native”
PyReplayBuffer.cpp
e:\anaconda\lib\site-packages\numpy\core\include\numpy\npy_1_7_deprecated_api.h(14) : Warning Msg: Using deprecated NumPy API, disable it with #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
cpprb/PyReplayBuffer.cpp(3112): warning C4804: “>”: 在操作中使用类型“bool”不安全
cpprb/PyReplayBuffer.cpp(10902): warning C4018: “<=”: 有符号/无符号不匹配
cpprb/PyReplayBuffer.cpp(11913): warning C4018: “<=”: 有符号/无符号不匹配
cpprb/PyReplayBuffer.cpp(12466): warning C4018: “<”: 有符号/无符号不匹配
cpprb/PyReplayBuffer.cpp(12477): warning C4018: “<=”: 有符号/无符号不匹配
c:\users\msi-pc\appdata\local\temp\pip-install-nyudb675\cpprb\cpprb\ReplayBuffer.hh(363): warning C4305: “初始化”: 从“double”到“Priority”截断
with
[
Priority=float
]
c:\users\msi-pc\appdata\local\temp\pip-install-nyudb675\cpprb\cpprb\SegmentTree.hh(122): error C4984: "if constexpr" 是一种 C++17 语言扩展
c:\users\msi-pc\appdata\local\temp\pip-install-nyudb675\cpprb\cpprb\SegmentTree.hh(103): note: 编译 类 模板 成员函数 "ymd::SegmentTree<Priority,false>::SegmentTree(size_t,std::function<T (T,T)>,T,T *,bool *,bool *,bool)" 时
with
[
Priority=float,
T=float
]
c:\users\msi-pc\appdata\local\temp\pip-install-nyudb675\cpprb\cpprb\ReplayBuffer.hh(375): note: 参见对正在编译的函数 模板 实例化“ymd::SegmentTree<Priority,false>::SegmentTree(size_t,std::function<T (T,T)>,T,T *,bool *,bool *,bool)”的 引用
with
[
Priority=float,
T=float
]
c:\users\msi-pc\appdata\local\temp\pip-install-nyudb675\cpprb\cpprb\ReplayBuffer.hh(308): note: 参见对正在编译的 类 模板 实例化 "ymd::SegmentTree<Priority,false>" 的引用
with
[
Priority=float
]
cpprb/PyReplayBuffer.cpp(17715): note: 参见对正在编译的 类 模板 实例化 "ymd::CppPrioritizedSampler<float,false>" 的 引用
cpprb/PyReplayBuffer.cpp(6305): note: 参见对正在编译的 类 模板 实例化 "ymd::CppSelectiveEnvironment<double,double,double,double>" 的引用
c:\users\msi-pc\appdata\local\temp\pip-install-nyudb675\cpprb\cpprb\SegmentTree.hh(138): error C4984: "if constexpr" 是一种 C++17 语言扩展
c:\users\msi-pc\appdata\local\temp\pip-install-nyudb675\cpprb\cpprb\SegmentTree.hh(222): error C4984: "if constexpr" 是一种 C++17 语言扩展
c:\users\msi-pc\appdata\local\temp\pip-install-nyudb675\cpprb\cpprb\SegmentTree.hh(220): note: 编译 类 模板 成员函数 "auto ymd::SegmentTree<Priority,false>::reduce(size_t,size_t)" 时
with
[
Priority=float
]
c:\users\msi-pc\appdata\local\temp\pip-install-nyudb675\cpprb\cpprb\ReplayBuffer.hh(333): note: 编译 类 模板 成员函 数 "void ymd::CppPrioritizedSampler<float,false>::set_weights(const std::vector<size_t,std::allocator<_Ty>> &,Priority,std::vector<float,std::allocator<float>> &,size_t)" 时
with
[
_Ty=size_t,
Priority=float
]
c:\users\msi-pc\appdata\local\temp\pip-install-nyudb675\cpprb\cpprb\ReplayBuffer.hh(404): note: 参见对正在编译的函数 模板 实例化“void ymd::CppPrioritizedSampler<float,false>::set_weights(const std::vector<size_t,std::allocator<_Ty>> &,Priority,std::vector<float,std::allocator<float>> &,size_t)”的引用
with
[
_Ty=size_t,
Priority=float
]
c:\users\msi-pc\appdata\local\temp\pip-install-nyudb675\cpprb\cpprb\SegmentTree.hh(238): error C4984: "if constexpr" 是一种 C++17 语言扩展
c:\users\msi-pc\appdata\local\temp\pip-install-nyudb675\cpprb\cpprb\SegmentTree.hh(231): note: 编译 类 模板 成员函数 "auto ymd::SegmentTree<Priority,false>::largest_region_index(std::function<bool (T)>,size_t)" 时
with
[
Priority=float,
T=float
]
c:\users\msi-pc\appdata\local\temp\pip-install-nyudb675\cpprb\cpprb\ReplayBuffer.hh(315): note: 编译 类 模板 成员函 数 "void ymd::CppPrioritizedSampler<float,false>::sample_proportional(size_t,std::vector<size_t,std::allocator<_Ty>> &,size_t)" 时
with
[
_Ty=size_t
]
c:\users\msi-pc\appdata\local\temp\pip-install-nyudb675\cpprb\cpprb\ReplayBuffer.hh(403): note: 参见对正在编译的函数 模板 实例化“void ymd::CppPrioritizedSampler<float,false>::sample_proportional(size_t,std::vector<size_t,std::allocator<_Ty>> &,size_t)”的引用
with
[
_Ty=size_t
]
c:\users\msi-pc\appdata\local\temp\pip-install-nyudb675\cpprb\cpprb\SegmentTree.hh(76): error C4984: "if constexpr" 是一种 C++17 语言扩展
c:\users\msi-pc\appdata\local\temp\pip-install-nyudb675\cpprb\cpprb\SegmentTree.hh(72): note: 编译 类 模板 成员函数 "void ymd::SegmentTree<Priority,false>::update_all(void)" 时
with
[
Priority=float
]
c:\users\msi-pc\appdata\local\temp\pip-install-nyudb675\cpprb\cpprb\SegmentTree.hh(263): note: 参见对正在编译的函数 模板 实例化“void ymd::SegmentTree<Priority,false>::update_all(void)”的引用
with
[
Priority=float
]
c:\users\msi-pc\appdata\local\temp\pip-install-nyudb675\cpprb\cpprb\ReplayBuffer.hh(207): error C2429: 语言功能 "if/switch 中的 init-statement" 需要编译器标志 "/std:c++17"
cpprb/PyReplayBuffer.cpp(6576): note: 参见对正在编译的函数 模板 实例化“size_t ymd::CppSelectiveEnvironment<double,double,double,double>::store<double,double,double,double,double>(Obs_t *,Act_t *,Rew_t *,Next_Obs_t *,Done_t *,size_t)” 的引用
with
[
Obs_t=double,
Act_t=double,
Rew_t=double,
Next_Obs_t=double,
Done_t=double
]
cpprb/PyReplayBuffer.cpp(6576): note: 参见对正在编译的函数 模板 实例化“size_t ymd::CppSelectiveEnvironment<double,double,double,double>::store<double,double,double,double,double>(Obs_t *,Act_t *,Rew_t *,Next_Obs_t *,Done_t *,size_t)” 的引用
with
[
Obs_t=double,
Act_t=double,
Rew_t=double,
Next_Obs_t=double,
Done_t=double
]
c:\users\msi-pc\appdata\local\temp\pip-install-nyudb675\cpprb\cpprb\ReplayBuffer.hh(459): error C2039: “accumulate ”: 不是“std”的成员
E:\VS\VC\Tools\MSVC\14.16.27023\include\complex(40): note: 参见“std”的声明
cpprb/PyReplayBuffer.cpp(19613): note: 参见对正在编译的函数 模板 实例化“void ymd::CppPrioritizedSampler<float,false>::update_priorities<size_t,float,nullptr,nullptr>(I *,P *,size_t)”的引用
with
[
I=size_t,
P=float
]
cpprb/PyReplayBuffer.cpp(19613): note: 参见对正在编译的函数 模板 实例化“void ymd::CppPrioritizedSampler<float,false>::update_priorities<size_t,float,nullptr,nullptr>(I *,P *,size_t)”的引用
with
[
I=size_t,
P=float
]
c:\users\msi-pc\appdata\local\temp\pip-install-nyudb675\cpprb\cpprb\ReplayBuffer.hh(459): error C3861: “accumulate ”: 找不到标识符
error: command 'E:\\VS\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
----------------------------------------
ERROR: Command "'E:\anaconda\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\MSI-PC\\AppData\\Local\\Temp\\pip-install-nyudb675\\cpprb\\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\MSI-PC\AppData\Local\Temp\pip-record-7yhswc60\install-record.txt' --single-version-externally-managed --compile" failed with error code 1 in C:\Users\MSI-PC\AppData\Local\Temp\pip-install-nyudb675\cpprb\
Edited by Yamada Hiroyuki