-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Meson complains about an absolute include path #16312
Comments
Similar bug report (but no follow-up, does say it's happening on Ubuntu, and I was using an Ubuntu Docker container with system Python): mesonbuild/meson#8640 |
Ah, the code looks like this: src_root = self.environment.get_source_dir()
for a in incdir_strings:
if a.startswith(src_root):
raise InvalidArguments(textwrap.dedent('''\
Tried to form an absolute path to a source dir. So what's happening is that the check goes off only if your include dir is inside your source tree. In this case I was creating a Python virtual environment within the I think it's actually not good practice to create venv's within the source tree, but it's also common (I don't use venv's or Docker much, so I just copy-pasted a tutorial which is why I ran into it now). |
I have a vague memory of bringing this up before and the initial answer being "don't do that". We need to fix this somehow though, because it's common practice. Here's a few tools that do create venv's inside the local tree:
|
Argh yes, thanks. That increases the importance of making I'll submit a PR to Meson to clarify the error message though. |
And it will remain the same after that, too. One thing that an old-fashioned virtualenv package is better than venv, is you create a ~/.virtualenvs directory, set a $WORKON_HOME env var in .bashrc, once. and that's it. |
Not considering this a blocker for 1.9.0, so bumping the milestone. If someone runs into this when building from source in a venv that's installed inside the source tree: see the four last comments above. |
I think I had this issue in #17151. I've been trying to use meson to build in an I do not see the error if I try to build without a venv. |
We do have a CI job specifically testing a venv on Debian: https://github.com/scipy/scipy/blob/main/.github/workflows/linux_meson.yml#L125. So it's a little odd that that works, except when you're in Docker.
I am fairly sure that that is the only thing that triggers this check. It would be helpful to to confirm that by debugging in the Docker container if you can @andyfaff, and checking the paths. The exact line of code is https://github.com/mesonbuild/meson/blob/b8e53ed5ea9c2a3eec19396233e646d4c1f667ae/mesonbuild/interpreter/interpreter.py#L2657. |
We are observing this issue during the PyData NYC mini sprints outside a Docker container. System is a Macbook Pro with macOS Big Sur from @kejsitake. Creating the virtual environment outside the SciPy source directory didn't help. |
Hmm, very odd and not good. If you are able to post a reproducer for that, I'll investigate. I have a macbook; it's on macOS 12, but it's unlikely that the OS version matters here. |
I think the exact details should be available in builddir/meson-logs/meson-log.txt so if that log file could be provided it would help to debug this. |
After switching to a conda/mamba environment @kejsitake managed to successfully build SciPy. In parallel she made some global software changes with Homebrew so it's unclear whether we will be able to reproduce the issue again or recover the logs, but at least knowing that it was a venv thing might help. |
This is important, but not as high prio as working on the BLAS/LAPACK support in Meson. We won't get around to this for 1.10.0, so I have bumped the milestone. |
It seems that the combination venv and docker may be a problem for meson currently [1]. [1] scipy/scipy#16312
This should make things work with in-tree virtual envs, as well as some situations with Docker that had issues before. The approach to determine absolute/relative paths unfortunately has to be a bit convoluted, but I believe this should work in all circumstances. A future improvement is still to make this work: ``` np_dep = dependency('numpy') ``` That way it won't be needed to run any Python code for the host interpreter at build time (this is bad for cross-compiling). Closes scipygh-16312
This should make things work with in-tree virtual envs, as well as some situations with Docker that had issues before. The approach to determine absolute/relative paths unfortunately has to be a bit convoluted, but I believe this should work in all circumstances. A future improvement is still to make this work: ``` np_dep = dependency('numpy') ``` That way it won't be needed to run any Python code for the host interpreter at build time (this is bad for cross-compiling). Closes scipygh-16312
This is a fairly annoying issue, and I've seen it before but somehow am only now running into it again - probably because I'm working in a Docker container.
Trying to run
pip install . --no-build-isolation
inside a Docker container on currentmain
results in:Outside of a Docker container there's never a complaint - and yes, we are feeding
include_directories
an absolute path.find_libraries
, which we also use, does require an absolute path. So it looks like we need both; this diff gets us past errors inscipy/meson.build
:However, now
inc_np
is a relative path so it cannot be reused as easily in subdirectories. The next error that pops up is:We'd have to go through every subdir where we use
inc_np
(and there's 67 usages). An absolute path should be fine (and is nicer to use), and it's not clear to me why it doesn't work inside Docker.@eli-schwartz any thoughts?
The text was updated successfully, but these errors were encountered: