2

I'm trying to use Orange3 on my Mac, but I get this error: ImportError: cannot import name '_variable'.

This is my setup:

$ cd orange_playground
$ virtualenv -p python3 venv
$ pip install orange3
$ source venv/bin/activate
$ python

The output is as follows:

Python 3.4.2 (default, Oct  8 2014, 19:29:52)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.51)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import Orange
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "orange_playground/venv/lib/python3.4/site-packages/Orange/__init__.py", line 11, in <module>
    from .misc.lazy_module import _LazyModule
  File "orange_playground/venv/lib/python3.4/site-packages/Orange/misc/__init__.py", line 3, in <module>
    from .distmatrix import DistMatrix
  File "orange_playground/venv/lib/python3.4/site-packages/Orange/misc/distmatrix.py", line 3, in <module>
    from Orange.data import Table, StringVariable, Domain
  File "orange_playground/venv/lib/python3.4/site-packages/Orange/data/__init__.py", line 4, in <module>
    from .variable import *
  File "orange_playground/venv/lib/python3.4/site-packages/Orange/data/variable.py", line 11, in <module>
    from Orange.data import _variable
ImportError: cannot import name '_variable'

First lines of code from orange_playground/venv/lib/python3.4/site-packages/Orange/data/variable.py:

import collections
import re

from datetime import datetime, timedelta, timezone
from numbers import Number, Real, Integral
from math import isnan, floor
from pickle import PickleError

import numpy as np

from Orange.data import _variable
from Orange.util import Registry, color_to_hex, hex_to_color

__all__ = ["Unknown", "MISSING_VALUES", "make_variable", "is_discrete_values",
           "Value", "Variable", "ContinuousVariable", "DiscreteVariable",
           "StringVariable", "TimeVariable"]


# For storing unknowns
Unknown = ValueUnknown = float("nan")
# For checking for unknowns
MISSING_VALUES = {np.nan, "?", "nan", ".", "", "NA", "~", None}

...

Any ideas what to do?

ddofborg
  • 2,028
  • 5
  • 21
  • 34
  • `_variable` is meant to be a [compiled module](https://github.com/biolab/orange3/blob/master/Orange/data/_variable.pyx). How did you install this? – Martijn Pieters Dec 28 '16 at 21:38
  • `pip install orange3` on a Mac in a `venv`. – ddofborg Dec 28 '16 at 21:41
  • Was there any error output? Do you have [`cython` installed](http://cython.readthedocs.io/en/latest/src/quickstart/install.html)? Do you have XCode installed ([check if the command line tools are installed](http://stackoverflow.com/questions/15371925/how-to-check-if-command-line-tools-is-installed))? – Martijn Pieters Dec 28 '16 at 21:42
  • 3
    ah, there are a few more requirements, see the [orange3 wiki](https://github.com/biolab/orange3/wiki/Installation-on-OSX-Yosemite). – Martijn Pieters Dec 28 '16 at 21:46
  • @MartijnPieters that works. Thanks!!! – ddofborg Dec 28 '16 at 22:46

1 Answers1

1

Installing Orange3 from source like @MartijnPieters suggested works! Thanks.

Community
  • 1
  • 1
ddofborg
  • 2,028
  • 5
  • 21
  • 34