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.
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.
where do i find the solution to this ?
is in the missing dependencies or in the script?
Traceback (most recent call last):
File "2.py", line 14, in <module>
from pycall.callfile import *
File "/usr/lib/python2.6/site-packages/pycall-2.3.0-py2.6.egg/pycall/__init__.py", line 8, in <module>
from .callfile import CallFile
File "/usr/lib/python2.6/site-packages/pycall-2.3.0-py2.6.egg/pycall/callfile.py", line 11, in <module>
from path import path
ImportError: cannot import name path
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.
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
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