mailgun / talon

Apache License 2.0
1.27k stars 285 forks source link

Unable to install without the ML functionality #130

Open alexei opened 7 years ago

alexei commented 7 years ago

How does one install talon without ML? I tried both pip install talon --global-option="--no-ml" and pip install talon --install-option="--no-ml" and neither seems to work (admitedly this is the first time I'm using the package options flag). Somehow it ends up trying to install all packages and fails at Scipy (either from the Fortran dependency when installing without the flag, or because option --no-ml not recognized)

Using Python 2.7.12, pip 9.0.1 on macOS

timabbott commented 7 years ago

The problem is I think that the options feature in pip is not super well-implemented. We were able to get that option to work, but not in a requirements.txt file.

We'd also be interested in this for Zulip (github.com/zulip/zulip/); right now we're installing off of a fork because we don't want a dependency on numpy and friends.

timabbott commented 7 years ago

I wonder whether a better solution would be to split out an independent package for the non-ML parts of talon. E.g. call it talon-noml, and have talon depend on that.

ad-m commented 7 years ago

@timabbott , there is claw - a fork of @tictail without ML.

imankulov commented 6 years ago

Hey everyone! Would like to kindly ask for an update from package maintainers.

Ended up with the same issue today. Only wanted to use non-ml features of talon, but couldn't do it without extracting essential parts of it into a separate library. The claw library seems to be abandoned (updated 3 years ago and at the time of writing 179 commits behind mailgun:master).

Tried to use the --no-ml option, but ended up with several issues with it.

  1. As it was pointed out earlier, the feature is not very well maintained. The pip install talon --install-option="--no-ml applies recursively to the package itself and all its dependencies.
  2. Due to different versions of scikit-learn here and the same file here even with python setup.py install --no-ml scikit-learn will be installed.
  3. I'm not a distutil/pip expert in no way, but I have a feeling that managing dependencies with an option flag is a hacky way which is incompatible with eggs and wheels. They store package dependencies in text files xxx-dist-info/METADATA and xxx-egg-info/requires.txt and, if I'm not mistaken, let you install packages without actually resorting to execute any code from setup.py. Declaring extras sounds like a more correct way of dealing with the issue.

With all this in mind, I would see three options to solve the issue.

  1. If there is no intention to maintain the --no-ml flag, probably it makes sense to remove it from setup.py to avoid any confusion.
  2. Alternatively, ML requirements could be extracted away to extras as extras_require={"ml": ["numpy", "scipy", ...]}. It's backward incompatible of course, since now everyone who wants to use ML features, has to install it as pip install talon[ml] and update requirements correspondingly.
  3. As it was suggested, extract non-ML part to something like talon-noml and add it as a dependency.

Thanks!

timabbott commented 6 years ago

I'd love to see that happen. Certainly the --no-ml flag hasn't ended up being actually useful due to the requirements.txt issues I noted above. And at the same time, the features of this library that don't involve ML are really valuable, but when one isn't using the ML features, it's unfortunate to have to install the ML dependencies (because they are super slow to install and import!).

andersk commented 4 years ago

I wonder whether a better solution would be to split out an independent package for the non-ML parts of talon. E.g. call it talon-noml, and have talon depend on that.

I’ve implemented this in #200 (calling it talon-core), since the other extras-based solution was previously rejected in #121.