When I execute the following code :
from nltk.classify.scikitlearn import SklearnClassifier
sklearn.naive_bayes import MultinomialNB,BernoulliNB
I am getting an error as follows:
Traceback (most recent call last):
File "C:\Python27\uni.py", line 2, in <module>
from sklearn.naive_bayes import MultinomialNB,BernoulliNB
File "C:\Python27\lib\site-packages\sklearn\__init__.py", line 56, in <module>
from . import __check_build
ImportError: cannot import name __check_build
I am new to Python please help me out on how to resolve it
Related
I have a requirement of using the carrot python library. This is the code code.
from carrot.connection import BrokerConnection
from carrot.messaging import Consumer
Both the lines are throwing an ImportError exception.
The exception traceback is..
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/.virtualenvs/stack/lib/python2.7/site-packages/carrot/connection.py", line 14, in <module>
from carrot.backends import get_backend_cls
File "/.virtualenvs/stack/lib/python2.7/site packages/carrot/backends/__init__.py", line 8, in <module>
from carrot.utils import rpartition
File "/.virtualenvs/stack/lib/python2.7/site-packages/carrot/utils.py", line 1, in <module>
from uuid import UUID, uuid4, _uuid_generate_random
ImportError: cannot import name _uuid_generate_random
Im running this on Python 2.7.13 with the latest version of carrot and uuid. I have also tried upgrading uuid.
I installed georasters using "pip install georasters".But I am unable to import it in python.The following error comes:
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import georasters
File "D:\Python\lib\site-packages\georasters\__init__.py", line 3, in <module>
from .georasters import get_geo_info, map_pixel, map_pixel_inv, aggregate, create_geotiff, align_rasters, \
File "D:\Python\lib\site-packages\georasters\georasters.py", line 37, in <module>
import pandas as pd
File "D:\Python\lib\site-packages\pandas\__init__.py", line 25, in <module>
from pandas import hashtable, tslib, lib
File "pandas\src\numpy.pxd", line 157, in init pandas.hashtable (pandas\hashtable.c:38509)
ValueError: numpy.dtype has the wrong size, try recompiling
Kindly clarify.
>>> import visual
RuntimeError: module compiled against API version 9 but this version of numpy is 7
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import visual
File "C:\Python27\lib\site-packages\visual\__init__.py", line 3, in <module>
from visual.visual_all import * # this statement not included in vis/__init__.py
File "C:\Python27\lib\site-packages\visual\visual_all.py", line 10, in <module>
from visual_common.cvisual import vector
ImportError: numpy.core.multiarray failed to import
I got this error when i tried to import visual on 2.7.9 Whats wrong?
I am getting below error when trying to import the urllib2:
>>> import urllib2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib64/python2.7/urllib2.py", line 94, in <module>
import httplib
File "/usr/lib64/python2.7/httplib.py", line 69, in <module>
from array import array
ImportError: cannot import name array`
Any thoughts on it?
It seems you have a python program named "array.py" in you present working directory. If yes rename that python program or move it to some other directory.
I trying to use svm through scikit-learnkit for python. But I am continually getting following errors.
> from sklearn import svm
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib64/python2.7/site-packages/sklearn/svm/__init__.py", line 13, in
<module>
from .classes import SVC, NuSVC, SVR, NuSVR, OneClassSVM, LinearSVC
File "/usr/local/lib64/python2.7/site-packages/sklearn/svm/classes.py", line 1, in <module>
from .base import BaseLibLinear, BaseSVC, BaseLibSVM
File "/usr/local/lib64/python2.7/site-packages/sklearn/svm/base.py", line 6, in <module>
from . import libsvm, liblinear
ImportError: cannot import name libsvm
I have checked /usr/local/lib64/python2.7/site-packages/sklearn/svm/libsvm.so is present