2

I am trying to import scikit-learn in a C# (console) application. I am using Python Tools for Visual Studio and IronPython 2.7.3.

I managed to run an external python script and I also managed to import numpy by declaring the python path: "C:\Python27\Lib\site-packages\"

However, when it comes to scikit-learn I get an error message:

Oops! We couldn't execute the script because of an exception: No module named _c
heck_build
___________________________________________________________________________
Contents of C:\Python27\Lib\site-packages\sklearn\__check_build:
setup.py                  setup.pyc                 setup.pyo
_check_build.pyd          __init__.py               __init__.pyc
__init__.pyo
___________________________________________________________________________
It seems that scikit-learn has not been built correctly.

If you have installed scikit-learn from source, please do not forget
to build the package before using it: run `python setup.py install` or
`make` in the source directory.

If you have used an installer, please check that it is suited for your
Python version, your operating system and your platform.

The file "_check_build.pyd" exists in "C:\Python27\Lib\site-packages\sklearn__check_build\".

My code is based on this article: http://devleader.ca/2013/09/23/visual-studio-c-python-sweet/ The file I am using has only the following code:

from sklearn.svm import SVC

print('Hello Python in C#')

Is it possible to add and use scikit in C#? If yes, could you please provide a workaround?

mdml
  • 22,442
  • 8
  • 58
  • 66
celetron
  • 53
  • 7

1 Answers1

1

Looks like scikit-learn requires a C extension, which means it won't run under IronPython.

Jeff Hardy
  • 7,632
  • 24
  • 24