Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OS X Python Installation Instructions #46

Closed
jimfleming opened this issue Apr 26, 2016 · 9 comments
Closed

OS X Python Installation Instructions #46

jimfleming opened this issue Apr 26, 2016 · 9 comments

Comments

@jimfleming
Copy link

This may be useful to others:

$ brew install boost --with-python
$ brew install boost-python
$ cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_PYTHON=ON
$ make
$ rm bin/vizdoom
$ ln -s vizdoom.app/Contents/MacOS/vizdoom bin/vizdoom
$ cd examples/python
$ python basic.py
@SimsGautam
Copy link

I get the following error when trying to install in OSX:
ld: library not found for -lrt
clang: error: linker command failed with exit code 1

@wjaskowski
Copy link
Collaborator

This is near to impossible. Are you sure you have the most recent version from the master? Pull it once again. Then execute cmake_clean.sh. Then try again cmake . && make and let me know.

@jimfleming
Copy link
Author

jimfleming commented Apr 27, 2016

@SimsGautam Also make sure you've opened Xcode before and accepted the ToS. Without doing so many random things will break.

EDIT: I believe you can also use sudo xcodebuild -license.

@allentran
Copy link

Thanks for this, I'm having trouble running the the example:

  File "/usr/local/bin/../Cellar/python/2.7.11/bin/../Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 548, in <module>
    main()
  File "/usr/local/bin/../Cellar/python/2.7.11/bin/../Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 530, in main
    known_paths = addusersitepackages(known_paths)
  File "/usr/local/bin/../Cellar/python/2.7.11/bin/../Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 266, in addusersitepackages
    user_site = getusersitepackages()
  File "/usr/local/bin/../Cellar/python/2.7.11/bin/../Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 241, in getusersitepackages
    user_base = getuserbase() # this will also set USER_BASE
  File "/usr/local/bin/../Cellar/python/2.7.11/bin/../Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 231, in getuserbase
    USER_BASE = get_config_var('userbase')
  File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sysconfig.py", line 520, in get_config_var
    return get_config_vars().get(name)
  File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sysconfig.py", line 453, in get_config_vars
    import re
  File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/re.py", line 108, in <module>
    import _locale

Any ideas?

@wjaskowski
Copy link
Collaborator

Well, I assume that you get SystemError: dynamic module not initialized properly at the end of the output you have shown, right? Then, it is related to #45 and it means that something is wrong with your python. I can see that you are using brew'ed python. I use macports so I cannot check myself but for many people using brew the instruction in #46 did the trick. Could you try it and let me know?

@allentran
Copy link

allentran commented May 5, 2016

Thanks, cmake definitely found my brew'd Python but then I get this on running make

[  1%] Built target vizdoomstatic
[  1%] Building CXX object CMakeFiles/vizdoompython.dir/vizdoom_api_bindings/python/ViZDoomPythonBinding.o
In file included from /Users/allen.tran/personal/ViZDoom/vizdoom_api_bindings/python/ViZDoomPythonBinding.cpp:23:
/Users/allen.tran/personal/ViZDoom/vizdoom_api_bindings/python/ViZDoomGamePython.h:32:10: fatal error: 'Python.h' file not found
#include <Python.h>
         ^
1 error generated.
make[2]: *** [CMakeFiles/vizdoompython.dir/vizdoom_api_bindings/python/ViZDoomPythonBinding.o] Error 1
make[1]: *** [CMakeFiles/vizdoompython.dir/all] Error 2
make: *** [all] Error 2

@wjaskowski
Copy link
Collaborator

It seems that your PYTHON_INCLUDE_DIR was set incorrectly. To verify this:

Find PYTHON_INCLUDE_DIR= in CMakeCache.txt (e.g., PYTHON_INCLUDE_DIR:PATH=/usr/include/python2.7) and check whether it contains Python.h:

ls -l /usr/include/python2.7/ | grep Python.h

It probably does not, so you need to set it correctly according to your system as it reads in the "compiling" section: https://github.com/Marqt/ViZDoom/blob/b0dbb4f74d936bd6ad304515395d887fb58d4ad4/README.md#compiling-2

Let me know whether this helped

@allentran
Copy link

Got it working. The relevant include folder for brew Python is /include/python/2.7 so this line in the readme should be DPYTHON_INCLUDE_DIR=/usr/local/Cellar/python/2.x.x/Frameworks/Python.framework/Versions/2.7/include/python2.7 instead of DPYTHON_INCLUDE_DIR=/usr/local/Cellar/python/2.x.x/Frameworks/Python.framework/Versions/2.7/include (note the additional directory at the end).

Thanks for the help, super excited now.

@wjaskowski
Copy link
Collaborator

Thx for letting us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants