nok / sklearn-porter

Transpile trained scikit-learn estimators to C, Java, JavaScript and others.
BSD 3-Clause "New" or "Revised" License
1.28k stars 170 forks source link

Trouble installing #1

Closed bkj closed 7 years ago

bkj commented 7 years ago

Hi -- tried installing and running the Go example, but I'm getting this error:

$ cd sklearn-porter/examples/classifier/LinearSVC/go
$ python basics.py

Traceback (most recent call last):
  File "basics.py", line 12, in <module>
    model = Porter(language='go').port(clf)
  File "/Users/bjohnson/anaconda/lib/python2.7/site-packages/sklearn_porter-0.2.0-py2.7.egg/sklearn_porter/__init__.py", line 56, in port
    ported_model = instance.port(model)
  File "/Users/bjohnson/anaconda/lib/python2.7/site-packages/sklearn_porter-0.2.0-py2.7.egg/sklearn_porter/classifier/LinearSVC/__init__.py", line 69, in port
    return self.predict()
  File "/Users/bjohnson/anaconda/lib/python2.7/site-packages/sklearn_porter-0.2.0-py2.7.egg/sklearn_porter/classifier/LinearSVC/__init__.py", line 81, in predict
    return self.create_class(self.create_method())
  File "/Users/bjohnson/anaconda/lib/python2.7/site-packages/sklearn_porter-0.2.0-py2.7.egg/sklearn_porter/classifier/LinearSVC/__init__.py", line 111, in create_method
    return self.temp('method', indentation=1, skipping=True).format(
  File "/Users/bjohnson/anaconda/lib/python2.7/site-packages/sklearn_porter-0.2.0-py2.7.egg/sklearn_porter/classifier/__init__.py", line 114, in temp
    raise AttributeError('Template \'%s\' not found.' % (name))
AttributeError: Template 'method' not found.

Any thoughts? Thanks!

bkj commented 7 years ago

This should be resolved with above PR

nok commented 7 years ago

Hello @bkj,

thanks! I added a similar solution and published the module again. Now you can reinstall it:

pip install --no-cache-dir --force-reinstall --ignore-installed sklearn-porter

Happy coding, Darius