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

Python 2 requirement #6

Open
ivan-pi opened this issue May 3, 2023 · 8 comments
Open

Python 2 requirement #6

ivan-pi opened this issue May 3, 2023 · 8 comments

Comments

@ivan-pi
Copy link

ivan-pi commented May 3, 2023

Attempting to build this project from source, I noticed the packaged CTemplate version has a Python 2 build/installation requirement:

[ 70%] Performing build step for 'CTemplate'
  File "/home/HemePure-GPU/dep/build/CTemplate-prefix/src/CTemplate/./src/htmlparser/generate_fsm.py", line 309
    print '\n'.join((self._CreateHeader(),

There has only been one new CTemplate release (v2.4), but I haven't yet inspected if it was replaced with Python 3.

@ivan-pi
Copy link
Author

ivan-pi commented May 3, 2023

Okay, it looks like the switch was made in v2.4 of CTemplate: OlafvdSpek/ctemplate@ee11ba1

Since Python 2 is now unsupported, some environments don't provide it anymore.

Replacing the old tarball (https://github.com/UCL-CCS/HemePure-GPU/blob/master/dep/src/ctemplate-2.3.tar.gz) with the new one (https://github.com/OlafvdSpek/ctemplate/releases/tag/ctemplate-2.4) would be the solution.

@ivan-pi
Copy link
Author

ivan-pi commented May 3, 2023

Replacing the tarball with the new version or simply using the CTEMPLATE_TARBALL variable doesn't work, because the CMake script expects to find an executable configure:

[ 70%] Creating directories for 'CTemplate'
[ 75%] Performing download step (download, verify and extract) for 'CTemplate'
-- Downloading...
   dst='/home/HemePure-GPU/dep/build/CTemplate-prefix/src/ctemplate-2.4.tar.gz'
   timeout='none'
   inactivity timeout='none'
-- Using src='http://github.com/OlafvdSpek/ctemplate/archive/ctemplate-2.4.tar.gz'
-- Downloading... done
-- extracting...
     src='/home/HemePure-GPU/dep/build/CTemplate-prefix/src/ctemplate-2.4.tar.gz'
     dst='/home/HemePure-GPU/dep/build/CTemplate-prefix/src/CTemplate'
-- extracting... [tar xfz]
-- extracting... [analysis]
-- extracting... [rename]
-- extracting... [clean up]
-- extracting... done
[ 79%] No update step for 'CTemplate'
[ 83%] Performing patch step for 'CTemplate'
noalign
novacopy
[ 87%] Performing configure step for 'CTemplate'
/bin/sh: /home/HemePure-GPU/dep/build/CTemplate-prefix/src/CTemplate/configure: No such file or directory
make[2]: *** [CMakeFiles/CTemplate.dir/build.make:92: CTemplate-prefix/src/CTemplate-stamp/CTemplate-configure] Error 127
make[1]: *** [CMakeFiles/Makefile2:139: CMakeFiles/CTemplate.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

The configure script is only available after ./autogen.sh has been run, which must have been the case in the current tarball.

To fix this I had to patch this line:

CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR> ${CTEMPLATE_CONFIGURE_OPTIONS}

-	CONFIGURE_COMMAND	<SOURCE_DIR>/configure --prefix=<INSTALL_DIR> ${CTEMPLATE_CONFIGURE_OPTIONS}
+	CONFIGURE_COMMAND	<SOURCE_DIR>/autogen.sh && <SOURCE_DIR>/configure --prefix=<INSTALL_DIR> ${CTEMPLATE_CONFIGURE_OPTIONS} 

@ivan-pi
Copy link
Author

ivan-pi commented May 3, 2023

I was finally able to build CTemplate now 🚀

[100%] Completed 'CTemplate'
[100%] Built target CTemplate

It did however choke with the NVIDIA nvc/nvc++ compiler, so I switched to gcc for the dependency libraries.

@izacharo
Copy link
Collaborator

izacharo commented May 3, 2023 via email

@ivan-pi
Copy link
Author

ivan-pi commented May 3, 2023

Thanks for the tip, I was not aware of the 2to3 tool. 👍🏻

The environment I'm working in is somewhat restricted, I have no pip access, and only Python 3.9 is available by default. Not even automake/autoreconf were present to build CTemplate, but I got hold of them through a module.

As far as I can see, the only difference in CTemplate v2.4 is the switch to Python 3. It is also used in HemePure-CPU Spack build: https://github.com/compbiomedeu/compbiomed-spack/blob/main/packages/ctemplate/package.py#L33

@izacharo
Copy link
Collaborator

izacharo commented May 3, 2023 via email

@ivan-pi
Copy link
Author

ivan-pi commented Jun 1, 2024

I think this issue is also resolved by #9? cc @benczaja

@benczaja
Copy link
Contributor

Yes it should be (@ivan-pi). Though I think that the HIP branch (https://github.com/UCL-CCS/HemePure-GPU/tree/HIP) still does not have the merge

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

No branches or pull requests

3 participants