Macbook PRO 2015 OS Big SUR Python Crash - python-3.x

I am trying to launch python 3 on my macbook, it use to work before ... now if I launch on the termina "python3" it crash and I got this message.
I don't know what to do...
> user:~ my_mac$ python3 dyld: Library not loaded:
> /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
> Referenced from:
> /Library/Frameworks/Python.framework/Versions/3.5/Resources/Python.app/Contents/MacOS/Python
> Reason: image not found Abort trap: 6
I Tried to upgrade the python version and got this message:
> ==> python#3.9 Python has been installed as /usr/local/bin/python3
>
> Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
> `python3`, `python3-config`, `pip3` etc., respectively, have been
> installed into /usr/local/opt/python#3.9/libexec/bin
>
> You can install Python packages with pip3 install <package> They
> will install into the site-package directory
> /usr/local/lib/python3.9/site-packages
Here the error page.
>Process: Python [65598]
>Path: >/Library/Frameworks/Python.framework/Versions/3.5/Resources/Python.app/Contents/MacOS/Python
>Identifier: Python
>Version: 3.5.2 (3.5.2)
>Code Type: X86-64 (Native)
>Parent Process: bash [48227]
>Responsible: Terminal [48225]
>User ID: 501
>
>Date/Time: 2021-02-06 09:57:55.710 +0100
>OS Version: macOS 11.1 (20C69)
>Report Version: 12
>Anonymous UUID: FB4549E5-EACE-CBB0-1BA6-6767B1DAD93D
>
>Sleep/Wake UUID: 7A0A2DD1-F786-48A4-8641-D98824F7673B
>
>Time Awake Since Boot: 510000 seconds
>Time Since Wake: 5200 seconds
>
>System Integrity Protection: enabled
>
>Crashed Thread: 0
>
>Exception Type: EXC_CRASH (SIGABRT)
>Exception Codes: 0x0000000000000000, 0x0000000000000000
>Exception Note: EXC_CORPSE_NOTIFY
>
>Termination Reason: DYLD, [0x1] Library missing
>
>Application Specific Information:
>dyld: launch, loading dependent libraries
>
>Dyld Error Message:
> dyld: No shared cache present
>Library not loaded: >/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
> Referenced from: >/Library/Frameworks/Python.framework/Versions/3.5/Resources/Python.app/Contents/MacOS/Python
> Reason: image not found
>
>Binary Images:
> 0x100000000 - 0x100000fff +org.python.python (3.5.2 - 3.5.2) <78B09BD7-3C8E-0E55->F3A1-BA0FF24E8496> >/Library/Frameworks/Python.framework/Versions/3.5/Resources/Python.app/Contents/MacOS/Python
> 0x7fff6679f000 - 0x7fff6683afff dyld (832.7.1) <DEA51514-B4E8-3368-979B-89D0F8397ABC> >/usr/lib/dyld
>
>Model: MacBookPro11,5, BootROM 425.0.0.0.0, 4 processors, Quad-Core Intel Core i7, 2,8 GHz, 16 >GB, SMC 2.30f2

Related

"Failed to import the required Python library (kubernetes)" despite the kubernetes module being installed

I'm running Ansible on macOS 12.4 and I have following task which uses kubernetes.core.k8s module.
- name: "apply {{ downloaded_metallb_manifest }}"
kubernetes.core.k8s:
src: "{{ downloaded_metallb_manifest }}"
state: present
wait: yes
I installed the collection as per documentation - https://docs.ansible.com/ansible/latest/collections/kubernetes/core/k8s_module.html
% ansible-galaxy collection install kubernetes.core
Starting galaxy collection install process
Process install dependency map
Starting collection install process
Downloading https://galaxy.ansible.com/download/kubernetes-core-2.3.2.tar.gz to /Users/grit/.ansible/tmp/ansible-local-811952kgpja6g/tmpc_mrql42/kubernetes-core-2.3.2-c3aeycar
Installing 'kubernetes.core:2.3.2' to '/Users/grit/.ansible/collections/ansible_collections/kubernetes/core'
kubernetes.core:2.3.2 was installed successfully
However, the task still fails.
TASK [metallb : apply /tmp/metallb-native.yaml] ****************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ModuleNotFoundError: No module named 'kubernetes'
fatal: [node1.local]: FAILED! => {"changed": false, "error": "No module named 'kubernetes'", "msg": "Failed to import the required Python library (kubernetes) on node1's Python /usr/bin/python3. Please read the module documentation and install it in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible_python_interpreter"}
Running the playbook with explicit -e 'ansible_python_interpreter=/usr/bin/python3' doesn't make any difference.
What went wrong here?
Here is Ansible version.
ansible [core 2.13.1]
config file = None
configured module search path = ['/Users/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/Cellar/ansible/6.1.0/libexec/lib/python3.10/site-packages/ansible
ansible collection location = /Users/user/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/local/bin/ansible
python version = 3.10.5 (main, Jun 23 2022, 17:15:25) [Clang 13.1.6 (clang-1316.0.21.2.5)]
jinja version = 3.1.2
libyaml = True
The kubernetes collection is in the ansible collection location
% ls -l /Users/user/.ansible/collections/ansible_collections
total 0
drwxr-xr-x 3 user staff 96 26 Aug 12:57 kubernetes
drwxr-xr-x 3 user staff 96 26 Aug 12:57 kubernetes.core-2.3.2.info
Following prerequisites have been installed as well.
% pip3 list | egrep -i 'kubernetes|pyyaml|jsonpatch'
jsonpatch 1.32
kubernetes 24.2.0
PyYAML 6.0
This is sorted by installing these libraries on target machine via pip3.
jsonpatch 1.32
kubernetes 24.2.0
PyYAML 6.0

Golang Embedding Python in Go

I've been reading the articles embedding-python-in-go and the original article packaging-python-code, but I have yet to succeed at running Python.h through cgo.
Can this be done on an m1 mac? if not, should I port everything into a Linux docker container?
what am I missing when setting up this type of project.
below is a simple example from article 1.
This leads to the error
./main.go:22:4: could not determine kind of name for C.PyRun_SimpleString
1 package main
2 /*
3 #cgo pkg-config: python3
#include <Python/Python.h>
4 */
5 import "C"
6
7 import (
8 "unsafe"
9 )
10
11 func main() {
12
13 pycodeGo := `
14 import sys
15 for path in sys.path:
16 print(path)
17 `
18
19 defer C.Py_Finalize()
20 C.Py_Initialize()
21 pycodeC := C.CString(pycodeGo)
22 defer C.free(unsafe.Pointer(pycodeC))
23 C.PyRun_SimpleString(pycodeC)
24
25 }
removing lines 20-23 returns error
# command-line-arguments
Undefined symbols for architecture arm64:
"_Py_Finalize", referenced from:
__cgo_672c0788d500_Cfunc_Py_Finalize in _x002.o
(maybe you meant: __cgo_672c0788d500_Cfunc_Py_Finalize)
"_Py_Initialize", referenced from:
__cgo_672c0788d500_Cfunc_Py_Initialize in _x002.o
(maybe you meant: __cgo_672c0788d500_Cfunc_Py_Initialize)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [run] Error 2
kinda at a lost on the architecture error; m1 issue?
importing python.h on mac is #include <Python/Python.h> instead of #include <Python.h> importing Python.h on mac
software specs
$ python3 -V Python 3.9.10
$ go version go version go1.17.8 darwin/arm64
macOS verrsion 11.4, M1 2020.
Python.h is present under/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/Headers/Python.h
reference git repos ardanlabs/python-go go-python3 christian-korneck/python-go

I'm unable to create the .exe for the most simple 'hello world' example

I've used py2exe successfully for previous projects on previous build machines, but now I've freshly installed everything from scratch and can't run the simplest example:
setup.py:
from distutils.core import setup
import py2exe
setup(console=['hello.py'])
hello.py:
print("Hello World")
Command: python3 setup.py py2exe
Output:
running py2exe
1 missing Modules
------------------
? _posixshmem imported from multiprocessing.resource_tracker, multiprocessing.shared_memory
Building 'dist\hello.exe'.
error: [WinError 87] The parameter is incorrect.
dest\hello.exe is generated (37 kB!) but gives the following error when run:
Could not locate script resource:The specified resource type cannot be found in the image file.
FATAL ERROR: Could not locate script
The versions I have installed are:
python --version
Python 3.8.6
pip freeze
cachetools==4.1.1
future==0.18.2
numpy==1.19.3
opencv-python==4.4.0.46
pefile==2019.4.18
py2exe==0.10.1.0
pyreadline==2.1
pywin32==300
systeminfo
OS Name: Microsoft Windows 10 Pro
OS Version: 10.0.19041 N/A Build 19041
OS Manufacturer: Microsoft Corporation
OS Configuration: Standalone Workstation
OS Build Type: Multiprocessor Free
Hotfix(s): 6 Hotfix(s) Installed.
[01]: KB4580419
[02]: KB4561600
[03]: KB4577266
[04]: KB4580325
[05]: KB4586864
[06]: KB4586781
Hyper-V Requirements: A hypervisor has been detected. Features required for Hyper-V will not be displayed.
I know that there is clearly something weird happening (I've already hit the issue with 'numpy' here: https://developercommunity.visualstudio.com/content/problem/1207405/fmod-after-an-update-to-windows-2004-is-causing-a.html ) ... but I can't quite see what it is.
Thanks !
-- Mac
You just misstyped the command line flag, should be: python setup.py py2exe.
Works fine for me on Win7, Python 3.8.0:
(py38) λ python setup.py py2exe
running py2exe
2 missing Modules
------------------
? _posixshmem imported from multiprocessing.resource_tracker, multiprocessing.shared_memory
? readline imported from cmd, code, pdb
Building 'dist\hello.exe'.
Building shared code archive 'dist\library.zip'.
Copy c:\users\f3k\envs\py38\scripts\python38.dll to dist
...
Copy DLL C:\Python38\DLLs\libffi-7.dll to dist\
C:\temp
(py38) λ dist\hello.exe
Hello World

AudioToolbox symbol not found when running mame64 on OS X Mojave

Earlier builds of Mame 0.205 run fine, but now when I build Mame 0.211 I get this error message:
./mame64
dyld: Symbol not found: __ZTINSt3__112bad_weak_ptrE
Referenced from: /Users/myself/mame/m06/./mame64
Expected in: /System/Library/Frameworks/AudioToolbox.framework/Versions/A/AudioToolbox
in /Users/myself/mame/m06/./mame64
Abort trap: 6
I'm running OS X Mojave 10.14.5 on a MacBook Pro.
Do I have a bad install of AudioToolbox, or some other problem?

mingw seems to crash python (Anaconda on windows)

I'm trying to install theano on a windows computer. When I do import theano python crashes. I think this is a mingw issue because when I uninstall mingw libpython and try to import theano, I get a theano warning, but python does not crash.
I have tried Anaconda 2.10 and 2.30. I follow the installation up with conda install mingw libpython, and then install the latest theano from github. import theano still crashes. Any ideas?
Here are the details of the "python.exe has stopped working" message:
Problem signature:
Problem Event Name: APPCRASH
Application Name: python.exe
Application Version: 0.0.0.0
Application Timestamp: 55678c56
Fault Module Name: lazylinker_ext.pyd
Fault Module Version: 0.0.0.0
Fault Module Timestamp: 55cdf48e
Exception Code: c000001d
Exception Offset: 000000000000517f
OS Version: 6.1.7600.2.0.0.768.3
Locale ID: 4105
Additional Information 1: 02b5
Additional Information 2: 02b5acdc9b8489c31d00cfe986aa8a42
Additional Information 3: fd67
Additional Information 4: fd674a72ea70861e63067edee1c9266b

Resources