bluescarni / piranha

The Piranha computer algebra system.
GNU General Public License v3.0
101 stars 25 forks source link

Problem installing development version with Python bindings #80

Closed jppelteret closed 8 years ago

jppelteret commented 8 years ago

I've (apparently) managed to successfully build the development version of the library with the Python bindings, but when the library is installed I hit an issue. I'm using a non-system Python that is correctly detected, and is not installed in a privileged directory.

-- Found PythonInterp: /Users/jp/Programs/GitHub/Spack/spack/opt/spack/darwin-elcapitan-x86_64/clang-7.3.0-apple/python-2.7.12-r36wznoeqvfh34kbjaqfvd4wmt7pts57/bin/python (found version "2.7.12") 
-- Found PythonLibs: /Users/jp/Programs/GitHub/Spack/spack/opt/spack/darwin-elcapitan-x86_64/clang-7.3.0-apple/python-2.7.12-r36wznoeqvfh34kbjaqfvd4wmt7pts57/lib/libpython2.7.dylib (found version "2.7.12") 
-- Python interpreter: /Users/jp/Programs/GitHub/Spack/spack/opt/spack/darwin-elcapitan-x86_64/clang-7.3.0-apple/python-2.7.12-r36wznoeqvfh34kbjaqfvd4wmt7pts57/bin/python
-- Python libraries: /Users/jp/Programs/GitHub/Spack/spack/opt/spack/darwin-elcapitan-x86_64/clang-7.3.0-apple/python-2.7.12-r36wznoeqvfh34kbjaqfvd4wmt7pts57/lib/libpython2.7.dylib
-- Python include dirs: /Users/jp/Programs/GitHub/Spack/spack/opt/spack/darwin-elcapitan-x86_64/clang-7.3.0-apple/python-2.7.12-r36wznoeqvfh34kbjaqfvd4wmt7pts57/include/python2.7
-- Python library version: 2.7.12

and the error message is

CMake Error at pyranha/cmake_install.cmake:39 (file):
  file cannot create directory: /pyranha.  Maybe need administrative
  privileges.

This looks like its trying to install into the root directory?

I'm building on OSX 10.11 El Capitan. Build log.

bluescarni commented 8 years ago

Hello @jppelteret, I think the problem here is that the heuristic in pyranha's CMake module fails to deduce a correct path to install pyranha and ends up trying to install it into /pyranha, which fails because of the unprivileged user permissions.

Indeed, I can see in the log you attached the following bit:

-- OS X platform detected.
-- Output extension for compiled modules will be '.so'.
-- Python modules install path:

That is, the Python modules install path is an empty variable. You can see from here:

https://github.com/bluescarni/piranha/blob/master/cmake_modules/yacma/YACMAPythonSetup.cmake#L25

that OSX support for determining Python modules install path is missing. On other UNIX-like system, in order to determine the correct path, it runs the following small script:

https://github.com/bluescarni/piranha/blob/master/cmake_modules/yacma/yacma_python_packages_dir.py

which basically asks the Python interpreter where the (hopefully) correct path is. Do you think you could try to adopt the same approach on OSX and test it?

jppelteret commented 8 years ago

Thanks a lot @bluescarni for indicating the source of the issue! Sure, I'd be happy to try to fix it. I'll probably do that tomorrow, and if successful will make a PR.

isuruf commented 8 years ago

@bluescarni, symengine.py use this, https://github.com/symengine/symengine.py/blob/master/cmake/FindPython.cmake#L51