Import with optional dependencies #418
guillemc23
started this conversation in
Ideas
Replies: 1 comment
-
|
Good suggestions! Could you please submit a pull request? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello @giswqs! Really solid work with this library!
I would like to propose being able to install this package in different ways, depending on the project's needs. For example, in my use case, I don't need a lot of the dependencies since I only need to use the model itself, but having to install leafmap adds a lot of overhead for Docker environments.
I propose using the
pyproject.tomlto define different optional dependencies:segment-geospatial[core]: only installs the actual model utilitiessegment-geospatialorsegment-geospatial[full]: installs everything including leafmap, localtileserver and other utilities that are only required when running for Jupyter notebookssegment-geospatial[text]: installs SAMGeo with GroundingDino to enable text promptsFor example, one could do
pip install segment-geospatial[core,text]if his or her use case does not require Jupyter notebooks and is instead planned to run as a service with some other frontend.I think it would be interesting as well to provide options for whether to install torch with CPU or GPU support, since, at the moment, all of Nvidia's libraries are being installed even on CPU only machines, making the environment and Docker image unnecessarily big. I can suggest these, with one of them being the default installation mode.
segment-geospatial[gpu]: installs torch from the CUDA repositorysegment-geospatial[cpu]: installs CPU only versionPD: I believe GroundingDino and SAMGeo should have their OpenCV version aligned, since the first requires
opencv-pythonand the second oneopencv-python-headless, leading to some import errors when installing both. This can be fixed overriding dependencies with the UV Python package manager, but that's just a local workaroundBeta Was this translation helpful? Give feedback.
All reactions