Building from source in Windows and Anaconda

Description of the Problem, or Question?

I’m trying to build from source in Windows using anaconda prompt, as I need python modules not available in msys2. I can install the prerequisites either using msys2 as recommended or the Linux subsystem, but setup isn’t able to find them when I run it (from ~/Documents/mypaint). They are in the msys2 install directory (C:\msys64\ something or other) or the WLS install directories, and I haven’t been able to figure out how to link them once in Windows.

My goal is to be able to import mypaint into python, so I’m open to other options, such as finding a way to import the python files from the windows standalone (although it doesn’t seem set up for that?) or a different way to compile mypaintlib and mypaint-brushes.

Basic System Details

2.0.0-alpha+git.5c64063

Operating System + Version:

Windows 10

Please Tell Us How to Reproduce the Problem in Steps:

  1. Install msys2, and the prerequisites following the windows part of the install guide on github.
    or
    Install linux subsystem, install prerequisites, build libmypaint and mypaint-brushes in linux subsystem

  2. Install anaconda prompt and python prerequisites in anaconda

  3. clone mypaint lib, run setup.py from anaconda prompt

or:

  1. download standalone

  2. cd to mypaint\mingw64\lib\mypaint\lib in standalone

  3. attempt to import python files in anaconda’s python

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

When running setup.py (as best as I can tell this is pkgconfigure crashing as it can’t find the programs installed by msys2):

Traceback (most recent call last):
  File "setup.py", line 927, in <module>
    ext_modules=get_ext_modules(),
  File "setup.py", line 818, in get_ext_modules
    extra_compile_args=extra_compile_args,
  File "setup.py", line 761, in pkgconfig
    universal_newlines=True,
  File "C:\Users\user\Anaconda3\envs\paint\lib\subprocess.py", line 395, in check_output
    **kwargs).stdout
  File "C:\Users\user\Anaconda3\envs\paint\lib\subprocess.py", line 472, in run
    with Popen(*popenargs, **kwargs) as process:
  File "C:\Users\user\Anaconda3\envs\paint\lib\subprocess.py", line 775, in __init__
    restore_signals, start_new_session)
  File "C:\Users\user\Anaconda3\envs\paint\lib\subprocess.py", line 1178, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified

in the standalone at ~\mypaint\mingw64\lib\mypaint\lib:

Python 3.7.4 (default, Aug  9 2019, 18:34:13) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import mypaintlib
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\user\Downloads\mypaint\mingw64\lib\mypaint\lib\mypaintlib.py", line 15, in <module>
    import _mypaintlib
ImportError: DLL load failed: The specified module could not be found.

Disclaimer: I’m not a Windows user, nor an msys2 expert.

I’m not sure what your end goals are here, nor if running the libraries compiled in the msys2 environment will work outside of it, but you would have to either move the mypaint libraries to wherever your python installation is looking for its modules (presumably some variety of site_packages) and probably modify a bunch of paths in those library files to make it work, or see if you can amend the lookup path to the installation in the msys2 file tree.

There doesn’t happen to be an Anaconda installation for msys2 you could use?

1 Like

Thanks for your response! I’ll give it a shot, but I was worried it would look something like that. That’s basically why I was wondering if there wasn’t a way to finagle the standalone to work, as it’s already built and not buried in the msys2 directories.

I’m trying to use mypaint in python to render automatically generated brushstrokes, but unfortunately I need a bunch of other libraries and the computer’s GPU. I was able to get it to work in Linux (with your help :P), so it’ll be fine, but it’d be nice to get it in Windows as well. I wasn’t able to find the libraries or an anaconda installation in msys2, and the GPU thing makes any self contained environment tricky-for example, I could probably compile it in WSL and have almost everything, but can’t use GPUs there.