I am trying to get started with machine learning, so I have installed the packages: numpy, Scikit-learn, matplotlib, scipy. Some I have installed directly from pip with:
python -m pip install "package name"
and and others i have downloaded the binary files and then installed with pip. It shows no errors when I import matplotlib, numpy and sklearn, but when I write:
from sklearn import svm
it gives me the error:
ImportError: cannot import name 'svm'
I am on Python 3.5.1 and on Windows 10. Does anyone have any solutions?
import sklearn.svm as svm
model = svm.SVC()
....
http://scikit-learn.org/stable/modules/classes.html#module-sklearn.svm
It does seem that you didn't install it properly. Since you're on windows I would recommend using the Unofficial Windows Binaries for Python Extension Packages website to install future packages.
Make sure you also install the proper binaries as I pointed out in this post Installing scipy in Python 3.5 on 32-bit Windows 7 Machine. The windows version doesn't matter just make sure you're downloading Visual C++ 2015 redistributable package.
Related
I wanted to test the Intel distribution of numpy (see https://software.intel.com/en-us/articles/installing-the-intel-distribution-for-python-and-intel-performance-libraries-with-pip-and).
I followed the simple installing procedure: pip install intel-numpy
The package was installed correctly. However, the simple "import numpy as np" raised the following error:
ImportError:
Importing the multiarray numpy extension module failed. Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try git clean -xdf (removes all
files not under version control). Otherwise reinstall numpy.
I am using Python 3.6.5 and my system is MacOs, but I got the very same error on Windows.
Does anyone know if Intel page is deprecated? Or if Intel packages are not compatible with Python 3.6.5?
PS: I know that Anaconda distribution install Intel distribution, by do I really need to use Anaconda?
I'm trying to install scipy 0.19 for python 3.6 windows 10 32 bit version. I tried the pip installation method but it doesn't work then i also downloaded the .whl file for scipy then also the program shows that "no module named scipy". How do I solve this problem?
It is showing numpy package installed
and when I am running a code having the numpy package imported, it's showing an error message
install numpy+mkl if you using python 3.5 64bit numpy-1.12.1+mkl-cp35-cp35m-win_amd64 if you using python 3.5 32 bit install numpy-1.11.3+mkl-cp35-cp35m-win32
from this link you can find bit http://www.lfd.uci.edu/~gohlke/pythonlibs/
I am trying to install the MayaVi package using pip, but I keep getting an error message saying (ImportError: No module named vtk). How do I fix this problem?
So on command prompt:
$pip install mayavi
output
File "Tvtk\code_gen.py", line 10, in
import vtk
ImportError: No module named vtk
This has actually gotten a lot easier with the new wheel format and installation.
Make sure your python setup is wheel compatible (e.g. upgrade pip and 'pip install wheel') - you may need to google around for how to do that for certain distributions like Canopy.
Then just grab either the VTK and MAYAVI wheels or the MAYAVI+VTK wheel from the inestimable http://www.lfd.uci.edu/~gohlke/pythonlibs/#vtk
Right now for example you might choose: mayavi‑4.4.0+vtk610‑cp27‑none‑win32.whl
(assuming 32 bit install of cpython 2.7, the filenames encode important stuff and there are many options)
Then run pip install mayavi‑4.4.0+vtk610‑cp27‑none‑win32.whl
I just had the occasion to do this on a laptop that I hadn't set up with Mayavi yet and it ran smooth as silk and installed everything I needed without complaint. That was several steps smoother than the last time I had to install Mayavi on a windows machine.
From my recent experience, one possible reason is that vtk for windows is not installed prior to using mayavi.
however you can't do pip install vtk.
you can get vtk from here
also, remember to configure VC Express 2008 and Windows 7 SDK + .NET 3.5 to avoid additional errors.
I installed sci-kit learn with the installer scikit-learn-0.13.1.win32-py2.7.exe but when I try to call it in Canopy and iPython I get the following error: "ImportError: No module named sklearn".
I tried the following solutions found online but non of them work
Running python setup.py install in the directory and got this error: "ImportError: no module named sklearn._build_utils"
Tried pip install - U scikit-learn but the download keeping on timing out
Tried easy_install - U scikit-learn but the download also kept on timing out
I'm wondering if it is because I am using Canopy (Free version) and I should maybe uninstall it and install all my packages again using vanilla Python.
Thanks.
Have you tried adding sklearn to your python path manually? Have a look at this thread, it might help!
How to add to the pythonpath in windows 7?