Compiling mypaint: ImportError: No module named _mypaintlib


I’m trying, for the first time since the switch to setupstools, to compile MyPaint from scratch. I’m on Debian Stretch. Compiling and installing mypaintlib went fine, it installed the C libraries into /usr/local/lib:

$ find /usr/local/lib/ | grep mypaint

and the system can find them:

$ pkg-config --list-all | grep -i mypaint
libmypaint-2.0                      libmypaint - MyPaint's brushstroke rendering library (2.0.0-alpha)
libmypaint                          libmypaint - MyPaint's brushstroke rendering library (1.3.0)

Compiling mypaint itself with demo also works, but it has problems importing mypaintlib when starting mypaint:

   Traceback (most recent call last):
      File "/tmp/demo-Q91R_5/bin/mypaint", line 465, in <module>
        main.main(datapath, iconspath, old_confpath, version=version)
      File "/tmp/demo-Q91R_5/lib/mypaint/gui/", line 96, in main
        from gui import application
      File "/tmp/demo-Q91R_5/lib/mypaint/gui/", line 49, in <module>
        import lib.document
      File "/tmp/demo-Q91R_5/lib/mypaint/lib/", line 32, in <module>
        import lib.helpers as helpers
      File "/tmp/demo-Q91R_5/lib/mypaint/lib/", line 27, in <module>
        import mypaintlib
      File "/tmp/demo-Q91R_5/lib/mypaint/lib/", line 21, in <module>
        _mypaintlib = swig_import_helper()
      File "/tmp/demo-Q91R_5/lib/mypaint/lib/", line 20, in swig_import_helper
        return importlib.import_module('_mypaintlib')
      File "/usr/lib/python2.7/importlib/", line 37, in import_module
    ImportError: No module named _mypaintlib
    Demo: cleaning up '/tmp/demo-Q91R_5'...
    Traceback (most recent call last):
      File "", line 599, in <module>
      File "/usr/lib/python2.7/distutils/", line 151, in setup
      File "/usr/lib/python2.7/distutils/", line 953, in run_commands
      File "/usr/lib/python2.7/distutils/", line 972, in run_command
      File "", line 200, in run
      File "/usr/lib/python2.7/", line 186, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['/usr/bin/python', '/tmp/demo-Q91R_5/bin/mypaint', '-c', '/tmp/demo-Q91R_5/_config']' returned non-zero exit status 1

Anyone knows what’s up? I noticed that I didn’t find any mypaintlib stuff in the python/site-packages directories in /usr/local/lib. Should there be any?

This is just a guess, but a while ago I added:

sudo ldconfig

to my build script, right after installing libmypaint. If that works we should update the instructions :smiley:

That did it! Thanks a lot!

Awesome! I’m updating the build docs, I just thought I must be crazy :slight_smile: