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

Auto-install Python Package #277

Merged
merged 32 commits into from
Jul 16, 2020
Merged

Auto-install Python Package #277

merged 32 commits into from
Jul 16, 2020

Conversation

varunagrawal
Copy link
Collaborator

@varunagrawal varunagrawal commented Apr 8, 2020

New make python-install command to automatically install the python wrapper.

The installation flow is as simple as

cmake ..
make -j4
make python-install

The major update is that instead of copying all the build artifacts to a 3rd party location (e.g. /usr/loca/cython), we instead store the build artifacts under the cmake build/cython directory (with build tags getting added as postfixes by default).

Running make now builds all the wrapper artifacts directly and in place, removing the need to run make install.

The make python-install command then installs the build artifacts by running the setup.py making installation a one-line command. Since we no longer rely on make install, the make python-install command can directly handle all the dependencies.


This change is Reviewable

@varunagrawal varunagrawal added the enhancement Improvement to GTSAM label Apr 8, 2020
@varunagrawal varunagrawal self-assigned this Apr 8, 2020
@varunagrawal varunagrawal force-pushed the feature/python-install branch from 97362c6 to 1725a57 Compare June 22, 2020 22:24
@varunagrawal varunagrawal added cmake Related to CMake and build system python Related to python wrapper labels Jun 22, 2020
@varunagrawal varunagrawal marked this pull request as ready for review June 22, 2020 23:10
@varunagrawal varunagrawal requested review from dellaert and ProfFan June 22, 2020 23:10
@varunagrawal
Copy link
Collaborator Author

@jlblancoc I may need your help on this PR. I need to add corresponding python wrapper installation instructions in the cython/scripts/install.bat file for Windows and you are the expert on this.

@varunagrawal varunagrawal requested a review from jlblancoc June 24, 2020 15:03
@jlblancoc
Copy link
Member

@jlblancoc I may need your help on this PR. I need to add corresponding python wrapper installation instructions in the cython/scripts/install.bat file for Windows and you are the expert on this.

Hmmm... what about a cmake script instead, so it's common to both Windows and Linux?

@varunagrawal
Copy link
Collaborator Author

I actually tried a cmake script first but running with superuser became problematic and it wouldn't work consistently.
However, I've actually learned some new tricks since then so let me try again.

@varunagrawal
Copy link
Collaborator Author

Okay that worked beautifully for me on Linux. Thank you @jlblancoc!

@varunagrawal
Copy link
Collaborator Author

This should be ready for review now.

@ProfFan
Copy link
Collaborator

ProfFan commented Jun 29, 2020

@varunagrawal have you tried installing and test on all normal configurations (Debug, Release, RelWithDebInfo)?

@varunagrawal
Copy link
Collaborator Author

I tested with Release and Debug. Testing with RelWithDebugInfo now.

Build everything inside the build/cython{BuildType} directory directly, so we can bypass the `make install` step and introduce the `make python-install` step which allows cmake to handle all dependencies.
@varunagrawal
Copy link
Collaborator Author

@ProfFan @dellaert updated this PR and the description. This should satisfy all the requirements. 🙂

Copy link
Member

@dellaert dellaert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am now completely confused, and want to talk in person before merging. It seems a lot of work/confusion for something that was not a problem to begin with (at least for me) and will, when merged, impart confusion on existing users. I'm happy to be convinced otherwise, in person.

There seem to be a lot of unrelated changes in this PR as well (with the build suffixes etc) that make reviewing hard.

@varunagrawal
Copy link
Collaborator Author

Sure thing. Yeah this PR went through a lot of different cycles due to different requirements being pushed in at different times.

It wasn't a problem per se, but I have not been a fan of having to go into a separate directory just to install the wrapper to the python environment.

- Added python-install target variable for easy updating.
- Fixed/Added all dependencies so that everything is built automatically.
- Removed unnecessary install commands
varunagrawal pushed a commit that referenced this pull request Jul 5, 2020
Long awaited fixe of some QPSolver tests
Feature/lpsolver
@dellaert dellaert mentioned this pull request Jul 7, 2020
26 tasks
@dellaert dellaert added this to the GTSAM 4.1 milestone Jul 9, 2020
@varunagrawal varunagrawal removed this from the GTSAM 4.1 milestone Jul 13, 2020
@dellaert dellaert added this to the GTSAM 4.0.3 milestone Jul 14, 2020
@dellaert
Copy link
Member

@varunagrawal this is cython so we should either give up or put in 45.0.3. Please summarize what this PR now does.

@dellaert
Copy link
Member

@varunagrawal this is the only PR left in 4.0.3

@varunagrawal
Copy link
Collaborator Author

This should still be useful for generating packages with the new Pybind11 wrapper.

Moreover, it has a good number of nice fixes to the setup.py and CMake files.

@ProfFan
Copy link
Collaborator

ProfFan commented Jul 15, 2020

@varunagrawal I have implemented python-install in the pybind branch already (because in the pybind branch and possibly 4.1 make install will not copy the python files to the prefix, resulting in a much cleaner install).

I think this can be picked into 4.0.3 after branching out release_4.0.3

@dellaert
Copy link
Member

This should still be useful for generating packages with the new Pybind11 wrapper.

Moreover, it has a good number of nice fixes to the setup.py and CMake files.

Please summarize what this PR now does.

@varunagrawal
Copy link
Collaborator Author

This PR

  1. Gets rid of the install step for the python wrapper by building everything into the cython directory under the cmake build directory.
  2. Adds a new make command python-install which generates the python package and installs it via python setup.py install.
  3. Introduces a bunch of clean ups to the Cython Cmake files and the setup.py.in template file.

@dellaert
Copy link
Member

OK, thanks! @ProfFan this seems identical to what you did in pybind. Please confirm or tell us how it is different, and what needs to change in this PR - if anything. It should be identical - no sense in changing gears twice in a month.

@ProfFan
Copy link
Collaborator

ProfFan commented Jul 16, 2020

@dellaert Yes it is identical. I believe this could go into the release branch after branching out (since 4.1 will not have Cython stuff)

@dellaert
Copy link
Member

@ProfFan can't we just merge into develop and then merge all recent changes from develop into the already existing 4.0.3 branch?

@ProfFan
Copy link
Collaborator

ProfFan commented Jul 16, 2020

@dellaert Yes

@dellaert dellaert merged commit c8ddd43 into develop Jul 16, 2020
@dellaert dellaert deleted the feature/python-install branch July 16, 2020 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cmake Related to CMake and build system enhancement Improvement to GTSAM python Related to python wrapper
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants