Install scikit-learn, numpy import error - python

I am trying to test scikit-learn library, but didn't manage to install it.
More details : I did install numpy, scipy, matplotlib and I can use them just fine. However, when I use pip (pip install -U scikit-learn), I get this error :
Partial import of sklearn during the build process.
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\...\scikit-learn\setup.py", setup_package()
File "C:\Users\...\scikit-learn\setup.py", from numpy.distutils.core import setup
ImportError: No module named 'numpy'
I couldn't find anything about this.
I tried installing scikit-learn directly by using python setup.py and had the same problem. Any ideas?
Thanks you.

I think there are something wrong with the installation of numpy.
Try download and reinstall following package (for Python 2.7):
http://downloads.sourceforge.net/project/numpy/NumPy/1.9.2/numpy-1.9.2-win32-superpack-python2.7.exe?r=&ts=1442420256&use_mirror=netix

Related

Unable to import python modules from a python file in google collab

!python3.6 abc.py
I am trying to execute the above line of code in google collab.
abc.py contains modules imported like NumPy, sklearn. Recently, I am getting this error in collab :
Traceback (most recent call last):
File "abc.py", line 1, in <module>
import numpy as np
ModuleNotFoundError: No module named 'numpy'
This error had never occurred on my previous usages of this code. Please help.
install the packages listed in your file using
pip install <package_name>
safe to install them in virtual environment.
Make sure you have activated virtual environment if you are using one already.
you can use conda install numpy

installing scipy package in windows

I want to install scipy packages and I know it's a repetitive question, but I have tried all of them but I didn't find a proper solution.
when write this : import scipy
it executes successfully. but when I try this:
import scipy.spatial
I receive this message:
Traceback (most recent call last):
File "C:/Users/Hamid/Documents/kodeyaro/kodefolani.py", line 41, in <module>
from scipy.spatial import Delaunay
File "C:\Python27\lib\site-packages\scipy\spatial\__init__.py", line 92, in module>
from .qhull import *
ImportError: DLL load failed: The specified module could not be found.
what should I do?
below re-installation will fix the issue as required dll will be placed at right place.
user should have admin permissions on the system.
python -m pip install scipy --upgrade --force
I faced this problem when I switched to python38. Build was failing while scipy installation.
I solved by using prebuilt libs from Prof: Gohlke
https://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy
Install appropriate numpy+mkl version using --force argument
pip install numpy-1.17.3+mkl-cp38-cp38-win_amd64.whl --force
Run this in the cmd:
pip install scipy
It is advisable to run cmd as Adminstrator.

PYTHON: Error in recognising numpy module

I am using Python 3.4.0. I am going to assume that the numpy module should work, as this is one of the newer versions of python. However, anything I do with numpy will result in a syntax error. Forexample this code here:
import numpy
list1=[1,3,2,6,9]
list2=numpy.mean(list1)
print(list2)
And then I get:
Traceback (most recent call last):
File "/home/yichen/Desktop/python/numpy test.py", line 1, in <module>
import numpy
ImportError: No module named 'numpy'
Is this just a problem with my computer or what?
It looks like numpy is not installed on your system. Assuming that you have the pip script installed with your python, you can perform following command to install it:
pip install numpy
or
pip3.4 install numpy
Or, depending on your distribution, it might come as a package named like python-numpy with your package manager.

I'm having troubles getting pybrain working through anaconda

Here is my problem:
After I managed to install anaconda (having python 3.4), I apparently managed to install pybrain too. But when i use 'import pybrain' from anaconda or from the terminal too I get this error:
>>> import pybrain
Traceback (most recent call last):
File "<ipython-input-2-0fb7233d2a8c>", line 1, in <module>
import pybrain
File "//anaconda/lib/python3.4/site-packages/PyBrain-0.3-py3.4.egg/pybrain/__init__.py", line 1, in <module>
from structure.__init__ import *
ImportError: No module named 'structure'
Simply running sudo pip3 install git+https://github.com/pybrain/pybrain.git worked for me after having the same issue.
The version up on PyPi isn't Python 3 compatible.
Installing the latest commit directly using pip3 should take care of your old package (from PyPi) as well.

scikits.audiolab doen't import into python (numpy.dtype)

I have installed (with lots of troubles) scikits.audiolab for making sounds out of data. Now when I type:
import scikits.audiolab I get the following error
>>> import scikits.audiolab
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.7/site-packages/scikits.audiolab-0.11.0-py2.7-macosx-10.7-intel.egg/scikits/audiolab/__init__.py", line 25, in <module>
from pysndfile import formatinfo, sndfile
File "/Library/Python/2.7/site-packages/scikits.audiolab-0.11.0-py2.7-macosx-10.7-intel.egg/scikits/audiolab/pysndfile/__init__.py", line 1, in <module>
from _sndfile import Sndfile, Format, available_file_formats, \
File "numpy.pxd", line 30, in scikits.audiolab.pysndfile._sndfile (/private/tmp/easy_install-gKE3i5/scikits.audiolab-0.11.0/scikits/audiolab/pysndfile/_sndfile.c:9632)
ValueError: numpy.dtype does not appear to be the correct type object
How do I fix this?
Any alternative package that can do the job?
I had the same issue and for me it was caused by installing another (more recent) version of NumPy.
Check if you have different versions of NumPy installed and try switching back to an older one. For my part: I had a system-wide installation of Python and common modules like NumPy, which I couldn't touch because I'm not admin on that system. So when I installed some other library locally (in ~/.local/lib/python2.7/) it would also install more recent versions of SciPy and NumPy and put them into that local folder. And when importing the module it would draw from the local directory first before looking at the system-wide libraries which were working fine before with scikits.audiolab. So for me it was solved by
pip uninstall numy && pip uninstall scipy because that only deleted the newer local versions of numpy.
But more specific to your case, here is a tutorial how (on a Mac) to switch to a certain version of NumPy:
multiple numpy version on Mac OS X
The NumPy version I found working for my scikits.audiolab is 1.6.1
>>> import numpy
>>> numpy.version.version
'1.6.1'
Hope that helps. :)
Maybe you installed/upgraded numpy after installing talkbox. Try running this command:
pip install --upgrade --force-reinstall scikits.talkbox
As suggested here:
https://github.com/ppwwyyxx/speaker-recognition/issues/13

Categories

Resources