dgasmith / gau2grid

Fast computation of a gaussian and its derivative on a grid.
https://gau2grid.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
29 stars 15 forks source link

[regression in 1.3.1] Python module installer attempts to create a directory outside of the stage directory #39

Closed yurivict closed 5 years ago

yurivict commented 5 years ago
CMake Error at cmake_install.cmake:36 (file):
  file INSTALL cannot make directory
  "/usr/local/lib/python3.6/site-packages/gau2grid": Permission denied

1.3.0 worked fine.

FreeBSD 11.2 amd64

loriab commented 5 years ago

The pre-1.3.1 install only worked through happy coincidence and couldn't support the sonamed library.

What was your original command -- setup.py or cmake? The former should only be used by users who have been beguiled by python into thinking that an install should go off and put files outside <objdir> or CMAKE_PREFIX_PATH. For your case, I'd use cmake directly and avoid NATIVE_PYTHON_INSTALL. In that case, make install does install into prefix, and the default value should be reset here. I suppose you've reset -DCMAKE_PREFIX_PATH=/usr/local/? Do you need to be root to write there?

loriab commented 5 years ago

Judging from your other issue, what happened was that you used NATIVE_PYTHON_INSTALL with a /usr/local/bin/python, so it tried to install python-style to the governing python's site-packages. To linux people, this is monstrous. Skip the NATIVE_PYTHON_INSTALL and instead use CMAKE_PREFIX_PATH, CMAKE_INSTALL_LIBDIR, and PYMOD_INSTALL_LIBDIR to completely control the install path.

yurivict commented 5 years ago

What was your original command -- setup.py or cmake?

setup.py. Normally, python modules are build with setup.py.

yurivict commented 5 years ago

Skip the NATIVE_PYTHON_INSTALL and instead use CMAKE_PREFIX_PATH, CMAKE_INSTALL_LIBDIR, and PYMOD_INSTALL_LIBDIR to completely control the install path.

Wouldn't this build the c++ library as well? I need to keep the c++ library and the python binding separate. They are currently separate.

loriab commented 5 years ago

setup.py. Normally, python modules are build with setup.py.

Granted. But setup.py is severely underpowered for building C extensions to python. gau2grid's setup.py has always called cmake behind the scenes. There were some real problems with that when soname came into the picture, so I limited the setup.py's usefulness to solely the user case (install into python's site-packages). Those that want control, like you and I do for packaging, should go for cmake directly (where Linux prefix rules apply).

Wouldn't this build the c++ library as well? I need to keep the c++ library and the python binding separate. They are currently separate.

gau2grid has always had two copies of the library: in <prefix>/lib/libgau2grid for install target gau2grid and in <prefix>/lib/pythonx.x/site-packages/gau2grid/libgau2grid (I'm probably off by some prefixes/suffixes). With the soname addition, one couldn't outright copy the library into two places anymore, so the renaming and new extension is done by cmake. You can't have (and never could have) package pygau2grid depend on package gau2grid. You can build both packages at once, then separate them: pygau2grid and gau2grid. Or you can build gau2grid alone (-DINSTALL_PYMOD=OFF). There isn't an option at present to install only pygau2grid (probably just comment out https://github.com/dgasmith/gau2grid/blob/master/CMakeLists.txt#L114-L140).

yurivict commented 5 years ago

There isn't an option at present to install only pygau2grid

I have them separated like this, though. Will try your suggestion of commenting out the line.

yurivict commented 5 years ago

This solved the problem, thank you for your help!

loriab commented 5 years ago

Great! Thanks for working with our slightly funny build system.