Running python fails on importing _mypaintlib

Please fill out the topic template below so we can help you faster.

Description of the Problem, or Question?

After I installed mypaint from the github source, I can successfully run it by running “mypaint” in terminal, but if I go to run it as python or if I try to import specific parts of the lib (say, “from lib import surface”) I get the error below. I got the same problem using version 1.2x as here, but the compat-v1.2.2 branch fixed it there, which makes me think it might be a similar problem, but the SConscript file no longer exists, so I’m not sure how to fix it.

Basic System Details

MyPaint version:


Operating System + Version:
Ubuntu 16.04.5

Using anaconda python 3.7.4

Please Tell Us How to Reproduce the Problem in Steps.

  1. Install mypaintbrushes and libmypaint
  2. download mypaint,
python managed_install
sudo ldconfig

or after installation in the mypaint folder:

import lib.surface

Are there any Errors Popping Up? If so, paste the text in the area shown below.

(I replaced my username with ‘user’ here in /home/user/~)

Traceback (most recent call last):
  File "/home/user/Documents/paint/3/mypaint/lib/", line 18, in swig_import_helper
    fp, pathname, description = imp.find_module('_mypaintlib', [dirname(__file__)])
  File "/home/user/anaconda3/envs/paint3/lib/python3.7/", line 296, in find_module
    raise ImportError(_ERR_MSG.format(name), name=name)
ImportError: No module named '_mypaintlib'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "", line 464, in <module>
    = get_paths()
  File "", line 230, in get_paths
    from lib import fileutils
  File "/home/user/Documents/paint/3/mypaint/lib/", line 26, in <module>
    import lib.helpers
  File "/home/user/Documents/paint/3/mypaint/lib/", line 26, in <module>
    from . import mypaintlib
  File "/home/user/Documents/paint/3/mypaint/lib/", line 28, in <module>
    _mypaintlib = swig_import_helper()
  File "/home/user/Documents/paint/3/mypaint/lib/", line 20, in swig_import_helper
    import _mypaintlib
ModuleNotFoundError: No module named '_mypaintlib'

If you want to run from the source directory, you can either use python demo or copy the file from the build output directory to the lib folder. will be located in: source_root/build/lib.python-version.stuff/lib/ after a successful build.

1 Like

I ended up making a symlink to the

source_root /build/lib. python-version.stuff /lib/ folder

which seems to be working, thank you very much for your help!