Skip to content
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

Error finding CUTEst installation (new meson build) #89

Open
AndrewLister-STFC opened this issue Oct 17, 2024 · 6 comments · May be fixed by #90
Open

Error finding CUTEst installation (new meson build) #89

AndrewLister-STFC opened this issue Oct 17, 2024 · 6 comments · May be fixed by #90
Assignees
Labels
bug Something isn't working

Comments

@AndrewLister-STFC
Copy link

Describe the bug
I get the following error on import:

root@31fb1c5ea579:/home/fitbenchmarking# python
Python 3.12.7 (main, Oct  8 2024, 00:20:25) [Clang 18.1.8 ] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pycutest
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/venv/lib/python3.12/site-packages/pycutest/__init__.py", line 7, in <module>
    from .build_interface import import_problem, clear_cache, all_cached_problems
  File "/opt/venv/lib/python3.12/site-packages/pycutest/build_interface.py", line 13, in <module>
    from .install_scripts import get_setup_script
  File "/opt/venv/lib/python3.12/site-packages/pycutest/install_scripts.py", line 95, in <module>
    """ % get_cutest_path()  # will probably get the homebrew location, but may revert to environment variables
          ^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.12/site-packages/pycutest/system_paths.py", line 49, in get_cutest_path
    raise RuntimeError('Could not find CUTEST installation - have CUTEST and MYARCH environment variables been set correctly?')
RuntimeError: Could not find CUTEST installation - have CUTEST and MYARCH environment variables been set correctly?

I have installed CUTEst using the meson build system, so the path is not at the expected location:

$CUTEST/objects/$MYARCH/double/libcutest.a

and is instead installed and on the standard path

ls /usr/local/lib/libcutest_*
/usr/local/lib/libcutest_double.a  /usr/local/lib/libcutest_single.a

To Reproduce
I built CUTEst as part of a container here.
(I plan to update SIFDecode to the meson build too).

Information about your installation:

  • Operating System: ubuntu:24.04
  • Python Version / Distribution: uv python install 3.12
  • PyCUTEst Version: 1.7.1
@AndrewLister-STFC AndrewLister-STFC added the bug Something isn't working label Oct 17, 2024
@jfowkes
Copy link
Owner

jfowkes commented Oct 21, 2024

@lindonroberts I guess we should now also check the standard /usr/local/lib/ path? This is so that we can also support the newly released CUTEst meson installer that installs to /usr/local/lib/ by default. The old makefile based CUTEst installer still uses the path that we currently have so we should probably retain it for now.

@lindonroberts
Copy link
Collaborator

@jfowkes that makes sense to me. So the new meson installer just puts everything in a standard location and doesn't set the environment variables? Is it the same default path for Mac and Linux?

@jfowkes
Copy link
Owner

jfowkes commented Oct 22, 2024

@lindonroberts good question, the meson docs are rather vague on the specifics:

There is usually no need to specify install paths or the like. Meson will automatically install to the standards-conforming location.

I'll do some testing and see what the default Mac and Linux install locations are (for both CUTEst and SIFDecode).

@jfowkes jfowkes self-assigned this Oct 22, 2024
@AndrewLister-STFC
Copy link
Author

You can add a prefix when you set up the meson build to give it a custom install directory. It might be enough to check for existence on the PATH env var?

Would something like this do the job?

import pathlib
import os
cutest_double_path = None
for p in os.environ["PATH"].split(":"):
    candidate = pathlib.Path(p)/'libcutest_double.so'
    if candidate.exists():
        cutest_path = candidate
        break

@jfowkes
Copy link
Owner

jfowkes commented Oct 22, 2024

@AndrewLister-STFC no because /usr/local/lib/ is not on PATH (path is for binaries not libraries). It is sometimes on LD_LIBRARY_PATH on Linux but this is not guaranteed, especially on Mac.

@jfowkes
Copy link
Owner

jfowkes commented Oct 24, 2024

@lindonroberts after some testing here are the default meson install directories (for SIFDecode and CUTEst):

Linux

/usr/local/lib/
/usr/local/bin/

macOS (Silicon)

/opt/homebrew/lib/
/opt/homebrew/bin/

It looks like we already have the macOS paths so we just need to add the local Linux paths.

@jfowkes jfowkes linked a pull request Oct 24, 2024 that will close this issue
@jfowkes jfowkes linked a pull request Oct 24, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants