DeltaRCM / pyDeltaRCM

Delta model with a reduced-complexity approach
https://deltarcm.org/pyDeltaRCM/
MIT License
18 stars 11 forks source link

Import expects deps installed before they are installed #245

Open vsoch opened 2 years ago

vsoch commented 2 years ago

Hiya! When you do this import:

https://github.com/DeltaRCM/pyDeltaRCM/blob/929ce0837d0a4a3404ec65f123d6d2b2f27c68b6/setup.py#L4

You are technically importing your module before you've installed it, so all the dependencies are expected to be there:

       File "/tmp/tmp9e8wd_fn/pyDeltaRCM/pyDeltaRCM/__init__.py", line 1, in <module>
          from .model import DeltaModel
        File "/tmp/tmp9e8wd_fn/pyDeltaRCM/pyDeltaRCM/model.py", line 7, in <module>
          from .iteration_tools import iteration_tools
        File "/tmp/tmp9e8wd_fn/pyDeltaRCM/pyDeltaRCM/iteration_tools.py", line 7, in <module>
          import matplotlib.pyplot as plt

If you just need the version:

https://github.com/DeltaRCM/pyDeltaRCM/blob/929ce0837d0a4a3404ec65f123d6d2b2f27c68b6/setup.py#L7

perhaps you could just read it statically from a file? Or some other means? There are ways to install specific modules before running your main setup, e.g.,

from setuptools import dist
dist.Distribution().fetch_build_eggs(['numpy>=1.10'])

But I don't think this applies here because you are trying to use the shared_tools in your module, and thus import everything.