1

Upgraded my OS X to mac sierra ad updated macport (sudo port selfupdate). Then tried to run python from terminal and getting this error every time:

Python 3.6.2 (default, Jul 18 2017, 14:08:57) 
[GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.42)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 
Python(1316,0x7fffee2213c0) malloc: *** error for object 0x105b21698: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Abort trap: 6

I installed py36-readline but it didn't help. How to fix this now?

I found this on GitHub: Crashes with Python 3.6 - MacOS Sierra, but did no help.

haccks
  • 104,019
  • 25
  • 176
  • 264
  • Is this relevant? https://stackoverflow.com/questions/22329005/mac-terminal-pointer-being-freed-was-not-allocated-error-when-opening-termin It would seem that this is a problem in general with executables in OSX – Izaak van Dongen Aug 21 '17 at 21:37
  • @IzaakvanDongen; Nope! I am not getting error while opening terminal. I get it only when I launch `python3` from the terminal. – haccks Aug 21 '17 at 21:40
  • I've got no issues with python 3.6.2 from Homebrew, so it looks a macport issue to me. Maybe try uninstalling and reinstalling python instead of just upgrading? And make sure your symlinks are pointing to the new binary? * edit oops sorry, i'm not on Sierra but on El capitan. Not sure if that matters – Irmen de Jong Aug 21 '17 at 21:42
  • @IrmendeJong; Already uninstalled and reinstalled it few times. Didn't work. I came here after I exhausted trying every possible solution came to my mind. – haccks Aug 21 '17 at 21:43
  • @IrmendeJong; I found the solution. You were right. It's macports problem. – haccks Aug 21 '17 at 21:53
  • can you contact me at my email in profile. Thanks – Grijesh Chauhan Apr 25 '18 at 03:54
  • @GrijeshChauhan; Hi Grijesh. After long time :). Will do sure. Can you just give me a little brief for the purpose of contact? – haccks Apr 25 '18 at 06:00
  • @haccks help on C internals work. wil answer you back – Grijesh Chauhan Apr 25 '18 at 07:24

1 Answers1

0

I found the solution! Its macports problem as pointed by Irmen de Jong in a comment. Installing py36-readline will not solve the problem as it says in the message after installing python36

##############################################################
# IF YOU ARE USING PYTHON FROM THE TERMINAL, PLEASE INSTALL:
#   py36-readline
# TO AVOID A LIBEDIT / PYTHON INTERACTION ISSUE.
# REF: https://trac.macports.org/ticket/48807
############################################################## 

Solution is given at the REF link.
Do the following:

  • Remove python36: sudo port uninstall python36
  • Remove py36-readline: sudo port uninstall py36-readline
  • Install python36 with sudo port install python36 +readline

This will fix the error.

haccks
  • 104,019
  • 25
  • 176
  • 264