ModuleNotFoundError: No module named 'mesonbuild'

3,888 views
Skip to first unread message

Vincent Torri

unread,
May 8, 2017, 9:51:19 AM5/8/17
to The Meson Build System
Hello

I want to test meson to build my new project. For now, I want a shared library (for Windows, UNIX and Mac OS X). I have only one file for now.

Right now, I am on Windows, using MSYS2 as terminal.

1) Here is the tree structure

echart2/
  meson.build
  src/
    lib/
      echart_main.c
      echart_main.h
      Echart.h

2) meson.build content is :

project('echart', 'c')
shared_library('libechart', 'src/lib/echart_main.c)

3) I have installed python3 in the folder E:/Documents/programmes_x64/python3 that I have added to the PATH, and I have decompressed meson-0.40.1.tar.gz (found here https://github.com/mesonbuild/meson/releases) in ~/python3. So here here the tree in python:

python-3/
  python.exe
  meson-0.40.1/
    meson.py
 
4) ninja is in another folder

Now in echart2 (the top level dir of my project), I run

mkdir build
cd build
python.exe /e/Documents/programmes_x64/python-3/meson-0.40.1/meson.py ..

I get the following messages :

Traceback (most recent call last):
  File "E:/Documents/programmes_x64/python-3/meson-0.40.1/meson.py", line 17, in <module>
    from mesonbuild import mlog, mesonmain, mesonlib
ModuleNotFoundError: No module named 'mesonbuild'

does someone see where my error is ? Did I miss something ?

thank you

Vincent Torri

Jussi Pakkanen

unread,
May 8, 2017, 5:59:27 PM5/8/17
to Vincent Torri, The Meson Build System
On Mon, May 8, 2017 at 4:51 PM, Vincent Torri <vincen...@gmail.com> wrote:

> 3) I have installed python3 in the folder
> E:/Documents/programmes_x64/python3 that I have added to the PATH, and I
> have decompressed meson-0.40.1.tar.gz (found here
> https://github.com/mesonbuild/meson/releases) in ~/python3. So here here the
> tree in python:
>
> python-3/
> python.exe
> meson-0.40.1/
> meson.py

This directory should contain all other files and directories that
come with Meson. If you just left them out to make the mail shorter
that's fine.

If they are there then this might be a problem with Msys Python. There
are cases where it gets confused and tries to use unix-like paths
instead of windows-like paths (or vice versa, I forget which). This
breakage could be caused by that.

You might want to try the official Windows Python binaries rather than
the one provided by Msys.

Vincent Torri

unread,
May 9, 2017, 12:26:16 AM5/9/17
to The Meson Build System, vincen...@gmail.com

I don't use the MSYS ones and downloaded the one here: https://www.python.org/downloads/windows/
I have chosen "Windows x86-64 embeddable zip file"and just unzip the archive

Vincent Torri

unread,
May 9, 2017, 12:40:12 AM5/9/17
to The Meson Build System, vincen...@gmail.com


Le lundi 8 mai 2017 23:59:27 UTC+2, Jussi Pakkanen a écrit :
On Mon, May 8, 2017 at 4:51 PM, Vincent Torri <vincen...@gmail.com> wrote:

> 3) I have installed python3 in the folder
> E:/Documents/programmes_x64/python3 that I have added to the PATH, and I
> have decompressed meson-0.40.1.tar.gz (found here
> https://github.com/mesonbuild/meson/releases) in ~/python3. So here here the
> tree in python:
>
> python-3/
>   python.exe
>   meson-0.40.1/
>     meson.py

This directory should contain all other files and directories that
come with Meson. If you just left them out to make the mail shorter
that's fine.

should I download the meson tarball directly in python-3 folder, such that meson.py and all other meson files are in python3/ ?
 
Vincent Torri

Jussi Pakkanen

unread,
May 9, 2017, 6:32:31 AM5/9/17
to Vincent Torri, The Meson Build System
On Tue, May 9, 2017 at 7:40 AM, Vincent Torri <vincen...@gmail.com> wrote:

> should I download the meson tarball directly in python-3 folder, such that
> meson.py and all other meson files are in python3/ ?

No, you should not put anything in the Python 3 folder. Its contents
are Python's business and we should not meddle with those. Following
these steps should work at least:

- install official Python (assuming it goes to c:\python3 below)
- extract full contents of Meson tarball (or Git checkout) into c:\meson
- cd into project source dir
- run "c:\python3\python c:\meson\meson.py builddir"

If using Visual Studio, you need to run the command from the Visual
Studio command prompt.

Vincent Torri

unread,
May 10, 2017, 1:22:19 PM5/10/17
to The Meson Build System, vincen...@gmail.com


Le mardi 9 mai 2017 12:32:31 UTC+2, Jussi Pakkanen a écrit :
On Tue, May 9, 2017 at 7:40 AM, Vincent Torri <vincen...@gmail.com> wrote:

> should I download the meson tarball directly in python-3 folder, such that
> meson.py and all other meson files are in python3/ ?

No, you should not put anything in the Python 3 folder. Its contents
are Python's business and we should not meddle with those. Following
these steps should work at least:

- install official Python (assuming it goes to c:\python3 below)
- extract full contents of Meson tarball (or Git checkout) into c:\meson
- cd into project source dir
- run "c:\python3\python c:\meson\meson.py builddir"

no luck. There is still the same error message. I do not use Visual Studio, I use MSYS2 (only the terminal features).

Jussi Pakkanen

unread,
May 10, 2017, 1:32:17 PM5/10/17
to Vincent Torri, The Meson Build System
On Wed, May 10, 2017 at 8:22 PM, Vincent Torri <vincen...@gmail.com> wrote:

>> - run "c:\python3\python c:\meson\meson.py builddir"
>>
> no luck. There is still the same error message. I do not use Visual Studio,
> I use MSYS2 (only the terminal features).

Does msys support a unix-kind file path setup? Would invoking that one
work (something like python3 /c/meson/meson.py)?

If that does not work, what about cd'ing to c:\meson and then doing
one of the following:

- python meson.py --help
- python ./meson.py --help
- c:\python3\python meson.py <path to source dir> <path to build dir>

Also try from regular command shell rather than msys shell.

And just to be extra sure: you are using the official Python from
python.org and *not* the one that comes with msys? That one is
completely broken AFAICR.

Vincent Torri

unread,
May 10, 2017, 2:04:53 PM5/10/17
to The Meson Build System, vincen...@gmail.com


Le mercredi 10 mai 2017 19:32:17 UTC+2, Jussi Pakkanen a écrit :

Does msys support a unix-kind file path setup? Would invoking that one
work (something like python3 /c/meson/meson.py)?

yes it does. I usually use that syntax. Same error. I did a copy of  python.exe to python3.exe, in case it is important

19:22 $ python3.exe /e/Documents/programmes_x64/meson-0.40.1/meson.py  builddir

Traceback (most recent call last):
  File "E:/Documents/programmes_x64/meson-0.40.1/meson.py", line 17, in <module>

    from mesonbuild import mlog, mesonmain, mesonlib
ModuleNotFoundError: No module named 'mesonbuild'

 
If that does not work, what about cd'ing to c:\meson and then doing
one of the following:

 - python meson.py --help
 - python ./meson.py --help
 - c:\python3\python meson.py <path to source dir> <path to build dir>

i will check that
 
Also try from regular command shell rather than msys shell.

same error in the Windows console:

E:\Documents\MSYS2\home\vtorri\gitroot\echart2>e:\Documents\programmes_x64\python-3\python3.exe e:\Documents\programmes_
x64\meson-0.40.1\meson.py builddir

Traceback (most recent call last):
  File "e:\Documents\programmes_x64\meson-0.40.1\meson.py", line 17, in <module>

    from mesonbuild import mlog, mesonmain, mesonlib
ModuleNotFoundError: No module named 'mesonbuild'

 
And just to be extra sure: you are using the official Python from
python.org and *not* the one that comes with msys?

yes, i provide the full path to the python binary, extracted from the archive in https://www.python.org/downloads/windows/ (i've mentione that in a previous message)

Vincent Torri

Vincent Torri

unread,
May 19, 2017, 12:11:16 AM5/19/17
to The Meson Build System, vincen...@gmail.com
I have installed python 3 with the exe installer, which provides pip and i have installed meson with it.  It works now

best regards

Vincent Torri
Reply all
Reply to author
Forward
0 new messages