jeanfeydy / geomloss

Geometric loss functions between point clouds, images and volumes
MIT License
570 stars 57 forks source link

Installing geomloss fails if torch is being installed at the same time #69

Closed ryuusenshi closed 1 year ago

ryuusenshi commented 1 year ago

If geomloss is part of a requirements file being installed with pip, installation will fail if torch is not already installed.

The reason being that geomloss is imported in setup.py, which in turns imports geomloss.__init__, which imports geomloss.samples_loss, which imports torch.

Even if you put torch in the same requirements file, the installation will fail because packages are fully installed in the end.

The only thing used in setup.py is geomloss.__init__.__version__, so I suggest to move the SamplesLoss import in a new file: losses.py, and leave only the __version__ in __init__.py

matthewfeickert commented 1 year ago

PR #59 resolves this.

(Note, it is even worse as it actually requires both numpy and torch to already be installed to install geomloss.)

ryuusenshi commented 1 year ago

Thanks, @matthewfeickert . Yes, eventually I saw it required numpy too.

I'll close this issue since it's being addressed

matthewfeickert commented 1 year ago

I'll close this issue since it's being addressed

I'd actually suggest keeping it open until the PR gets closed. It can be helpful for others searching the repo to see what Issues are open.

matthewfeickert commented 1 year ago

Resolved with v0.2.6.