Page 1 of 1

Live Python3

Posted: Tue Jun 11, 2019 12:18 pm
by neux
Custom Python version embedded in Live is really old. Would be great to take advantage of new 3.2+ GIL capabilities described here. https://www.dabeaz.com/python/UnderstandingGIL.pdf

What is the progress of work to migrate to 3.2+

Re: Live Python3

Posted: Tue Jun 11, 2019 12:27 pm
by S4racen
You won't get an answer to that here,....

Cheers
D

Re: Live Python3

Posted: Tue Jun 11, 2019 1:11 pm
by neux
Can you elaborate as to what would be a correct entry point into such discussion? Are we on our own, lurking around in siloed dark shadows of the LinkedIn chats? BTW: Hi Daniel.

PeterS

Re: Live Python3

Posted: Tue Jun 11, 2019 4:38 pm
by S4racen
Probably the Centrecode beta forum....

BTW it's Darren ;-)

Cheers
D

Re: Live Python3

Posted: Thu Jun 13, 2019 8:46 pm
by Airyck
S4racen wrote:
Tue Jun 11, 2019 12:27 pm
You won't get an answer to that here,....

Cheers
D
Shouldn’t the feature wishlist forum be deleted then?

Re: Live Python3

Posted: Thu Jun 13, 2019 9:24 pm
by Angstrom
Airyck wrote:
Thu Jun 13, 2019 8:46 pm
S4racen wrote:
Tue Jun 11, 2019 12:27 pm
You won't get an answer to that here,....

Cheers
D
Shouldn’t the feature wishlist forum be deleted then?
Think of it like an old wishing well.

It's been at the heart of a village for over 200 years and holds sentimental value for a few old men. It's soon to concreted over to form part of "the dream factory" a 24 storey megamall.

Re: Live Python3

Posted: Fri Jun 14, 2019 4:15 am
by Airyck
Angstrom wrote:
Thu Jun 13, 2019 9:24 pm
Airyck wrote:
Thu Jun 13, 2019 8:46 pm
S4racen wrote:
Tue Jun 11, 2019 12:27 pm
You won't get an answer to that here,....

Cheers
D
Shouldn’t the feature wishlist forum be deleted then?
Think of it like an old wishing well.

It's been at the heart of a village for over 200 years and holds sentimental value for a few old men. It's soon to concreted over to form part of "the dream factory" a 24 storey megamall.
Hopefully the megamall will have a reptile store?

Re: Live Python3

Posted: Mon Jun 17, 2019 11:25 am
by neux
Maybe being more specific will help:

I have issues importing ctypes. Can anyone confirm they were able to do this? I was able to append paths before import so any other components required I can most likely work out. So far had a hell of a time trying to figure out threading, seems to be blocking (probably in defense of main live thread). Forking works, but what's the point, multiprocessing is fine but that's also a fork in a way, threading on another hand is slooooow for any new threads. It seems there is something "special" in a way live_python is allowing the threading to be spun up behind the scenes.

I'm currently using Live 10.1 (14th of May) which under hood has the following

Code: Select all


== sys.path
[
    '/Dropbox/Code/isobar/isobar', 
    '/Applications/Ableton Live 10 Suite.app/Contents/App-Resources/Python/lib', 
    '/Applications/Ableton Live 10 Suite.app/Contents/App-Resources/Python/site-packages/raven-5.8.1-py2.7.egg', 
    '/Applications/Ableton Live 10 Suite.app/Contents/App-Resources/Python/site-packages/setuptools-28.7.1-py2.7.egg', 
    '/Applications/Ableton Live 10 Suite.app/Contents/App-Resources/Python/site-packages/decorator-3.3.2-py2.5.egg', 
    '/Applications/Ableton Live 10 Suite.app/Contents/App-Resources/Python/site-packages/python', 
    '/Applications/Ableton Live 10 Suite.app/Contents/App-Resources/Python/site-packages/abl.util-0.1.16-py2.7.egg', 
    '/Applications/Ableton Live 10 Suite.app/Contents/App-Resources/Python/site-packages/abl.vpath-0.8.2-py2.7.egg', 
    '/Applications/Ableton Live 10 Suite.app/Contents/App-Resources/Python/site-packages/multipledispatch-0.4.8-py2.7.egg', 
    '/Applications/Ableton Live 10 Suite.app/Contents/App-Resources/Python/site-packages/pkg_resources', 
    '/Applications/Ableton Live 10 Suite.app/Contents/App-Resources/Python/abl.live', 
    '/Applications/Ableton Live 10 Suite.app/Contents/App-Resources/MIDI Remote Scripts/', 
    '/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5'
    ]

== sys.builtin_module_names
('__builtin__', '__main__', '_ast', '_bisect', '_codecs', '_collections', '_csv', '_functools', '_heapq', '_hotshot', 
'_io', '_json', '_locale', '_lsprof', '_md5', '_multibytecodec', '_random', '_scproxy', '_sha', '_sha256', '_sha512', 
'_socket', '_sqlite3', '_sre', '_ssl', '_struct', '_symtable', '_warnings', '_weakref', 'array', 'binascii', 'cPickle', 
'cStringIO', 'cmath', 'datetime', 'dl', 'errno', 'exceptions', 'fcntl', 'future_builtins', 'gc', 'grp', 'imp', 'itertools', 
'marshal', 'math', 'mmap', 'operator', 'parser', 'posix', 'pwd', 'pyexpat', 'resource', 'select', 'signal', 'strop', 
'sys', 'syslog', 'termios', 'thread', 'time', 'timing', 'unicodedata', 'xxsubtype', 'zipimport', 'zlib')

== platform.sys.version
2.7.12 (default, Mar 20 2019, 10:36:06) [GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.31)]

== sys.executable (show me python executable, obviously embedded)
/Applications/Ableton Live 10 Suite.app/Contents/MacOS/Live
so now having this out of the way back to ctypes

Code: Select all

2019-06-17T12:23:38.258958: info: RemoteScriptError: Traceback (most recent call last):

2019-06-17T12:23:38.258994: info: RemoteScriptError:   File "<string>", line 1, in <module>

2019-06-17T12:23:38.259140: info: RemoteScriptError:   File "/Applications/Ableton Live 10 Suite.app/Contents/App-Resources/MIDI Remote Scripts/LiveQL/__init__.py", line 1, in <module>

2019-06-17T12:23:38.259226: info: RemoteScriptError:
2019-06-17T12:23:38.259246: info: RemoteScriptError: from liveql import LiveQL

2019-06-17T12:23:38.259268: info: RemoteScriptError:   File "/Applications/Ableton Live 10 Suite.app/Contents/App-Resources/MIDI Remote Scripts/LiveQL/liveql.py", line 2, in <module>

2019-06-17T12:23:38.259315: info: RemoteScriptError:
2019-06-17T12:23:38.259332: info: RemoteScriptError: import ctypes

2019-06-17T12:23:38.259355: info: RemoteScriptError:   File "/Applications/Ableton Live 10 Suite.app/Contents/App-Resources/Python/lib/ctypes/__init__.py", line 7, in <module>

2019-06-17T12:23:38.259393: info: RemoteScriptError:
2019-06-17T12:23:38.259410: info: RemoteScriptError: from _ctypes import Union, Structure, Array
2019-06-17T12:23:38.259440: info: RemoteScriptError: ImportError
2019-06-17T12:23:38.259457: info: RemoteScriptError: :
2019-06-17T12:23:38.259479: info: RemoteScriptError: No module named _ctypes
2019-06-17T12:23:38.259494: info: RemoteScriptError:
Just an FYI, ctypes is importing fine outside of Live, tried adding lib paths to matched moduels inside main ableton structure and outside. If I could only get interpreter console maybe I would figure this out, but having to rely and starting/stoping ableton each time is killing me. Anyone worked with this here? Help!

Re: Live Python3

Posted: Mon Jun 17, 2019 12:49 pm
by S4racen
https://twitter.com/AbletonDev

Is possibly your best bet to reach out to...

Cheers
D

Re: Live Python3

Posted: Mon Jun 17, 2019 8:44 pm
by neux
Thank you D, I will try that now.

Re: Live Python3

Posted: Mon Sep 02, 2019 6:26 pm
by justinancheta
@neux I was playing around with this, too. I noticed that it doesn't barf when I import the `threading` module.

For instance I think I can do something like:

Code: Select all

import threading
...
    thread = threading.Thread(target=self.request_x32_to_send_change_notifications)
    thread.start()
...
However, later on in the code I'm trying to use an OSCServer from a newer version of OSC.py (pyosc module) than LiveOSC v1 or v2 use. It kills Live when I try to execute server.serve_forever(). So close, yet so far.

I just thought it was interesting that `threading` wasn't in your list of available modules. `thread` is, but I believe `threading` is a higher-level abstraction that builds off of the lower-level `thread` module. I'm surprised that I can import it at all, really.

Re: Live Python3

Posted: Mon Sep 30, 2019 7:04 pm
by neux
@justinancheta i tried both. same thing. Flask works but it takes 120 on average to execute single call. I don't care much for OSC, I just wish there was a way to interact with Live without having to deal with Ableton blocking python abilities on purpose. Tried RESTful Flask (all sorts of threading and forking), I tried queueing. Next in line is either loading/saving calls through a filesystem or maybe pickeled instances. Seems like hell of a workaround to sneak in some call data into Live-python. I understand Ableton wants to protect the runtime but if I want to break it i should be able to. My workflow is not based on live playback. I started collecting my work into a tool called 4bars https://github.com/styk-tv/4bars and also there is about 12 people now on live Slack channel related to python Live/Ableton coding https://musicascode.com/ to get instant invite.

Let me know if you get any further. I'm interested as well. For now OSC is best suited to do outside interfacing through the asynchronous socket they mount.

Peter