Importing Orange Returns "Importerror: No Module Named Orange"

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



Leave a reply



Submit