VPython installation error on Windows - python-2.7

>>> 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?

Related

Cannot import _uuid_generate_random when trying to import carrot.connection

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.

sklearn 0.17.1: ImportError: cannot import name inplace_column_scale

My sklearn works well before, after installing and updating a couple of other packages, I cannot import any model from sklearn.
The versions:
Python 2.7.12
Anaconda 2.4.1 (x86_64)
sklearn: 0.17.1 (downgrade from 0.18)
spicy: 0.18.1
Measures I've tried:
restart the shell---> same error
uninstall sklearn, and reinstall it (the newest version is 0.18), downgrade it to 0.17--> same error
install sklearn and keep the version 0.18 -->still error
My code:
from sklearn import svm
The error
Traceback (most recent call last):
File "<ipython-input-1-fe795c4388c4>", line 3, in <module>
from sklearn import svm
File "//anaconda/lib/python2.7/site-packages/sklearn/svm/__init__.py", line 13, in <module>
from .classes import SVC, NuSVC, SVR, NuSVR, OneClassSVM, LinearSVC, \
File "//anaconda/lib/python2.7/site-packages/sklearn/svm/classes.py", line 4, in <module>
from .base import _fit_liblinear, BaseSVC, BaseLibSVM
File "//anaconda/lib/python2.7/site-packages/sklearn/svm/base.py", line 11, in <module>
from ..preprocessing import LabelEncoder
File "//anaconda/lib/python2.7/site-packages/sklearn/preprocessing/__init__.py", line 8, in <module>
from .data import Binarizer
File "//anaconda/lib/python2.7/site-packages/sklearn/preprocessing/data.py", line 25, in <module>
from ..utils.sparsefuncs import (inplace_column_scale,
ImportError: cannot import name inplace_column_scale
Besides svm, when I import tree, linear_model, the same thing happens.
from sklearn.models import linear_model
The error:
Traceback (most recent call last):
File "<ipython-input-3-540f6792b379>", line 1, in <module>
from sklearn.models import linear_model
ImportError: No module named models
Code:
from sklearn import tree
error:
Traceback (most recent call last):
File "<ipython-input-4-fcc6e7d2ee3e>", line 1, in <module>
from sklearn import tree
File "//anaconda/lib/python2.7/site-packages/sklearn/tree/__init__.py", line 6, in <module>
from .tree import DecisionTreeClassifier
File "//anaconda/lib/python2.7/site-packages/sklearn/tree/tree.py", line 30, in <module>
from ..feature_selection.from_model import _LearntSelectorMixin
File "//anaconda/lib/python2.7/site-packages/sklearn/feature_selection/__init__.py", line 7, in <module>
from .univariate_selection import chi2
File "//anaconda/lib/python2.7/site-packages/sklearn/feature_selection/univariate_selection.py", line 15, in <module>
from ..preprocessing import LabelBinarizer
File "//anaconda/lib/python2.7/site-packages/sklearn/preprocessing/__init__.py", line 8, in <module>
from .data import Binarizer
File "//anaconda/lib/python2.7/site-packages/sklearn/preprocessing/data.py", line 25, in <module>
from ..utils.sparsefuncs import (inplace_column_scale,
ImportError: cannot import name inplace_column_scale
To solve the error:
ImportError: cannot import name 'OrdinalEnconder' from 'sklearn.preprocessing'
(C:\ProgramData\Anaconda3\lib\site-packages\sklearn\preprocessing\__init__.py)
You need to go path "C:\ProgramData\Anaconda3\lib\site-packages\sklearn\preprocessing" and check the name of OneLabelEncoder in python file __init__.py . The name may be LabelEncoder or a different name. You need import the module with same name.
The following screenshot should help you understand this better:
Try this within your terminal:
conda install -c anaconda scikit-learn=0.18.1
If it does not work go to your terminal and try:
conda update anaconda
After the update is complete, then try the first bit of code again
Hopefully it works
please see this question.
ImportError: cannot import name inplace_column_scale.
I think you face the same problem. There are several ways to solve it.
For windows. delete python27\Lib\site-packages\sklearn\utils\sparsefuncs.pyd.
For mac and linux, delete /usr/local/lib/python2.7/site-packages/sklearn/utils/sparsefuncs.so.
If you use anaconda, delete anaconda/lib/python2.7/site-packages/sklearn/utils/sparsefun‌​cs.so
reinstall the sklearn.
pip uninstall scikit-learn
pip install scikit-learn

cannot import pybrain module in python 2.7

I followed the exact documentation in here
but after that importing produces the following error. I am using windows 7 and python 2.7. I have already installed scipy and matplotlib.
The error that I get is as follows:
>>> import pybrain
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "pybrain\__init__.py", line 1, in <module>
from pybrain.structure.__init__ import *
File "pybrain\structure\__init__.py", line 2, in <module>
from pybrain.structure.modules.__init__ import *
File "pybrain\structure\modules\__init__.py", line 2, in <module>
from pybrain.structure.modules.gate import GateLayer, DoubleGateLayer, Multi
plicationLayer, SwitchLayer
File "pybrain\structure\modules\gate.py", line 10, in <module>
from pybrain.tools.functions import sigmoid, sigmoidPrime
File "pybrain\tools\functions.py", line 4, in <module>
from scipy.linalg import inv, det, svd, logm, expm2
File "C:\Python27\lib\site-packages\scipy\linalg\__init__.py", line 174, in <m
odule>
from .misc import *
File "C:\Python27\lib\site-packages\scipy\linalg\misc.py", line 5, in <module>
from .blas import get_blas_funcs
File "C:\Python27\lib\site-packages\scipy\linalg\blas.py", line 155, in <modul
e>
from scipy.linalg import _fblas
ImportError: DLL load failed: The specified module could not be found.
For scipy requires installing numpy+mkl. You can install this lib from http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy

error while executing scikit-learn program in windows

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

import numpy giving ImportError: DLL load failed: %1 is not a valid Win32 application

I am using python tools for visual studio express 2013. I am not able to import numpy in it. Could successfully import other modules like re and math
import numpy gives following error:
Traceback (most recent call last):
File "`<stdin>`", line 1, in `<module>`
File "C:\Python27\lib\site-packages\numpy\__init__.py", line 153, in <module>
from . import add_newdocs
File "C:\Python27\lib\site-packages\numpy\add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "C:\Python27\lib\site-packages\numpy\lib\__init__.py", line 8, in <module>
from .type_check import *
File "C:\Python27\lib\site-packages\numpy\lib\type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "C:\Python27\lib\site-packages\numpy\core\__init__.py", line 6, in <module>
from . import multiarray
ImportError: DLL load failed: %1 is not a valid Win32 application.
How can this be resolved?