Compiling mypaint: ImportError: No module named _mypaintlib

Hi!

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
/usr/local/lib/libmypaint-1.3.so.0.0.0
/usr/local/lib/libmypaint-2.0.so.0
/usr/local/lib/libmypaint.la
/usr/local/lib/libmypaint.so
/usr/local/lib/libmypaint-2.0.so
/usr/local/lib/libmypaint-2.0.so.0.0.0
/usr/local/lib/libmypaint-2.0.la
/usr/local/lib/pkgconfig/libmypaint.pc
/usr/local/lib/pkgconfig/libmypaint-2.0.pc
/usr/local/lib/libmypaint-1.3.so.0

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 setup.py 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/main.py", line 96, in main
        from gui import application
      File "/tmp/demo-Q91R_5/lib/mypaint/gui/application.py", line 49, in <module>
        import lib.document
      File "/tmp/demo-Q91R_5/lib/mypaint/lib/document.py", line 32, in <module>
        import lib.helpers as helpers
      File "/tmp/demo-Q91R_5/lib/mypaint/lib/helpers.py", line 27, in <module>
        import mypaintlib
      File "/tmp/demo-Q91R_5/lib/mypaint/lib/mypaintlib.py", line 21, in <module>
        _mypaintlib = swig_import_helper()
      File "/tmp/demo-Q91R_5/lib/mypaint/lib/mypaintlib.py", line 20, in swig_import_helper
        return importlib.import_module('_mypaintlib')
      File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
        __import__(name)
    ImportError: No module named _mypaintlib
    Demo: cleaning up '/tmp/demo-Q91R_5'...
    Traceback (most recent call last):
      File "setup.py", line 599, in <module>
        ext_modules=get_ext_modules(),
      File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
        dist.run_commands()
      File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
        self.run_command(cmd)
      File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "setup.py", line 200, in run
        subprocess.check_call(demo_cmd)
      File "/usr/lib/python2.7/subprocess.py", 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: