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

Add core dependencies installation script #80

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

ovysotska
Copy link

@ovysotska ovysotska commented Nov 8, 2024

This PR adds a script to pull and install all core dependencies needed for the LaMAR.
Warning, the C++ dependencies will be installed system wide.

This PR also:

  • downgrades the version of pycolmap for compatibility issues with COLMAP 3.8.
  • downgrades the numpy version in scantools for compatibility with the numpy version of LaMAR.
  • adds dependency for scikit-learn because HLOC 1.4 requires it.
  • update Dockerfile.

@ovysotska
Copy link
Author

@microsoft-github-policy-service agree

@pablospe
Copy link
Contributor

pablospe commented Nov 8, 2024

Thanks! There are some scripts in the docker/scripts directory that might be helpful to you as well. I am considering moving these scripts outside of the docker/ folder for better organization. Additionally, I need to ensure that the script in this PR works properly within the Docker image.

If you look at the Dockerfile, you'll notice it is similar to your script. The complexity arises because we have different stages: common, scantools, lamar, etc. I also aimed to avoid including development-only dependencies to prevent creating large images.

One question. Have you tried with the lamar image (here)? This supposed to install all the dependencies. I was wondering if having the new pycolmap version breaks the pipeline, in that case I could apply some of your changes in the Dockerfile to return to the old one.

@mihaidusmanu
Copy link
Collaborator

mihaidusmanu commented Nov 8, 2024

Thanks a lot for the contribution @ovysotska !

The docker image is not fully functional either as some calls to pycolmap in this pipeline are not compatible with 0.6.0.
That package should be downgraded in any case (or someone should make a full run over the pipeline to fix all the compatibility issues with 0.6.0 but that is imo out of scope for this PR).

I think it's better if users can also install from scratch without needing docker so having a dedicated script for local setup would be a good thing.

README.md Outdated Show resolved Hide resolved
@ovysotska
Copy link
Author

ovysotska commented Nov 11, 2024

@pablospe thanks for the comment.

I checked the docker/scripts you recommend. They seems to provide instructions to installing hloc and dev dependencies.
In this PR, I am proposing to install the 'core dependencies' such that pcd meshing and raybender are not the part of the script. So hopefully, addressing your concerns here.

About the docker image, yes I tried building it. The building part seemed to work :) at least there were no obvious errors.
Unfortunately, I don't know what to do next with it. The readme doesn't tell how to use this image to run laMAR 😢
I tried creating a container with this image, however, it just did nothing.
If you could add some instructions how to use that image, that would be great 😄 and I could try that out too.

Thanks!

@pablospe
Copy link
Contributor

In this PR, I am proposing to install the 'core dependencies' such that pcd meshing and raybender are not the part of the script.

Ok, I see. Anyways I would like to split this script in several scripts that could be reusable also in the Dockerfile. I will do/propose some changes to this PR, but essentially the same code. Thanks for the contribution!

@pablospe
Copy link
Contributor

@ovysotska
In case you have time, could you check if this is working for you? I tested inside docker, ubuntu 22.04. I will also test it inside ubuntu 24.04 later.

@ovysotska
Copy link
Author

I will try but now I have a question. Do I need to create my own virtual environment, for example through venv before calling .install_core_dependencies.sh script?

@pablospe
Copy link
Contributor

I will try but now I have a question. Do I need to create my own virtual environment, for example through venv before calling .install_core_dependencies.sh script?

Yes, if you want to install the python packages in a new environment. Otherwise, it will install them in the user's default one.

@pablospe
Copy link
Contributor

.install_core_dependencies.sh script

Notice that now all the bash scripts are in scripts/ folder. Then, scripts/install_core_dependencies.sh for running it.

Dockerfile Outdated Show resolved Hide resolved
scripts/build_hloc.sh Outdated Show resolved Hide resolved
@pablospe
Copy link
Contributor

I believe it should be ready for merging.

@mihaidusmanu
Copy link
Collaborator

mihaidusmanu commented Nov 22, 2024

I just tested this on a fresh Ubuntu 24.04 install. I had to manually get python3.9 and some related stuff by doing something along the lines

sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt install python3.9 python3.9-dev python3.9-distutils python3.9-venv
python3.9 -m venv lamar-env
. ./lamar-env/bin/activate 
pip install -U setuptools

Also, seems like there is a bug with the apt version of libsuitesparse-dev and ceres 2.1 (ceres-solver/ceres-solver#1009). I managed to make it work by skipping suitesparse (which is optional). Otherwise everything went smoothly.

Let's maybe update README to recommend 22.04 for the time being?

Later edit: ran an eval on validation and it went well!

* [Ceres Solver 2.1](https://ceres-solver.googlesource.com/ceres-solver/+/refs/tags/2.1.0)
* [Colmap 3.8](https://colmap.github.io/install.html) built from source. Note: **Do not install libceres-dev** as it was installed in the previous step.
* [hloc 1.4](https://github.com/cvg/Hierarchical-Localization) and its dependencies
* [pyceres v1.0](https://github.com/cvg/pyceres) built from source.
Copy link
Collaborator

@mihaidusmanu mihaidusmanu Nov 22, 2024

Choose a reason for hiding this comment

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

nit: pyceres not needed since mentioned in pyproject.

${root_folder}/scripts/install_hloc.sh

# Pyceres.
python3 -m pip install git+https://github.com/cvg/[email protected]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same, can be removed (installed in next step)

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

Successfully merging this pull request may close these issues.

4 participants