Orange Forum • View topic - How to use orange as a Python module under OS X?

How to use orange as a Python module under OS X?

A place to ask questions about methods in Orange and how they are used and other general support.

How to use orange as a Python module under OS X?

Postby cip22 » Mon Nov 08, 2004 16:33

I'm wondering how to use Orange as a 'python scripter' on OS X. Making the contents of the 'orange' folder inside the orange.app available to Python results in a 'bus error 669'. Putting the orange folder in Python's site-packages dir didn't work either. Am I missing something? Is Orange *only* available as the prebuilt .app for OS X?

As an aside, I can't seem to find the 'orange doc.dmg' that is mentioned in the 'Installation on OS X' anywhere on the web site.

Thanks for any insight,
best regards,
Christoph

Postby Guest » Wed Nov 10, 2004 9:10

ok, I built orange from the source files. There were some glitches with the gsl being in the wrong place (I use darwinports which puts everything under /opt/local instead of usr/local), but the the build process went smoothly.

However, when I try to import orange, Python quits with a 'Bus Error' message. Did anyone successfully build orange on OS X and use it from Python?

Re: How to use orange as a Python module under OS X?

Postby tomaz » Wed Nov 17, 2004 20:50

Christoph:

for now, we deploy Orange on OS X as a .app only, but plan to make a "distutils" distribution of Orange that will work on Mac OS X and Linux.

* I really don't see why you should not be able to import Orange. Which version of Python and OS X are you using? Bear in mind that Orange.app uses Python 2.3 compiled by Apple Computer.

I have tested it with two version of Python (on OS X 10.3.6 and 10.2.8), and it works with both:
Python 2.3 (#1, Sep 13 2003, 00:49:11)
[GCC 3.3 20030304 (Apple Computer, Inc. build 1495)] on darwin
and
Python 2.3.3 (#2, Dec 23 2003, 22:56:29)
[GCC 3.1 20020420 (prerelease)] on darwin


* To make it work from site-packages to be used in command-line scripts, you have to copy Orange from the application folder into python's site-packages and create a orange.pth file (with text "orange") in site-packages. Something along these two command lines:

cp -R ~/Desktop/Orange.app/Contents/Resources/orange /System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/

echo orange > /System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/orange.pth

* "orange doc.dmg" is no longer available, but you can get the latest documentation from the download page.

Guest:
I ask you the same question, which version of Python and OS X are you using?

-Tomaz

Postby Guest » Mon Nov 22, 2004 14:04

Tomaz,

'Guest' and 'cip22' are actually the same person, that is me. :-)

I'm using Mac OS X 10.3.6 and Python 2.3. I have no idea what is going wrong.

Actually, there is another version of Python on my machine, that is found under /opt/local/bin/Python2.3 (it's from darwinports).

I couldn't import orange in neither version of Python. Seems that something's wrong with my machine, in some lib perhaps, I don't know. I'll have to track this down by myself.

best regards,
Christoph

Postby Guest » Mon Nov 22, 2004 14:08

Tomaz,

'Guest' and 'cip22' are actually the same person, that is me. :-)

I'm using Mac OS X 10.3.6 and Python 2.3. I have no idea what is going wrong.

Actually, there is another version of Python on my machine, that is found under /opt/local/bin/Python2.3 (it's from darwinports).

I couldn't import orange in neither version of Python. Seems that something's wrong with my machine, in some lib perhaps, I don't know. I'll have to track this down by myself.

best regards,
Christoph

Postby Guest » Tue Nov 23, 2004 1:06

If anybody has an idea what is going wrong here, I'd be grateful to know.

From console:
Nov 22 18:05:03 localhost crashdump: Unable to determine CPSProcessSerNum pid: 1230 name: python

From python.crash.log:

Command: python
Path: /usr/bin/python
Version: ??? (???)
PID: 1230
Thread: 0

Exception: EXC_BAD_ACCESS (0x0001)
Codes: KERN_PROTECTION_FAILURE (0x0002) at 0x00000004

Thread 0 Crashed:
0 org.python.python 0x10094c4c PyErr_NewException + 0x18c (errors.c:544)
1 orange.so 0x020223b8 makeExceptionClass(char*, char*, _object*) + 0x94
2 orange.so 0x021c8c74 initorange + 0x30
3 org.python.Python.framework 0x95fc1bc4 _PyImport_LoadDynamicModule + 0xcc
4 org.python.Python.framework 0x95fbf7a4 PyImport_ExecCodeModuleEx + 0x17b8
5 org.python.Python.framework 0x95fc08c4 PyImport_ImportModuleEx + 0x930
6 org.python.Python.framework 0x95fc02e0 PyImport_ImportModuleEx + 0x34c
7 org.python.Python.framework 0x95fbfe00 PyImport_ImportModule + 0xc8
8 org.python.Python.framework 0x95fbffd4 PyImport_ImportModuleEx + 0x40
9 org.python.Python.framework 0x95f9cbf0 _PyUnicodeUCS2_IsAlpha + 0x90
10 org.python.Python.framework 0x95f4a8d0 PyObject_Call + 0x30
11 org.python.Python.framework 0x95fa91ec PyEval_CallObjectWithKeywords + 0x100
12 org.python.Python.framework 0x95fa6984 PyEval_EvalCode + 0x2280
13 org.python.Python.framework 0x95fa7e30 PyEval_EvalCodeEx + 0x850
14 org.python.Python.framework 0x95fa4734 PyEval_EvalCode + 0x30
15 org.python.Python.framework 0x95fc85f0 PyRun_FileExFlags + 0xe4
16 org.python.Python.framework 0x95fc7354 PyRun_InteractiveOneFlags + 0x1f0
17 org.python.Python.framework 0x95fc713c PyRun_InteractiveLoopFlags + 0x10c
18 org.python.Python.framework 0x95fc6fd4 PyRun_AnyFileExFlags + 0x54
19 org.python.Python.framework 0x95fd1ec0 Py_Main + 0x7cc
20 python 0x00003c78 start + 0x1bc
21 python 0x00003aec start + 0x30

I guess something is broken in my system. But I don't know what... :-(

Thanks for any input.
best regards,
Christoph

building Orange

Postby johnlichtenstein » Wed Dec 29, 2004 17:12

Anonymous wrote:ok, I built orange from the source files. There were some glitches with the gsl being in the wrong place (I use darwinports which puts everything under /opt/local instead of usr/local), but the the build process went smoothly.

However, when I try to import orange, Python quits with a 'Bus Error' message.


Hi Cip22. I also use darwinports and Python 2.4. I have not been able to build Orange. I changed the make file to point towards /opt/local, but make complains it can't find gsl/gal_matrix.h. That header file is certainly in /opt/local/include/gsl/.

Can I ask how you built gsl? Did you use the --disable-shared flag?

Postby Mitar » Mon Apr 23, 2007 9:45

I have just made a Mac OS X bundle with the freshest Orange. You can find it under snapshots on Download page.

Please report any problems.

Postby Guest » Tue Sep 25, 2007 19:34

I'm getting the same bus error and it's now 2007. Wow.

Postby Janez » Tue Sep 25, 2007 19:50

Wow?!

Postby Mitar » Tue Sep 25, 2007 21:48

Which version of Mac OS X do you have? Orange is not supported on 10.3 and prior versions anymore.

Same problem.

Postby Guillermo » Sat Apr 19, 2008 21:23

Hi, I'm on a Ibook with Mac OS X 10.4.11, python 2.5, and having exactly the same problem: when I import orange, python quits with a "Bus error". And now it's 2008 !!!

Postby Mitar » Sat Apr 19, 2008 23:11

Strange. Which version of Orange do you use? Mac OS X snapshot?

Step-by-step instructions?

Postby alexbw » Fri Apr 25, 2008 2:06

I have not been able to find step-by-step instructions for building Orange for only Python scripting use.

The differentiation between the GUI toolkit and the Python tools only recently became clear to me, and I'm unclear as to how to build the Orange tools for only Python on OS X 10.5.

Could someone please help with some instructions or point me to a helpful link?

Thank you very much!

Using Python command line against the snapshot?

Postby dibau » Fri May 02, 2008 11:12

Can you post instructions for OS X (>=10.4)?

I can see the snapshot arrives with Python, but can't find any instructions for making it available in command line. What should be copied? Do I need to change any other settings to be able to import orange?


Thanks in advance!

Next

Return to Questions & Support