MLT bindings fail to import

Asked by Dave Phillips

When I try to start OpenShot I receive the following errors:

dlphilp@The3800:~$ openshot
Added /usr/share/openshot to system path
--------------------------------
   OpenShot (version 0.9.52)
--------------------------------
*** ERROR: MLT Python bindings failed to import ***
*** ERROR: MLT Python bindings failed to import ***
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python2.6/threading.py", line 525, in __bootstrap_inner
    self.run()
  File "/usr/share/openshot/classes/thumbnail.py", line 174, in run
    mlt.Factory().init()
NameError: global name 'mlt' is not defined

-------------------------------------------------------
Error: OpenShot has not been installed in the Python path.
(Both the site-packages and /usr/share/openshot folders were checked)

Use the following command to install OpenShot:
  $ sudo python setup.py install

However, I have followed the installation instructions a number of times, always resulting in the same error. System is Ubuntu Jaunty, MLT is 0.7.7 (built locally), Python is 2.6 and correctly installed. Kdenlive works perfectly with my build of MLT, btw.

I'd like to review OpenShot for the Linux Journal. I have to get it running first, so any help would be appreciated.

Dave Phillips

http://linux-sound.org

Question information

Language:
English Edit question
Status:
Solved
For:
OpenShot Video Editor Edit question
Assignee:
No assignee Edit question
Solved by:
Dave Phillips
Solved:
Last query:
Last reply:
Revision history for this message
Jonathan Thomas (jonoomph) said :
#1

What OS and version do you use? What architecture (32bit or 64bit)? I
would be sure all the dependencies are installed correctly.

Thanks,
-Jonathan

On Sat, Oct 31, 2009 at 4:38 AM, Dave Phillips <
<email address hidden>> wrote:

> New question #87661 on OpenShot Video Editor:
> https://answers.launchpad.net/openshot/+question/87661
>
> When I try to start OpenShot I receive the following errors:
>
> dlphilp@The3800:~$ openshot
> Added /usr/share/openshot to system path
> --------------------------------
> OpenShot (version 0.9.52)
> --------------------------------
> *** ERROR: MLT Python bindings failed to import ***
> *** ERROR: MLT Python bindings failed to import ***
> Exception in thread Thread-1:
> Traceback (most recent call last):
> File "/usr/lib/python2.6/threading.py", line 525, in __bootstrap_inner
> self.run()
> File "/usr/share/openshot/classes/thumbnail.py", line 174, in run
> mlt.Factory().init()
> NameError: global name 'mlt' is not defined
>
> -------------------------------------------------------
> Error: OpenShot has not been installed in the Python path.
> (Both the site-packages and /usr/share/openshot folders were checked)
>
> Use the following command to install OpenShot:
> $ sudo python setup.py install
>
> However, I have followed the installation instructions a number of times,
> always resulting in the same error. System is Ubuntu Jaunty, MLT is 0.7.7
> (built locally), Python is 2.6 and correctly installed. Kdenlive works
> perfectly with my build of MLT, btw.
>
> I'd like to review OpenShot for the Linux Journal. I have to get it running
> first, so any help would be appreciated.
>
> Dave Phillips
>
> http://linux-sound.org
>
> --
> You received this question notification because you are an answer
> contact for OpenShot Video Editor.
>

Revision history for this message
Dave Phillips (dave-linux-sound) said :
#2

Hi Jonathan,

The system is Ubuntu Jaunty (see first message), installed as a 32-bit system. As far as I can tell all needed components are present and accounted for. However, it appears that MLT is not installing its Python module correctly (or at all). It would be most helpful if you can tell me what OpenShot expects to find and where it expects to find it. Also, any advice you can give re: the MLT build and installation would be helpful too, especially wrt the Python module.

Best,

dp

Revision history for this message
Jonathan Thomas (jonoomph) said :
#3

When MLT is built, it has an optional /swig/ build process that can generate
bindings for many different scripting languages. Of course, one them is
Python. Here are the 3 files that need to be copied into your Python path
(i.e. site-packages or dist-packages folder):

# copy the bindings into the site-packages folder
src/swig/python/mlt.py
src/swig/python/_mlt.so
src/swig/python/mlt_wrap.o

When you install our dependencies (from the DEB installers), it has a script
which copies these files into the site-packages folder. If you are using
the default MLT installation that comes with Jaunty, it will not work with
OpenShot.

If you would like to "sandbox" this so it doesn't break Kdenlive and FFmpeg,
I would suggest using VirtualBox (Ubuntu 9.04), and install OpenShot using
our DEB installers.

Thanks,
-Jonathan

On Tue, Nov 3, 2009 at 5:52 AM, Dave Phillips <
<email address hidden>> wrote:

> Question #87661 on OpenShot Video Editor changed:
> https://answers.launchpad.net/openshot/+question/87661
>
> Status: Answered => Open
>
> Dave Phillips is still having a problem:
> Hi Jonathan,
>
> The system is Ubuntu Jaunty (see first message), installed as a 32-bit
> system. As far as I can tell all needed components are present and
> accounted for. However, it appears that MLT is not installing its Python
> module correctly (or at all). It would be most helpful if you can tell
> me what OpenShot expects to find and where it expects to find it. Also,
> any advice you can give re: the MLT build and installation would be
> helpful too, especially wrt the Python module.
>
> Best,
>
> dp
>
> --
> You received this question notification because you are an answer
> contact for OpenShot Video Editor.
>

Revision history for this message
Dave Phillips (dave-linux-sound) said :
#4

Hi Jonathan,

To be more clear: I built and installed MLT 0.7.7 myself, with the SWIG bindings. However, I discovered a few problems with MLT and Ubuntu Jaunty. First, the MLT installation fails to install the bindings anywhere, including the /usr/lib/python-support hierarchy (which, btw, doesn't include an openshot subdirectory). The Makefile in the MLT Python bindings subdirectory includes an install directive that is incomplete and does nothing. Thus, the needed components for MLT's Python bindings can be built but must then be manually installed, which leads to the second problem: Ubuntu doesn't set PYTHONPATH. And of course, until that path is explicit to the system OpenShot will continue to produce the error I've reported.

I finally fixed things by taking the following steps:

1) Built & installed MLT w. Python bindings according to its available scripts.
2) Built and installed OpenShot with its available scripts.
3) Manually installed the MLT Python modules to /usr/lib/python2.6/site-packages/.
4) Ran 'export PYTHONPATH=$PYTHONPATH:/usr/lib/python2.6/site-packages/'
5) Voila, OpenShot now opens without error.

I hope this information will be of some help to anyone else building and installing the software. I don't know where the blame lies, but it seems to me that the maintainers of Ubuntu's Python environment and of MLT should consider correcting the problem on their end, i.e. no PYTHONPATH and a useless Makefile for MLT's Python bindings.

Best,

dp

Revision history for this message
mrvanes (mrvanes) said :
#5

The above solutions did not apply for me.

It seems python-mlt looks for libmlt++.so.2: (found when running the python-mlt example)
ImportError: libmlt++.so.2: cannot open shared object file: No such file or directory

libmlt++2 does not create a /usr/lib/libmlt++.so.2 library (ubuntu Karmic)

Solution:
sudo /usr/lib/ln -s libmlt++.so.0.4.10 '/usr/lib/libmlt++.so.2'

And openshot starts!

Revision history for this message
Andrea Ciaf (lazona2005) said :
#6

I'm agree with mrvanes , but there's a mistake in his solution :

not sudo /usr/lib/ln -s libmlt++.so.0.4.10 '/usr/lib/libmlt++.so.2'

but sudo ln -s libmlt++.so.0.4.10 '/usr/lib/libmlt++.so.2'

Thanks,
Andrea.

Revision history for this message
Theextendedname (tryme) said :
#7

Thanks Andrea Ciaf and mrvanes. I have been struggling to get this working for 3 days.
os: ubuntu 9.10 karmic 32bit
OpenShot (version 1.0.0)
I hope OpenShot will fix this or at least post this fix in their FAQ.

sudo ln -s libmlt++.so.0.4.10 '/usr/lib/libmlt++.so.2'

it worked for me

Revision history for this message
Narcis Garcia (narcisgarcia) said :
#8

I've find this bug with OpenShot 1.0.0 and Ubuntu 9.10

The following is a command that should solve for any versions:

ln -s $(ls -C /usr/lib/libmlt++.so.* | cut -f 1 -d' ') /usr/lib/libmlt++.so.2

Revision history for this message
Nec (nicolas-ecarnot) said :
#9

Hi,

With a freshly updated karmic 9.10 and openshot 1.1.1, I can confirm "Actiu informatica"'s hint is WORKING!

Thank you