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

ImportError: cannot import name 'Porter' #85

Open elimsjxr opened 2 years ago

elimsjxr commented 2 years ago

I'm using porter 0.7.4. and scikit-learn 0.20.0 (using conda) and When I used “from sklearn_porter import Porter” I got the error: ImportError: cannot import name 'Porter' Why about it?

nok commented 2 years ago

Hello @elimsjxr , how did you install the package?

Here are some commands to check your environment:

conda run -n your_env python -m pip freeze | grep porter
conda activate your_env && python -m pip freeze | grep porter

To check the Python interpreter via Python:

python -c 'import sys; print(sys.executable);'

To check the sklearn-porter version via Python:

python -c 'from sklearn_porter import __version__; print(__version__);'

Kind regards, Darius

vladBaciu commented 1 year ago

I had the same issue for a while, till I realized that the Python file where I was running the example had the same name as sklean_porter (sklean_porter.py).