在virtualenv中安装健身房[atari]

时间:2017-01-06 09:38:28

标签: python linux virtualenv gentoo openai-gym

我在virtualenv中安装gym-atari时遇到了麻烦。据我所知,看起来就像问题是zlib,但zlib安装在系统上(cmake也是如此)。有人有主意吗?这是在Gentoo系统上,因为它值得:

(tensorflow)alaya ~ # pip install gym[atari] 
Requirement already satisfied: gym[atari] in     /opt/tensorflow/lib/python2.7/site-packages 
Requirement already satisfied: six in /usr/lib64/python2.7/site-packages (from gym[atari]) 
Requirement already satisfied: requests>=2.0 in /usr/lib64/python2.7/site-packages (from gym[atari]) 
Requirement already satisfied: pyglet>=1.2.0 in /opt/tensorflow/lib/python2.7/site-packages (from gym[atari]) 
Requirement already satisfied: numpy>=1.10.4 in /opt/tensorflow/lib/python2.7/site-packages (from gym[atari]) 
Requirement already satisfied: PyOpenGL; extra == "atari" in /usr/lib64/python2.7/site-packages (from gym[atari]) 
Collecting atari-py>=0.0.17; extra == "atari" (from gym[atari])   Using cached atari-py-0.0.18.tar.gz 
Requirement already satisfied: Pillow; extra == "atari" in /usr/lib64/python2.7/site-packages (from gym[atari]) 
Building wheels for collected packages: atari-py   
Running setup.py bdist_wheel for atari-py ... error   
Complete output from command /opt/tensorflow/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-Xd0Ga4/atari-py/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 /tmp/tmpCxn1j3pip-wheel- --python-tag cp27: 
. 
. 
.
[  9%] Building CXX object CMakeFiles/ale-bin.dir/src/common/display_screen.cpp.o   
In file included from /tmp/pip-build-Xd0Ga4/atari-py/atari_py/ale_interface/src/emucore/unzip.c:13:0: /tmp/pip-build-Xd0Ga4/atari-py/atari_py/ale_interface/src/emucore/unzip.h:114:45: 
error: expected '=', ',', ';', 'asm' or '__attribute__' before 'OF'    extern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1,
                                               ^   
/tmp/pip-build-Xd0Ga4/atari-py/atari_py/ale_interface/src/emucore/unzip.h:127:32: 
error: expected '=', ',', ';', 'asm' or '__attribute__' before 'OF'    extern unzFile ZEXPORT unzOpen OF((const char *path));
                                  ^   
/tmp/pip-build-Xd0Ga4/atari-py/atari_py/ale_interface/src/emucore/unzip.h:138:29: 
error: expected '=', ',', ';', 'asm' or '__attribute__' before 'OF'    extern int ZEXPORT unzClose OF((unzFile file)); 
. . .

有什么想法吗?我唯一的猜测是,不知何故zlib没有被拉进virtualenv ???也许它甚至不是zlib?

2 个答案:

答案 0 :(得分:5)

O.k。,所以这最终是一个Gentoo问题 - 我会发布解决方案以防其他人拥有它。

按照说明here(使用atari-py而不是netifaces),我能够获得我可以编辑的软件包版本。然后我将以下内容添加到/tmp/atari-py-0.0.18/atari_py/ale_interface/src/emucore/unzip.h的顶部:

/* Gentoo removed OF from their copy of zconf.h     (https://bugs.gentoo.org/show_bug.cgi?id=383179) */
/* but our copy of minizip needs it. */
#ifndef OF
#define OF(args) args
#endif

然后运行pip install。来自/tmp/atari-py-0.0.18就可以了。

答案 1 :(得分:0)

对于以后的任何人,如果选择的答案不能解决您的问题,请确保已安装cmakesudo apt install cmake在ubuntu / debian上。