Importing Orange returns ImportError: no module named orange
The semantics for importing Orange have changed around version 2.5. If using code written with a previous version, some changes must be made, see http://orange.biolab.si/blog/2011/12/20/orange-25-code-conversion/. Critically, one needs to replace:
import orange
with:
import Orange
(note the capital letter O in the second example).
A side effect is that other sub-modules no longer need to be explicitly imported; a single
import Orange
is enough, instead of e.g.
import orange, orngTest, orngStat, orngTree
Importing Orange gives me this error message: ImportError: No module named Orange
Module name is orange with a little o.
Python is case sensitive so Orange != orange (as are most other programming languages).
RTM http://orange.biolab.si/doc/ofb/start.htm
:)
import orange
name from Orange is not defined
I'm not sure what the guy in the blog post is doing, or maybe there are some other steps that he explained in previous blog posts, but this code 'as is' is not going to work.
I searched the source code for Orange, and DiscreteVariable
isn't mentioned anywhere, not as class, not as regular word, nothing.
What I did find however is
Discrete = core.EnumVariable
in Orange/feature/__init__.py
. As you can see this points to core.EnumVariable, which appears, looking at it's usage
:
orange.EnumVariable('color', values = ["green", "red"])\
to be the same as DiscreteVariable
in your link.
So I suggest you use from Orange.feature import Discrete
instead and use that.
Related Topics
What Does the _File_ Variable Mean/Do
What Should I Do with "Unexpected Indent" in Python
Fast Punctuation Removal with Pandas
Replacing Instances of a Character in a String
Why Can't I Use a List as a Dict Key in Python
Convert Pyspark String to Date Format
Formatting Floats Without Trailing Zeros
How to Redirect Output with Subprocess in Python
Getting Python Error "From: Can't Read /Var/Mail/Bio"
How to Determine a Python Variable's Type
How to Get the Ascii Value of a Character
Create an Empty List with Certain Size in Python
What Are the Differences Between Numpy Arrays and Matrices? Which One Should I Use
Keras, How to Get the Output of Each Layer
How to Filter Foreignkey Choices in a Django Modelform
What's the Best Way to Parse a JSON Response from the Requests Library
Read Specific Columns from a CSV File with CSV Module
What's the Difference Between Globals(), Locals(), and Vars()