Skip to content

Bugfixes and compatibility updates - #52

Merged
nirlipo merged 40 commits into
LAPKT-dev:Devel2.0from
anubhav-cs:2025-Mar-Pypi-patch
Mar 27, 2025
Merged

Bugfixes and compatibility updates#52
nirlipo merged 40 commits into
LAPKT-dev:Devel2.0from
anubhav-cs:2025-Mar-Pypi-patch

Conversation

@anubhav-cs

Copy link
Copy Markdown
Contributor

Important Changes:

v0.2.0

  • Python 3.7 is unavailable for Ubuntu 24.04. So, we will deprecate it for builds targeting Ubuntu 24.04 and later.
  • Python 3.7 and 3.8 are incompatible with newer versions of Boost on Windows, so the builds for Python 3.7 and 3.8 have been removed for Windows.
  • The PyPi package will not be built for Ubuntu 18 as the image was removed from GitHub actions. We used the image to compile and publish the PyPI package.
  • PyPi packages will be built for the glibc version included in Ubuntu 22.04 and 24.04, 2.35 and 2.39, respectively.

Others:

  • A couple of bugfixes addressing bugs discovered in IPC 2023 and some more later when additional test cases were added.
  • Sphinx theme conversion of doxygen documentation was removed; it was cumbersome to maintain. Now, we only include a slightly customized Doxygen configuration, which generates content in the default theme.
  • Documentation updates

Known Issue:

Jupyter notebooks using Python 3.12 crash when the planner is called. However, the conversion of the notebooks to Python scripts works as expected. This is a very weird bug, and Jupyter does not give any helpful information even at the debug verbosity level. Python 3.9, 3.10, and 3.11 were tested with Jupyter notebooks and worked as expected.

Added license text and reformatted the source code
Reformatted the C++ source code using the auto file formatting feature in vscode.
Included the source code of Approximate Novelty Search
New documentation and update auto-doc build process. The install
- Removed Automatic Sphinx documentation generation as it is incompatible with python >=3.11.
- Included source code of Boost, Catch2 and Fast-Downward. Earlier, these were being downloaded over HTTPS.
- Added anytime-fd option, which calls a fast-downward solver configuration
Fixed issue with negated goals in the translation phase. IPC 2023 runs were impacted by this.
Cmake policies are version dependent; cannot be set on older versions and are necessary for newer releases.
Because of changes to standard library interface on windows, Python 3.7 and 3.8 cause error with Boost headers.

Python 3.7 and 3.8 headers redefine sprintf as _sprintf. When Boost attempts to use sprintf, it is redirected to _sprintf, which was reimplemented as sprintf and does not exist. See boostorg/system#32.

Resolution: we are deprecating the support for Python 3.7 and 3.8 on Windows as the error cannot be resolved without making changes to the Python headers.
Added Python 3.11 and 3.12 to the GitHub build workflow.
Once a static variable has been initialized, further initializations have no effect.

Hence. static std::vector<int> var_count = std::vector<int>(prob.fluents().size(), 0), will not resize the vector if the count of fluents increases.
Shortening "approximate" novelty search
Include ctest cases based on Never Winter Night Game; these problems were designed by Miguel.
setuptools package was removed from Python 3.12 standard modules
Planenr setup method must be called before solve.
The destructor deletes the match tree; however, it is not guaranteed that the match tree will be created. A pointer must be initialized before it is deleted. So, we initialize the match tree pointer to nullptr when a match tree object is created.
Adding simple python test cases.
- Ubuntu 18 image was removed from GitHub actions which we use to compile and publish the lapkt pypi package.
- Fixed the path to pytest python files
- Ubuntu 22.04 and 24.04 added to build_test workflow
Python 3.7 is unavailable for Ubuntu 24.04. So, we must deprecate it for Ubuntu 24.04 and later.
- Updated comments to reflect the most recent code.
- Removed Sphinx auto doc generation routine entirely; the html it generated looked nice, but it was cumbersome to update the build routines for newer Python and Ubuntu version.
On windows static python wrappers are generated which we cannot link to from cpp_unit_test
anytime_fd cmd parameter is optional
Initial code for version 0.2.0
to publish version lapkt 0.2.0 for glibc 2.35 and 2.39 and python 3.11 and 3.12.
@nirlipo

nirlipo commented Mar 26, 2025

Copy link
Copy Markdown
Collaborator

@anubhav-cs , I'm trying to build in my mac (I know this may lead us to a headache we can solve later on). But, just in case. The error happens when I try to run

        cmake --build builds/build -j4 

for which I get the error:

-- CMAKE_INSTALL_NAME_DIR @loader_path
CMake Error at CMakeLists.txt:343 (set_target_properties):
  set_target_properties Can not find target to add properties to: wrapper


CMake Error at CMakeLists.txt:348 (target_link_libraries):
  Cannot specify link libraries for target "wrapper" which is not built by
  this project.


-- Configuring incomplete, errors occurred!
make[2]: *** [cmake/SuperBuildLinux/external_lapkt-prefix/src/external_lapkt-stamp/external_lapkt-configure] Error 1
make[1]: *** [cmake/SuperBuildLinux/CMakeFiles/external_lapkt.dir/all] Error 2
make: *** [all] Error 2

When I look at the cmakelist.txt file at line 348, you have this comment in it (# CHECK THIS FOR MACOS):

#---- Python extensions ----#

#---- CXX Wrappers over LAPKT lib ----#

if(WINDOWS_BUILD)
  pybind11_add_module(wrapper SHARED)
elseif(LINUX_BUILD)
  add_library(wrapper SHARED)
  target_link_libraries(wrapper PUBLIC
    pybind11::pybind11
  )
endif()

set_target_properties(wrapper PROPERTIES
  PREFIX ""
  INSTALL_RPATH "${CMAKE_INSTALL_RPATH}:$ORIGIN" # CHECK THIS FOR MACOS
)

Any clue which target path is the compiler looking for?

Declaring python wrapper libraries using the same construct as Linux for macos. This may not work!
We replace it with the next available version macos-13
@anubhav-cs

Copy link
Copy Markdown
Contributor Author

@nirlipo I did some changes to the cmake config. Can you try build the package again?

On the GitHub's macos-13 image, it is failing to install the PyPi ruamel.yaml package; the compiler fails to find stdio.h when building it. That is something I cannot debug as I do not own a mac.

Also, Apple, MS, and Linux have their own ecosystem of libraries, binary formats and system paths; different things breaks in different ways, for each OS, whenever LAPKT dependencies get updated. One needs to know every aspect of the OS to configure the build properly. I can own this for Linux and Windows, but not for macos; I do not have sufficient knowledge of macos ecosystem. I suggest that someone who owns a mac be in-charge of the build steps for macos.

@anubhav-cs

Copy link
Copy Markdown
Contributor Author

The error on macos-13

Building wheel for ruamel.yaml.clib (pyproject.toml): started
  Building wheel for ruamel.yaml.clib (pyproject.toml): finished with status 'error'
  error: subprocess-exited-with-error
  
  × Building wheel for ruamel.yaml.clib (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [32 lines of output]
      /private/var/folders/x8/bc6z1t3j7c5fjhdnsk33gbxm0000gn/T/pip-build-env-7dbtvuvz/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py:289: UserWarning: Unknown distribution option: 'test_suite'
        warnings.warn(msg)
      /private/var/folders/x8/bc6z1t3j7c5fjhdnsk33gbxm0000gn/T/pip-build-env-7dbtvuvz/overlay/lib/python3.10/site-packages/setuptools/dist.py:759: SetuptoolsDeprecationWarning: License classifiers are deprecated.
      !!
      
              ********************************************************************************
              Please consider removing the following classifiers in favor of a SPDX license expression:
      
              License :: OSI Approved :: MIT License
      
              See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details.
              ********************************************************************************
      
      !!
        self._finalize_license_expression()
      running bdist_wheel
      running build
      running build_py
      creating build/lib.macosx-13.7-x86_64-cpython-310/ruamel/yaml/clib
      copying ./__init__.py -> build/lib.macosx-13.7-x86_64-cpython-310/ruamel/yaml/clib
      copying ./setup.py -> build/lib.macosx-13.7-x86_64-cpython-310/ruamel/yaml/clib
      copying ./LICENSE -> build/lib.macosx-13.7-x86_64-cpython-310/ruamel/yaml/clib
      running build_ext
      building '_ruamel_yaml' extension
      creating build/temp.macosx-13.7-x86_64-cpython-310
      /Applications/Xcode_15.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/usr/local/opt/sqlite/include -I/usr/local/opt/sqlite/include -I/Users/runner/hostedtoolcache/Python/3.10.16/x64/include/python3.10 -c _ruamel_yaml.c -o build/temp.macosx-13.7-x86_64-cpython-310/_ruamel_yaml.o
      In file included from _ruamel_yaml.c:16:
      /Users/runner/hostedtoolcache/Python/3.10.16/x64/include/python3.10/Python.h:25:10: fatal error: 'stdio.h' file not found
      #include <stdio.h>
               ^~~~~~~~~
      1 error generated.
      error: command '/Applications/Xcode_15.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for ruamel.yaml.clib
Successfully built antlr4-python3-runtime
Failed to build ruamel.yaml.clib
ERROR: Failed to build installable wheels for some pyproject.toml based projects (ruamel.yaml.clib)

@nirlipo

nirlipo commented Mar 27, 2025

Copy link
Copy Markdown
Collaborator

Hi @anubhav-cs ,

I added a couple of lines, to get my wrapper compiling, but now it fails to link due to some issues with pybind.

https://gist.github.com/nirlipo/20bf85d3b198f920afb142ec70f416cd

I tried with python 3.9 and 3.13, same issues.

The gist above shares the command I used and the error message.

We could accept this PR and open another issue to solve the MAC compilation errors. What do you think?

Strangely enough, I have no issues installing realme in my local mac as it shows in the failed buildingtest BuildTest / build-macos-13 (3.10) (pull_request)

@anubhav-cs

anubhav-cs commented Mar 27, 2025

Copy link
Copy Markdown
Contributor Author

@nirlipo

Yes, we should move ahead with the PR. That way, I can push a new release on PyPi which Andrew can use for the tutorials. I think resolving issues with macos will take time.

Could you please comment-out the lines 380 to 469 in .github/workflows/build_test.yml before you accept the PR? Otherwise, the build status will show failed on the homepage.


The errors:

Undefined symbols for architecture arm64:
  "_PyBaseObject_Type", referenced from:
...

stem from Python library not having certain symbols. May be it is linking to the wrong version of Python.

I searched on Google and a Reddit note: https://www.reddit.com/r/cpp_questions/comments/ulyaii/pybind11_error_compatibility_andor_linker_issue/ pointed me to the pybind11 build instructions page: https://pybind11.readthedocs.io/en/stable/compiling.html#building-manually. We may need to add -undefined dynamic_lookup to the CMAKE_CXX_FLAGS. That is, add

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -undefined dynamic_lookup")

after line 151 in ./CMakeLists.txt.

@nirlipo

nirlipo commented Mar 27, 2025

Copy link
Copy Markdown
Collaborator

Great! with your suggested flag, I managed to compile and build in my local MAC using python 3.13!

I created a special pip_requirements_mac.txt file for MAC where I fixed the version for realme.yaml. Hopefully this fixes the issue with the automatic build, and changed the superbuild cmake file to use it only for MAC OS builds.

@nirlipo

nirlipo commented Mar 27, 2025

Copy link
Copy Markdown
Collaborator

@anubhav-cs I managed to push the dial with the MAC OS built. I think we are close now, it still fails to build ruamel.yaml but it compiles, and fails only in the pytest section. Something to do whith python not finding the location of the library. see https://github.com/LAPKT-dev/LAPKT-public/actions/runs/14099081875/job/39491830134?pr=52

Ok, I comment out the build for mac and will accept the PR, and create another issue for MAC.

@nirlipo
nirlipo merged commit 63514a1 into LAPKT-dev:Devel2.0 Mar 27, 2025
@nirlipo

nirlipo commented Mar 27, 2025

Copy link
Copy Markdown
Collaborator

see issue #53 wrt MAC build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants