Meson: Installation Instructions are confusing to people not familiar with pip

Created on 12 Apr 2017  路  22Comments  路  Source: mesonbuild/meson

I appreciate the idea of having a build system which does not suck. However the installation of this build sucks badly. After 2 Hours fiddling I still cannot run the meson command on windows and have a great deal of unnecessary knowledge about the python package manager before beeing able to run mason on debian.

I See this ticket as a starting point for help for others frustrated with the installation:

1.) Download

There are basically no instructions on how to install, a completley unnecessary link to the sources and incomplete instructions for a programming language installation and a packet manager.

The linux instructions are less then minimal and there is not a single word for Mac or Windows.

My Tip: Ignore the Download-Page its completley useless.

2.) Installation

After clicking into the documentation the "Quick Guide" or "Using Meson" is the only place which bothers to handle the installation, in just so many words.

2.1) Python...

I want to build C++ or C# - and obviously it is required to know python to use this build system.

There are installation instructions for ubuntu, which are incomplete too. Installing the python3 package does not install pip3.

pip3 install --user meson

answers with: command not found

Of course I can google and as a developer I can easily solve such problems after some reasearch, but it shows how much the instructions really suck. They are not only lacking, they are incomplete and misleading. And I lost now 2 hours of my time where I could have learned the syntax instead of fiddling with tools which are only a dependency.

On Windows it is even worse, I couldn't get pip running so far. And beeing able to cross-compile was the main reason I looked into this project. So far I am not impressed. But that was yesterday, and I thought linux probably is the better platform to start.

2.2) Paths...

After running:

pip3 install --user meson

I saw the installation successfully installing into ~/.local/lib/python3.4/site-packages/

-bash: meson: command not found

Now I got angry enough to write this Bug. I also found #465 which addresses the issue. The Problem BTW is. that the meson executable is placed in "~/.local/bin/meson" which is not in the PATH. There is actually a bug hanging for pip ( https://github.com/pypa/pip/issues/3813 ) with exactly this issue.

So to install meson, I need to know know how to install python and a package manager which is not even mentioned besides a command which does not work, circumvent bugs for their package manager before finally beeing able to run it for the first time.

3.) Running

So we have meson running with

~/.local/bin/meson build

Meson encountered an error:
Could not detect Ninja v1.6 or newer

Debian is very stable, so this one was to be expected, even though I am running jessie.
Still, each step of the road was blocked, nothing worked out of the box. This is very frustrating.

OK build ninja from source and copy it to /usr/bin

wget <latest-ninja>
./configure.py --bootstrap
 sudo cp ninja /usr/bin/

At this point, I am not sure if anybody uses meson outside the Python-Ubuntu-Club.

BUT I got it at least working on debian. If anyone has better instructions for windows I will gladly try them.

After the installation, it works surprisingly smooth...

documentation supporRFC

Most helpful comment

@FreeApophis ,
The fact that you had to use ~/.local/bin/meson is not really a problem of meson,
You should run pip3 with root privileges if you want to install it to root dir.
Try
sudo pip3 install meson

All 22 comments

Works for me on windows (win7-64), without any issues.

  1. Install latest Python 3, check for correct installation:
C:\>python -VV
Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 18:41:36) [MSC v.1900 64 bit (AMD64)]

C:\>where python
C:\Python36-x64\python.exe

C:\>where py
C:\Windows\py.exe

C:\>where pip3
C:\Python36-x64\Scripts\pip3.exe
  1. Install meson, check for correct installation:
C:\>pip3 install meson
Collecting meson
  Using cached meson-0.39.1.tar.gz
Installing collected packages: meson
  Running setup.py install for meson ... done
Successfully installed meson-0.39.1

C:\>meson --version
0.39.1

C:\>where meson
C:\Python36-x64\Scripts\meson.py

@msink Python 3's pip is called pip on Windows. You might've renamed pip to pip3 manually. But everything else should work as you said if your Python installation is done correctly.

There are both pip and pip3:

C:\>where pip
C:\Python36-x64\Scripts\pip.exe

And even pip3.6:

C:\>where pip3.6
C:\Python36-x64\Scripts\pip3.6.exe

I didn't rename anything in python 3.6 directory :)
You probably mean python3 - there is no such file, if user not renamed it by hand.

OK I got it to run on Window 10 too, it actually was easier than on Debian:

The Python 3 installer has some very bad default settings, first you need to check

[ x ] Add Python to PATH

The default installation is only for the current user, and is installed into the App Directory. Even though you add Python to the PATH variable, after installing meson with pip3, meson will not be in the Path.

If you install to all users, (Advanced Tab on the installer) meson will be in the path, but you need a command Prompt with eleveated privileges to install meson.

Either way

pip3 install meson

will install meson correctly.

After installing Ninjna into a directory in the PATH everything seems to work. Probably because I have Visual Studio already Installed? Not sure what compiler it would use otherwise. However after python is installed correctly, it seems to work fine on windows.

Thanks for the heads up.

Does pip3 install meson also install the scripts in the tools/ folder? I was not able to find cmake2meson.py on my system.

It is not installed by the package, it is only available in the source repository. The reason for this is that it s not reliable enough to ship.

I mostly (no longer) have build problems with meson as such; with ninja also not that much. But I miss some easy options, simply because I am so used to the GNU Autoconfigure way.

I give you an example. I just compiled dconf 0.27.1.

/usr/include/features.h:148:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp]
 # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
   ^~~~~~~
[90/90] Linking target tests/engine.

I got a warning... which I assume is no problem, but it is still confusing.

I see 90/90 and I also see bin/dconf.

I assume it has compiled successfully but ... do I have any --prefix option? Any "make" and "make install" step?

Probably somewhere. Meson/Ninja people who are so used to it, can figure out, but poor me doesn't really have any idea about this. So what I do now is to ... manually relocate bin/dconf to where it ought to reside. : :/

dconf is just one example, this by now probably applies to most of the gnome3 stack. Perhaps it is documented somewhere, but I'd wish that for the --prefix, "make" and "make install"-like steps, it would be super-trivial on the commandline. Just to get the equivalent options. (That also includes ./configure --help like options... cmake has a similar problem, it was hard to find out what options cmake wants... took me a while to find out that --prefix is equivalent to -DCMAKE_INSTALL_PREFIX= ... the rest is still guessing by me mostly, or trying to wait until the LFS/BLFS folks got the right options and just using it from them, then).

I assume it has compiled successfully but ... do I have any --prefix option?

Sure, meson builddir --prefix=/whatever or meson configure builddir -Dprefix=/whatever

Any "make" and "make install" step?

ninja was make and ninja install is make install.

I think the equivalent of ./configure --help is meson.py configure builddir. This will list the options available in the project. Then you can set them with -D or with meson configure.

@FreeApophis ,
The fact that you had to use ~/.local/bin/meson is not really a problem of meson,
You should run pip3 with root privileges if you want to install it to root dir.
Try
sudo pip3 install meson

I agree with @JithinPavithran.
I recommend that this is added as note to install instructions.

Thanks for this bug report, I wouldn't have figured out how to get this working otherwise!

This is a very bad bug that you install following instructions :
pip3 install -- user meson
and you get :
/usr/bin/meson: No such file or directory

It is desperating.

This is not a bug:
You have a space between -- and user, that can't work.

ok, sorry for the noise

Detailed instructions for how to install meson are now available at https://mesonbuild.com/Getting-meson.html and everything on this PR has been addressed there AFAIK.

Please open new issues for improving that as required. Thanks for all the input here.

@nirbheek there is one more document should be corrected https://mesonbuild.com/Quick-guide.html

This is still an issue, and you closed it without actuall fixing it.
the install instruction give you two methods:

pip3 install meson
pip3 install --use meson

The thing is, those both do the same thing. You have to use

sudo pip3 install meson

Otherwise, meson doesn't seem to work.

You're probably thinking that we should just know to use sudo, but that isn't the case.
I follow install insructions verbatim. Not all package managers require sudo - the on I use most,
npm, does bad thing if you use sudo. We are not all pyhonistas. Please fix your install instructions so that everyone can follow them.

With --user you should not need sudo. Some details are really platform/distro specific, not all distro have sudo, not all distro has ~/.local in the $PATH by default... I don't think Meson doc can cover all possible cases. In most sane env, pip3 install --user meson should be enough.

I completely commiserate with the OP.

I have downloaded meson-0.56.0: Successfully unpacked it: now, lookiing for INSTALL.txt, nope, ok README.md will do, right?

Not even close. README seems to contain information for installing prebuilt meson package using pip or ninja. Hrmm.

clearly, I'm trying to build meson from source; mesonbuild dir right? Nope needs a 'pristine' directory for that... Ok, I'm hip to the notion that you might need to bootstrap a build system.

So how do I build meson from source?
I've read all those not helpful install instructions.

https://mesonbuild.com/Getting-meson.html#downloading-meson

Meson releases can be downloaded from the GitHub release page, and you can run ./meson.py from inside a release or the git repository itself without doing anything special.

Seems pretty fair to me.

Other methods include:

  • "On Windows, use the .msi installer"
  • on Linux, it's reasonable to assume users can install meson using apt, rpm, pacman, emerge, or similar -- the distro package manager is a familiar, unified interface and meson's installation guide recommends you prefer it if available.
  • "some program named pip. If you don't have a program named pip, research how to acquire pip." But it comes out of the box on most python installs, and on linux distro installs, pip is available via, again, a distro package.
$ pkgfile -vb pip3
  extra/python-pip 20.1.1-1 /usr/bin/pip3
$ pip3
pip3 may be found in the following packages:
  extra/python-pip 20.1.1-1 /usr/bin/pip3

On debian:

$ apt-file search pip3
fish-common: /usr/share/fish/completions/pip3.fish
puppet: /usr/lib/ruby/vendor_ruby/puppet/provider/package/pip3.rb
python3-pip: /usr/bin/pip3
python3-pip: /usr/share/man/man1/pip3.1.gz
$ pip3

Command 'pip3' not found, but can be installed with:

apt install python3-pip


Not even close. README seems to contain information for installing prebuilt meson package using pip or ninja. Hrmm.

clearly, I'm trying to build meson from source; mesonbuild dir right? Nope needs a 'pristine' directory for that... Ok, I'm hip to the notion that you might need to bootstrap a build system.

What on earth is a "pristine" directory, and why do you think ./mesonbuild/ is it? I ask this as someone whose big thing is compiling and packaging hundreds of diverse projects for a linux distro.
I might think you're referring to "the original unmodified sources without the result of failed compilations", but then why are you looking in some random subdirectory for it? Most projects build from the root directory...

Once you do get pip installed...

$ pip install --help

Usage:   
  pip install [options] <requirement specifier> [package-index-options] ...
  pip install [options] -r <requirements file> [package-index-options] ...
  pip install [options] [-e] <vcs project url> ...
  pip install [options] [-e] <local project path> ...
  pip install [options] <archive url/path> ...

Description:
  Install packages from:

  - PyPI (and other indexes) using requirement specifiers.
  - VCS project urls.
  - Local project directories.
  - Local or remote source archives.

Look at that, pip supports "Local project directories" via "pip install [options] [-e] ".

I proposed to mention sudo pip install ./ in #7994 which should clarify this even more.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

robertsanseries picture robertsanseries  路  6Comments

inigomartinez picture inigomartinez  路  5Comments

elig0n picture elig0n  路  5Comments

eyelash picture eyelash  路  4Comments

matthiasclasen picture matthiasclasen  路  4Comments