rdkit: Pointer freeing error when using rdkit.Chem.Draw in 2024.03.6 and 2024.09.1 conda-forge packages for ARM Macs
Describe the error
The following code crashes on ARM macs with the most recent two osx-arm64 rdkit packages (2024.09.1 and 2024.03.6).
The older 2024.03.5 osx-arm64 package runs this code successfully on ARM macs.
All recent x86-64 rdkit packages run this code successfully on ARM macs (using MacOS’s rosetta emulator to run x86 code)
Happy to move this issue to the feedstock if it’s diagnosed as a build issue, but figured I should start it here.
To Reproduce
Many people use rosetta by default on ARM macs now to force the use x86 packages, so sometimes reproducing will require setting CONDA_SUBDIR to override this and pull in native osx-arm64 packages.
CONDA_SUBDIR=osx-arm64 mamba create -n temp_arm rdkit=2024.03.6
mamba activate temp-arm
from rdkit import Chem
from rdkit.Chem.Draw import rdMolDraw2D
rdkit_molecule = Chem.MolFromSmiles('CCO')
drawer = rdMolDraw2D.MolDraw2DSVG(200, 200, 150, 200)
drawer.DrawMolecule(rdkit_molecule)
drawer.FinishDrawing()
python(60508,0x1e732f240) malloc: *** error for object 0x101df5668: pointer being freed was not allocated python(60508,0x1e732f240) malloc: *** set a breakpoint in malloc_error_break to debug zsh: abort python repro.py
Configuration (please complete the following information):
- RDKit version: 2024.09.1 and 2024.03.6
- OS: Mac OSX 15.0, on a 2020 M1 macbook air
- Python version (if relevant): 3.12.6
- Are you using conda? Yes
- If you are using conda, which channel did you install the rdkit from? conda-forge
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 16 (12 by maintainers)
@bp-kelley @j-wags I can confirm this on my Mac mini (M1). It’s not a problem in 2024.03.5 or the current master. I will look into it, because it may just be something we’re getting away with.
The test script (testMolDraw2D.py) also fails on 2024.09.1 which is weird because clearly that passed on the CI machine. Dave
@bp-kelley @j-wags @greglandrum The bare reproducible is:
A bit more illuminating, I think, is
The error occurs after the SVG text is printed:
This suggests to me that it’s something occurring as the Python is clearing up. The script runs successfully insofar as it does what was requested of it. The equivalent code making a MolDraw2DCairo object doesn’t show the problem.
I have downloaded the tarballs for the 2024.03.6 and 2024.09.1 releases and built them from scratch and they don’t show the problem. The issue therefore seems to be confined to the Conda builds for 2024.03.6 and 2024.09.1 but not 2024.03.5. IIRC, there was a problem with the Conda 2024.03.6 build which might be relevant.
That’s as far as I can go, I’m afraid, but hopefully it’s enough information to point someone else in the right direction.