-
Notifications
You must be signed in to change notification settings - Fork 768
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
Use CMAKE_INSTALL_PREFIX for python-install target #1075
Conversation
I don't think this is the right approach. If you read the docs in detail, it says that the path to install to should be Have you tried using this change and running some simple scripts in IPython? |
Yes, of course I have tried that. In this case with To be honest, I don't really understand what you are talking about. There has to be no python interpreter located where packages are installed. In fact, if you do a The only thing I can understand is that one might want to install the C++ library somewhere else than where the Python library is installed. But then a new CMake variable should be introduced from my point of view to choose the Python install path. Currently, you can not change the install path of the Python library at all. If you are not in a virtual environment, it's the system's Python library path which usually requires root privileges. |
So if you look at the answers in that SO reference you shared, it says that the install path with --user is in a directory tree under a python installation which is basically the site-packages directory. You could install the module anywhere but we prefer that the user need not update the PYTHONPATH since that can be error prone and hard to debug especially for those not familiar with Python's system level machinery. If you wish to just not have to install to /use/local why not just add the --user flag to the install command in CMake? |
I don't know where you have read that. Just to be clear:
--> The python installation is in
And how? With the current CMakeLists you can't. It always installs to
Yes, therefore the default, i.e. the user specifies nothing, installation path should still be
Because that will change the default behavior and probably won't work for everybody, e.g. in a virtual environment. |
From your own output, the install location is
I meant this hypothetically, or by running
Again, no. The default location will be
In that case, why not just install the nightly build or the package on PyPI? Your PR does not address this issue, rather it just puts the python module next to the C++ libraries. Given how python loads modules, I can foresee a name collision happening here where Python tries to import |
Yes, but prefix is only
Again, that's wrong. It's a prefix!
Because my own development branch is not on PyPi?! It obviously is not about the average user but a useful addition for developers IMHO.
No, it doesn't. See above. It is exhausting... |
I think you guys probably are not talking on the same page here @senselessDev and @varunagrawal . @senselessDev, the docs may be a bit misleading, So I think the current behavior is reasonable, though not perfect. Since the |
Well you kept saying it would install to
I am sorry this is exhausting for you, but it is equally exhausting for us when we are not given the proper information. |
All please keep discussion courteous and professional here, please. |
I don't know what exactly is misleading, but yes, that will usually default to the
Yes, that's true. Changing after configuring is not a good idea. But is that an argument against the I assume from your answer that you don't like my idea, which is ok, but I don't get why. Can you elaborate? Is an additional CMake variable not a good idea to solve all issues then?
I'd still say it installs in
And your python executable is To summarize, for me it is not fun anymore to contribute to the project at the moment. Therefore, I will also not pursue this PR for now. Maybe the doc should be changed at least when it does not hold true anymore: Line 32 in d6edcea
|
@senselessDev I have to apologize for @varunagrawal 's language above. I think he was out of line, and then the discussion spiraled out of control. I'm OK with closing this PR. @varunagrawal please do not respond here - talk to me offline if needed. Let's please leave it at this for this PR. |
Currently the
python-install
target wants to install to the default location of setup.py which is/usr/local
(see here). That typically means you need tosudo make python-install
(root privileges). The normal gtsam C++ code gets installed toCMAKE_INSTALL_PREFIX
as usual with CMake (e.g. you could choose$HOME/.local
for a per-user installation without root privileges).If you don't specify any custom
CMAKE_INSTALL_PREFIX
, CMake should default to/usr/local
on Linux which then should be the same behavior as before (on my machine it does). I am not sure about Windows though...I propose to also use this CMake mechanism to select where the python bindings are going to be installed. Actually, the current readme says that it actually would work this way:
gtsam/python/README.md
Line 32 in d6edcea
But it does not. This PR fixes that.
Edit: Just for reference, was already topic in #1059 (comment)