bbitmaster / ale_python_interface

A Python Interface for the Arcade Learning Environment (Shared Object)
GNU General Public License v2.0
126 stars 32 forks source link

Not able to install ale_python interface. #2

Open charu-iitm opened 9 years ago

charu-iitm commented 9 years ago

I have done the following steps: 1.)git clone https://github.com/mgbellemare/Arcade-Learning-Environment.git cd Arcade-Learning-Environment cp makefile.unix makefile make

2.)export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/ export LIBRARY_PATH=$LIBRARY_PATH:/ export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/src/

3.git clone https://github.com/bbitmaster/ale_python_interface.git cd ale_python_interface python setup.py build python setup.py install

4.)I get errors when i do "from ale_python_interface import ALEInterface"

I am getting the following error:from: can't read /var/mail/ale_python_interface

bbitmaster commented 9 years ago

Did you run this in python? (first run python and type it there, not in bash).

charu-iitm commented 9 years ago

I tried running it in python.I got the error as: Traceback (most recent call last): File "", line 1, in File "ale_python_interface/init.py", line 1, in from ale_python_interface import * File "ale_python_interface/ale_python_interface.py", line 12, in os.path.dirname(file),'ale_c_wrapper.so')) File "/home/charu/anaconda/lib/python2.7/ctypes/init.py", line 443, in LoadLibrary return self._dlltype(name) File "/home/charu/anaconda/lib/python2.7/ctypes/init.py", line 365, in init self._handle = _dlopen(self._name, mode) OSError: ale_python_interface/ale_c_wrapper.so: cannot open shared object file: No such file or directory

bbitmaster commented 9 years ago

The problem is that it can't find the ale_c_wrapper.so shared object file. This file should have been built when you ran "python setup.py build" and installed to a location where it could find it, when you ran "python setup.py install". Did either of those commands give errors?

I also notice you are using anaconda. I have successfully installed it with anaconda using the same steps, so I'm not really sure why it isn't working.

charu-iitm commented 9 years ago

I tried repeating the entire process again.I am getting the error when I try to build using "python setup.py build" .The error logs are as follows: ld running build running build_py running build_ext building 'ale_python_interface.ale_c_wrapper' extension gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c ale_python_interface/ale_c_wrapper.cpp -o build/temp.linux-x86_64-2.7/ale_python_interface/ale_c_wrapper.o cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for Ada/C/ObjC but not for C++ [enabled by default] In file included from ale_python_interface/ale_c_wrapper.cpp:2:0: ale_python_interface/ale_cwrapper.h: In function ‘void getLegalActionSet(ALEInterface, int_)’: ale_python_interface/ale_c_wrapper.h:30:57: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] ale_python_interface/ale_c_wrapper.h:29:19: warning: unused variable ‘sz’ [-Wunused-variable] ale_python_interface/ale_cwrapper.h: In function ‘void getMinimalActionSet(ALEInterface, int_)’: ale_python_interface/ale_c_wrapper.h:40:59: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] ale_python_interface/ale_c_wrapper.h:39:19: warning: unused variable ‘sz’ [-Wunused-variable] ale_python_interface/ale_cwrapper.h: In function ‘int getScreen(ALEInterface, unsigned char_)’: ale_python_interface/ale_c_wrapper.h:56:5: warning: no return statement in function returning non-void [-Wreturn-type] ale_python_interface/ale_cwrapper.h: In function ‘int getScreenRGB(ALEInterface, int_)’: ale_python_interface/ale_c_wrapper.h:65:5: warning: no return statement in function returning non-void [-Wreturn-type] g++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro build/temp.linux-x86_64-2.7/ale_python_interface/ale_c_wrapper.o -lale -o build/lib.linux-x86_64-2.7/ale_python_interface/ale_c_wrapper.so /usr/bin/ld: cannot find -lale collect2: ld returned 1 exit status error: command 'g++' failed with exit status 1

charu-iitm commented 9 years ago

I tried repeating the process again and I get an error when I try building using

charu@user1-Veriton-Series:/media/work/ale_python_interface$ python setup.py build running build running build_py running build_ext building 'ale_python_interface.ale_c_wrapper' extension gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c ale_python_interface/ale_c_wrapper.cpp -o build/temp.linux-x86_64-2.7/ale_python_interface/ale_c_wrapper.o cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for Ada/C/ObjC but not for C++ [enabled by default] In file included from ale_python_interface/ale_c_wrapper.cpp:2:0: ale_python_interface/ale_c_wrapper.h:4:29: fatal error: ale_interface.hpp: No such file or directory compilation terminated. error: command 'gcc' failed with exit status 1

bbitmaster commented 9 years ago

It seems that the build process is unable to find libale. It requires both the header file: ale_interface.hpp and the built shared object binary file: libale.so

When you run python setup.py build, it must be able to find those files. They both come from the Arcade Learning Environment. There are several ways you can ensure they are found, but the way I recommended in the wiki is to set the environment variables: LD_LIBRARY_PATH, C_PLUS_INCLUDE_PATH, and LIBRARY_PATH to point to them.

C_PLUS_INCLUDE_PATH must point to the directory that contains ale_interface.hpp and LD_LIBARY_PATH and LIBRARY_PATH must point to the directory that contains libale.so

This will ensure those files can be found. You can edit your ~/.bashrc file (according to the wiki) to set those variables. Or you can just export them. To check that they are ended set correctly, run echo $LD_LIBARY_PATH echo $LIBRARY_PATH echo $INCLUDE_PATH

make sure that these print out directory names for the correct director(ies) that contain the files mentioned above.

trevorhampton commented 9 years ago

I'm having similar issues with getting ale installed. Whenever I run python setup.py build, it tells me that there is no member named set in ALEInterface. If I run this command under sudo, it says that it can't find the ale_python_interface.hpp file, even though I do have the paths set correctly. I'm attempting to run this on OSX in zsh, so I set the path variables in .profile and .zshrc. I saw 3 different INCLUDE path variables that you used in the wiki and in this thread, so I set all three to the same path. Here are those export lines:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/Downloads/Arcade-Learning-Environment/ export LIBRARY_PATH=$LIBRARY_PATH:~/Downloads/Arcade-Learning-Environment/ export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:~/Downloads/Arcade-Learning-Environment/src/ export C_PLUS_INCLUDE_PATH=$C_PLUS_INCLUDE_PATH:~/Downloads/Arcade-Learning-Environment/src/ export INCLUDE_PATH=$INCLUDE_PATH:~/Downloads/Arcade-Learning-Environment/src/

I've also included the error log from running python setup.py build below. Thanks for any help!

python setup.py build running build running build_py running build_ext building 'ale_python_interface.ale_c_wrapper' extension cc -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -Qunused-arguments -Qunused-arguments -arch x86_64 -arch i386 -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c ale_python_interface/ale_c_wrapper.cpp -o build/temp.macosx-10.10-intel-2.7/ale_python_interface/ale_c_wrapper.o In file included from ale_python_interface/ale_c_wrapper.cpp:2: ale_python_interface/ale_c_wrapper.h:19:78: error: no member named 'set' in 'ALEInterface' void setString(ALEInterface _ale,const char key,const char value){ale->set(key,value);}


ale_python_interface/ale_c_wrapper.h:20:67: error: no member named 'set' in 'ALEInterface'
    void setInt(ALEInterface *ale,const char *key,int value){ale->set(key,value);}
                                                             ~~~  ^
ale_python_interface/ale_c_wrapper.h:21:69: error: no member named 'set' in 'ALEInterface'
    void setBool(ALEInterface *ale,const char *key,bool value){ale->set(key,value);}
                                                               ~~~  ^
ale_python_interface/ale_c_wrapper.h:22:71: error: no member named 'set' in 'ALEInterface'
    void setFloat(ALEInterface *ale,const char *key,float value){ale->set(key,value);}
                                                                 ~~~  ^
ale_python_interface/ale_c_wrapper.h:29:19: warning: unused variable 'sz' [-Wunused-variable]
        const int sz = (int)ale->getLegalActionSet().size();
                  ^
ale_python_interface/ale_c_wrapper.h:39:19: warning: unused variable 'sz' [-Wunused-variable]
        const int sz = (int)ale->getMinimalActionSet().size();
                  ^
ale_python_interface/ale_c_wrapper.h:79:71: error: no member named 'set' in 'ALEInterface'
    void set(ALEInterface *ale,const char *key,const char_value){ale->set(key,value);}
                                                                 ~~~  ^
2 warnings and 5 errors generated.
error: command 'cc' failed with exit status 1
bbitmaster commented 9 years ago

If I were to guess, the reason it can't find the ale_python_interface.hpp file under sudo, is because you have a ~ in the path. the ~ points to the current user's home directory, which won't be the same under sudo.

Anyway, this python interface has now been incorporated into ALE, and they've changed ALE enough that my original code probably doesn't work with the latest version of ALE anymore. I recommend you instead use the python interface that is contained in the latest official ALE repository: https://github.com/mgbellemare/Arcade-Learning-Environment

markovyao commented 8 years ago

I'm having similar issues, is the problem on the gcc ?

ale_python_interface/ale_c_wrapper.h:79:71: error: ‘class ALEInterface’ has no member named ‘set’ void set(ALEInterface _ale,const char *key,const char_value){ale->set(key,value);} ^ error: command 'gcc' failed with exit status 1

Rahman29 commented 8 years ago

charu-iitm Did you get the solution???

Similar problem:

ale_python_interface/ale_c_wrapper.h:4:10: fatal error: 'ale_interface.hpp' file not found

include

     ^

1 error generated. error: command 'gcc' failed with exit status 1

ghost commented 8 years ago

I also have the same error error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

charu-iitm commented 8 years ago

Nope. No luck as of yet ! :(

On Fri, Sep 2, 2016 at 8:50 AM, potholiday notifications@github.com wrote:

I also have the same error

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/bbitmaster/ale_python_interface/issues/2#issuecomment-244273469, or mute the thread https://github.com/notifications/unsubscribe-auth/AL8sgL-GBomV-DOq0FbzIIKmEqJsiAZ5ks5ql5XygaJpZM4EkRvI .

With Best Regards,

Charu Chauhan

CSE DEPTT. IIT MADRAS Email:cs14m058@smail.iitm.ac.in