Intel® Distribution for Python*
Engage in discussions with community peers related to Python* applications and core computational packages.
424 Discussions

Unable to run Intel version of python

momo_m_
Beginner
776 Views

I am trying to run the Intel distribution, but am unable to run it. Specifically, I tried to import sklearn and it fails

/home/ubuntu/$ echo ${PYTHONPATH} 
/opt/intel/python/2.7.20150803_184913/lib/python2.7/site-packages:/usr/local/lib/python2.7/dist-packages/
/home/ubuntu/$ /opt/intel/python/2.7.20150803_184913/bin/python
Python 2.7.10 (default, Aug  3 2015, 18:21:13) 
[GCC Intel(R) C++ gcc 4.8 mode] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sklearn
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/sklearn/__init__.py", line 57, in <module>
    from .base import clone
  File "/usr/local/lib/python2.7/dist-packages/sklearn/base.py", line 11, in <module>
    from .utils.fixes import signature
  File "/usr/local/lib/python2.7/dist-packages/sklearn/utils/__init__.py", line 10, in <module>
    from .murmurhash import murmurhash3_32
  File "numpy.pxd", line 155, in init sklearn.utils.murmurhash (sklearn/utils/murmurhash.c:5029)
ValueError: numpy.dtype has the wrong size, try recompiling

Can anyone please help ? I am assuming it would work with other packages and I am doing the right thing by setting the PYTHONPATH to pull in other packages. I really want to try it, so appreciate pointers.


 

 

 

 

 

 

0 Kudos
1 Reply
Ricardo_C_Intel
Employee
776 Views

Hello

I am not sure how did you install Scikit-learn, so I am going to assume you used pip (our tech preview does not come with scikit-learn, but our soon to be released 2017 beta version will include it). 

Before I continue, I noticed from your PATH that you are trying to use two Python distributions (the Intel and /usr/local/lib/python2.7/dist-packages/), and  when you try to import scikit-learn, it is trying to use the one in /usr/local/lib/python2.7/dist-packages. You have to install scikit-learn in the Intel Distribution for Python (see instructions below) and only have our distribution in you PATH. 

I am following the same procedure explained in the Release Notes. After installing Python at the same location you did (/opt/intel/python/2.7.20150803_184913), I proceeded to run the "pythonvars.csh" (or pythonvars.sh if you use bash) to setup my evironment variables (if you want to always have this Python in your PATH, add the content of pythonvars to you .tcshrc or .bashrc)

You should see the following in your PYTHONPATH and PATH:
lin02> echo $PYTHONPATH
/opt/intel/python/2.7.20150803_184913/

lin02> echo $PATH
/opt/intel/python/2.7.20150803_184913/bin:<ALL_YOUR_ALREADY_SETUP_PATH_VARIABLES>

Also, make sure you do not have other Python installation in your PATH. I noticed your PATH has a included a Python different to the Intel Python, and this might be causing problems (All you should have is the above python bin path)

if you have not installed scikit-learn yet, use pip install (our 2017 beta will have conda to manage packages as well)

sudo -E pip install -U scikit-learn

After it successfully installing the package (and having the correct PYTHONPATH + PATH environment), you should be able to import scikit-learn.

lin02> python
Python 2.7.10 (default, Aug 3 2015, 18:21:13)
[GCC Intel(R) C++ gcc 4.8 mode] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sklearn
>>> sklearn.__version__
'0.17.1'

Please let me know if this solves your problem.

Thanks.

0 Kudos
Reply