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

Cmake doesn't recognize homebrew installed python. #6

Closed
NiekSchultheiss opened this issue May 20, 2014 · 4 comments
Closed

Cmake doesn't recognize homebrew installed python. #6

NiekSchultheiss opened this issue May 20, 2014 · 4 comments
Assignees

Comments

@NiekSchultheiss
Copy link

I had to apply some hacks to get CRPropa running on my system with a Homebrew installed Python.

It showed the correct paths to the /usr/local version of Python during cmake ..
However, when doing ccmake .. it used the wrong Python Headers:

PYTHON_EXECUTABLE   /usr/local/bin/python
PYTHON_H_FOUND      /System/Library/Frameworks/Python.framework/Headers

I had to manually set the Python headers location to the homebrew version:

/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Headers/Python.h

Then I proceeded with make && make test, which passed 100%, then make install.
Which also went fine, but importing crpropa resulted in Python crashing.
I found wrong links to python:

otool -L /usr/local/lib/python2.7/site-packages/_crpropa.so

And had to change it to the correct one:

install_name_tool -change /System/Library/Frameworks/Python.framework/Versions/2.7/Python /usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/Python /usr/local/lib/python2.7/site-packages/_crpropa.so

After which running the example worked.

@geromueller
Copy link
Member

Hi,

could you please run

/usr/local/bin/python -c "import sys; from distutils import sysconfig;
sys.stdout.write(sysconfig.get_python_inc())"

and report the output? Maybe your homebrew python installation is faulty.

Thanks
Gero

Am Dienstag, 20. Mai 2014, 02:34:18 schrieb NiekSchultheiss:

I had to apply some hacks to get CRPropa running on my system with a
Homebrew installed Python.

It showed the correct paths to the /usr/local version of Python during
cmake .. However, when doing ccmake .. it used the wrong Python
Headers:

PYTHON_EXECUTABLE   /usr/local/bin/python
PYTHON_H_FOUND      /System/Library/Frameworks/Python.framework/Headers

I had to manually set the Python headers location to the homebrew version:

/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Headers/Python.h

Then I proceeded with make && make test, which passed 100%, then make install. Which also went fine, but importing crpropa resulted in Python
crashing. I found wrong links to python:

otool -L /usr/local/lib/python2.7/site-packages/_crpropa.so

And had to change it to the correct one:

install_name_tool -change

/System/Library/Frameworks/Python.framework/Versions/2.7/Python
/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/Pyt
hon /usr/local/lib/python2.7/site-packages/_crpropa.so

After which running the example worked.


Reply to this email directly or view it on GitHub:
#6

Dipl.-Phys. Gero Müller
III. Physikalisches Institut A
RWTH Aachen University
+49 (0)241 80 23567

@NiekSchultheiss
Copy link
Author

Running:

>>> import sys
>>> from distutils import sysconfig
>>> sysconfig.get_python_inc()
'/usr/local/Cellar/python/2.7.6_1/Frameworks/Python.framework/Versions/2.7/include/python2.7'

Thanks,
Niek

@DavidWalz DavidWalz assigned geromueller and rafaelab and unassigned geromueller Aug 2, 2014
@rafaelab
Copy link
Member

rafaelab commented Aug 3, 2014

Hello!

There was a recent change in python/Python.cmake that might fix that. Can you try setting these options when running cmake:
-DPYTHON_EXECUTABLE=/path/to/homebrew/python/python
-DPYTHON_LIBRARIES=/path/to/homebrew/python/libpython.so (or .dylib)
By doing this you will be linking the libraries against your homebrew installed python instead of the standard Apple python framework.

Please let me know the outcome of this.

Rafael

@DavidWalz
Copy link
Member

assume solved

@lyang54 lyang54 mentioned this issue Nov 17, 2017
TobiasWinchen added a commit that referenced this issue Apr 16, 2020
lukasmerten pushed a commit that referenced this issue Nov 3, 2021
reichherzerp pushed a commit to reichherzerp/CRPropa3 that referenced this issue Dec 19, 2022
Update of output and plugin documentation
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants