Post

Replies

Boosts

Views

Activity

Did Apple change command parsing for `zsh` in one of the recent updates?
Hey, I am using a command line tool (bwa mem). it's not so important what it does, but that it somehow changed it's behavior in macOS zsh. A command that worked earlier does now not work anymore. The intended usage of this tool is: Usage: bwa mem [options] <idxbase> <in1.fq> [in2.fq] Some time ago (about 1 year) I wrote a workflow that contained this command: bwa mem resources/genome.fasta path/to/read_1.fastq.gz path/to/read_2.fastq.gz -K 100000000 -Y So, I put the options behind the positional arguments, not in front of it. It's not its intended usage, I know, but it always worked. I retried that yesterday and all of a sudden, zsh complains about incorrect usage and I have to change the order of the arguments. I don't use a newer version of bwa (fixed by conda install). The old command still works on centOS bash. I installed bwa 0.7.17 freshly on both OSs and centOS bash runs the command without complaining, whereas macOS zsh does not. Has there been any change in zsh that would explain this?
0
0
486
Mar ’24
Why does my zsh show these faint underscores since some weeks?
These faint underscores at the beginning of some lines are new since some weeks. Is it a bug or a feature? It doesn't matter what commands I execute they appear quite randomly at the beginning of some lines. They disappear, if I resize the window. I am using JetBrains Mono NL Regular 14 in my zsh for quite some time now, but the underscores started appearing just recently. Besides that, I can't spot any option that should trigger this in my .zshrc. Anyone seens this before?
0
0
557
Feb ’24
Get the number of Apple Silicon performance cores in Python
Simple question, I want to determine the number of performance cores in an Python script (better a Python app frozen with PyInstaller, which could make a difference). there are some ways to get the number of CPUs/cores like os.cpu_count(), multiprocessing.cpu_count() or psutil.cpu_count() (the later allowing discrimination between physical and virtual cores). However, Apple Silicon CPUs are separated into performance and efficiency cores, which you can get with (e.g.) sysctl hw.perflevel0.logicalcpu_max for performance and sysctl hw.perflevel1.logicalcpu_max for efficiency cores. Is there any way to get this in Python besides running sysctl and get the shell output? Maybe using the pyobjc package?
0
0
888
Nov ’23
Make `rosetta error` more verbose
Hey everyone, while trying to codesign a x86_64 Python app using an arm64 system, I often stumble across an rosetta error like the one depicted down here: rosetta error: unable to mmap __TEXT: 1 /var/db/oah/.../.../libomp.dylib.aotzsh: abort PYTORCH_ENABLE_MPS_FALLBACK=1 ./diarize_x86_64 mps This happens after I codesign the app and then try to run it in a Rosetta2 zsh. This thread is not about the error itself (since I am trying to solve it somewhere else). It is about making this rosetta error more verbose so we can actually work with it. If I run this app/executable on a native x86_64 system, the error is much more informative (and it can actually be debugged): error dlopen(/var/folders/ws/***/T/yyy/sklearn/__check_build/_check_build.cpython-39-darwin.so, 2): Library not loaded: @rpath/libomp.dylib Referenced from: /var/folders/ws/***/T/yyy/sklearn/__check_build/_check_build.cpython-39-darwin.so Reason: no suitable image found. Did find: /private/var/folders/ws/***/T/yyy/sklearn/__check_build/../../libomp.dylib: code signing blocked mmap() of '/private/var/folders/ws/***/T/yyy/sklearn/__check_build/../../libomp.dylib' ___________________________________________________________________________ Contents of /var/folders/ws/***/T/yyy/sklearn/__check_build: __init__.py __pycache__ _check_build.cpython-39-darwin.so ___________________________________________________________________________ It seems that scikit-learn has not been built correctly. If you have installed scikit-learn from source, please do not forget to build the package before using it: run `python setup.py install` or `make` in the source directory. If you have used an installer, please check that it is suited for your Python version, your operating system and your platform. It would be great, if we could get this output using a Rosetta2 zsh with an arm64 system, because the simple rosetta error is hard (or impossible) to debug. Is there a way to do this?
0
1
595
Oct ’23
Installing PyQt5 on `arm64` stopped working all of a sudden (some `sip` issue)
Hey everyone, I have an Python script that uses PyQt5. Unfortunately there is no wheel for pyqt5 to install it with pip so you have to build from source, if you are on arm64. This is how I successfully did it till today: It requires qmake, which I installed via brew (brew install qt5). After adding this to my path I can execute it (which qmake shows the correct path). Then I install pyqt5 via pip with this command: pip install pyqt5 --config-settings --confirm-license= --verbose (pyqt5 asks for license agreement, but pip install is not interactive, hence the long command). As I said, till last week I could do this successfully. When I tried this today I got the error: The dbus-python package does not seem to be installed. These bindings will be built: Qt, pylupdate, pyrcc. Generating the Qt bindings... Generating the pylupdate bindings... _in_process.py: /private/var/folders/ws/vdb_nvyj35g9ck_srpvqpccm0000gn/T/pip-install-jr3725ba/pyqt5_7d0f0bcc5a7241bd8afa726e0fa5e8d1/sip/QtCore/qprocess.sip: line 99: column 5: 'Q_PID' is undefined error: subprocess-exited-with-error It seems thta something with sip-related changed. The only thing that has changed on my system was an update from Xcode14 to Xcode15. I don't really see why this should affect pyqt5 or sip, but it's the only thing I can think of. I also tried to install sip via brew additionally, but this did not change anything. Any ideas?
5
1
2.6k
Sep ’23
Cannot install Python from source on Apple Silicon M1
I am trying to install Python from source according to the readme using: ./configure make &lt;-- Error happens here make test sudo make altinstall However, I cannot complete the make command since it fails with: Undefined symbols for architecture arm64: "_libintl_bindtextdomain", referenced from: __locale_bindtextdomain in _localemodule.o "_libintl_dcgettext", referenced from: __locale_dcgettext in _localemodule.o "_libintl_dgettext", referenced from: __locale_dgettext in _localemodule.o "_libintl_gettext", referenced from: __locale_gettext in _localemodule.o "_libintl_setlocale", referenced from: __locale_setlocale in _localemodule.o __locale_localeconv in _localemodule.o "_libintl_textdomain", referenced from: __locale_textdomain in _localemodule.o ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [Programs/_freeze_module] Error 1 Looks like make is somehow using the wrong architecture. I just don't know why. Does anyone have an idea?
2
0
925
Sep ’23
signing an app with PyInstaller only works once
I made a simple Python based app for macOS using this code (empty lines removed): import tkinter as tk window = tk.Tk() label = tk.Label(text="\n I am a macOS app \n") label.pack() window.mainloop() Next I made it an .app using PyInstaller with this command (identity and paths shortened): pyinstaller --noconfirm --onedir --windowed --osx-bundle-identifier "org.tk_test.tk_test" --codesign-identity "<my_identity>" path/to/tk-test.py It worked like a charm and I was also able to notarize and staple the app for distribution. ... 4748 INFO: Signing the BUNDLE... 24899 INFO: Building BUNDLE BUNDLE-00.toc completed successfully. I wanted to repeat the process to do some more testing and now without any reason I cannot sign the .app anymore (identity and paths shortened). Of course, I cleared the folder before trying: ... 5263 INFO: Signing the BUNDLE... 23050 WARNING: Error while signing the bundle: codesign command (['codesign', '-s', '<my_identity>', '--force', '--all-architectures', '--timestamp', '--options=runtime', '--deep', '/abs/path/to/dist/tk-test.app']) failed with error code 1! output: /abs/path/to/dist/tk-test.app: replacing existing signature /abs/path/to/dist/tk-test.app: A timestamp was expected but was not found. In subcomponent: /abs/path/to/dist/tk-test.app/Contents/MacOS/lib-dynload/math.cpython-311-darwin.so 23050 WARNING: You will need to sign the bundle manually! 23050 INFO: Building BUNDLE BUNDLE-00.toc completed successfully. I tried to create it in a fresh and differently named directory and I also made a complete fresh conda env. I don't see any reason, why this should not work anymore. Does anybody have an idea?
1
0
1.3k
Aug ’23
codesigning with auto-py-to-exe takes ages
Hey everyone, I've ported an app based on Python from Windows to macOS. I can run the app from command line and I was also able to make an .app file an start it on my mac using auto-py-to-exe. Now I want to codesign (and later notarize) it. To do so I set the codesign_identity option of auto-py-to-exe to my Developer ID Application and rerun it. After 2 days it was still running (and I guess collecting information on submodules of the used Python modules). Without the codesigning it takes about 5-10 minutes to build. Any ideas how I could accelerate this or what i happening here? Unfortunately, I am not able to copy the output of auto-py-to-exe while it is still running. thanks :).
1
0
999
Aug ’23
Basics for App development (macOS)
Hey everyone, I have knowledge of Python from data science background and a friend of mine wrote an app based on Python. This app was converted to binaries for windows, which works fine, and also to a macOS binary that runs fine from the command line, but I fail to make it double clickable. I now want to dive a little into app development for macOS to make this a real one click app with all these features like signing and notarizing (I am aware this requires an Apple developer account) and stuff. What I want to learn is some Xcode basics (GUI and command line) especially for building Python projects for arm64 and x86_64 and notarizing. Building C++ projects for arm64 and x86_64. Maybe some basic understanding of Object-C and Swift (no complete coding stuff, since I want to stick to Python). Is there a good course someone can recommend (doesn’t have to be free) that covers these topics so I don’t have to browse through a lot of online resources (which I will of course still have to do later)? Thanks everyone :).
2
0
853
Jul ’23