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

QualCoder 3.5 crashing on macOS 14 #879

Open
bfisseler opened this issue Jan 9, 2024 · 11 comments
Open

QualCoder 3.5 crashing on macOS 14 #879

bfisseler opened this issue Jan 9, 2024 · 11 comments

Comments

@bfisseler
Copy link

Describe the bug :
I just installed QualCoder following the instructions in the wiki. I then run QualCoder (while in the QualCoder-3.5 directory) using the command python3 ./qualcoder/__main__.py. Though the app starts up, when I select "Create new project" from the menu, the app chrashes down with the following error code shown in the terminal: zsh: segmentation fault python3 ./qualcoder/__main__.py.
In addition to this, when I start QualCoder I also get messages that files are missing (libvlccore.dylib).
To Reproduce :
I should mention that I use a virtual Python environment via pyenv, as otherwise I was not able to install the dependencies modules.

  • Install homebrew and pyenv
  • Install a new virtual pyenv environment using pyenv install 3.11 and set this environment globally
  • Follow installation steps for macOS from step 5 on

Desktop (please complete the following information):

  • OS: macOS 14.2.1
  • Version: QualCoder 3.5, Python 3.11.7
@ccbogel
Copy link
Owner

ccbogel commented Jan 9, 2024

Hi. The libvlccore missing library should not affect text coding, and the program did start to run. This might be because vlc is not installed? - but unsure, about this cause.

The other issue of a segmentation fault. I am not sure how to fix this, it is a sign the python interpreter is failing from what I am googling. Some suggestions are: (1) re-install python and its modules and recreate the qualcoder venv. (2) use a different Python version, e.g. 3.10 or 3.12.

@bfisseler
Copy link
Author

bfisseler commented Jan 10, 2024

Hi, thank you. I did as suggested, meaning I completely uninstalled and removed any non-macOS traces of Python and also remove VLC. Then I reinstalled VLC as well as pyenv, Python 3.10.13 and finally QualCoder. But this did not change anything, the QualCoder still won't find VLC and it still crashes as soon as I select "Create new project".
I then set the fault handler export PYTHONFAULTHANDLER=1 and ran QC again. This time it gave me the following info in the terminal:

qt.qpa.fonts: Populating font family aliases took 278 ms. Replace uses of missing font family "Noto Sans" with one that exists to avoid this cost. 
Fatal Python error: Bus error

Current thread 0x00007ff852269b80 (most recent call first):
  File "/Applications/Statistik/QualCoder/qualcoder/__main__.py", line 1622 in new_project
  File "/Applications/Statistik/QualCoder/qualcoder/__main__.py", line 2421 in gui
  File "/Applications/Statistik/QualCoder/qualcoder/__main__.py", line 2477 in <module>

Btw trying to open an existing project works and QC won't crash, though I have no project to try and open.

@ccbogel
Copy link
Owner

ccbogel commented Jan 10, 2024

Hmm. OK. Sorry I do not have a mac, so I am guessing a bit for solutions.
Perhaps next try using the previous qualcoder release the 3.4 release.
For this release you also need to install a python wordcloud module:
pip3 install wordcloud

Would using the previous version work. If not then maybe try installing the noto sans font? it is only a guess: https://fonts.google.com/noto/specimen/Noto+Sans

The next possibility is in lines 1622 to 1624:
Line 1622 to 1624 in theQualCoder 3.5 __main__.py file is this:

    project_path = QtWidgets.QFileDialog.getSaveFileName(self,
                                                         \_("Enter project name"), self.app.settings['directory'],
                                                         options=QtWidgets.QFileDialog.Option.DontUseNativeDialog)

I would suggest if nothing else works to change the code to this:
project_path = QtWidgets.QFileDialog.getSaveFileName(self,
_("Enter project name"), self.app.settings['directory'])

As not using the native dialog could be a cause of problems on macOS. If this last option does fix the problem then it would have to be replicated in other code spots also.

Im sorry I cannot give an easy fix as I am not sure how to fix this.

@bfisseler
Copy link
Author

bfisseler commented Jan 10, 2024

Okay, I tried to track this error down. And obviously, it is an issue with QtWidgets or PyQt. I searched for segmentation error QtWidgetsand found this post Riverbank Computings message board. Thus I commented out the line options=QtWidgets.QFileDialog.Option.DontUseNativeDialog and - to my astonishment - the app does not crash anymore when I try to create a new project.
As this probably is not the ultimate solution, I want to ask you:

  • Would QualCoder work with another (newer?) version of PyQt?
  • Can you imagine any side effects of commenting out all other occurances of this option in the source code?

Edit: The file requirements.txt says that version 6.5.2 of PyQt6 is needed. But obviously version 6.6.1 is installed in the pyenv. Hmm.

@bfisseler
Copy link
Author

bfisseler commented Jan 10, 2024

I'm sorry, but I continously running into problems. When I try to add files, an additional error shows up. Maybe the current version of PyQt6 does not work properly with macOS 14?

@ccbogel
Copy link
Owner

ccbogel commented Jan 10, 2024

Hi, well I am glad that changing that line helped. I put that option in because it would not run on some Linux ubuntu Os's without that option.
Would QualCoder work with another (newer?) version of PyQt? - I expect it would - but for these quirky errors I do not know.
Can you imagine any side effects of commenting out all other occurrences of this option in the source code? - No side effects. It would only affect other operating systems such as some in the Linux world where not hating that option caused problems.

When adding files and it is crashing, I believe the exact same issue is arising.

I can update the latest source code soon to work around this - so instead of using 3.5 download and use the latest. I will update you when this is done.

Regard the requirements text file - I have updated this to show the modules required and not to be specific with the versions. It implies the latest modules.

ccbogel added a commit that referenced this issue Jan 10, 2024
Fix for issue #879

Removed:  options=QtWidgets.QFileDialog.Option.DontUseNativeDialog)

As this causes a python segmentation fault on macOS:
OS: macOS 14.2.1
Version: Python 3.11.7
@ccbogel
Copy link
Owner

ccbogel commented Jan 10, 2024

OK I have implemented that code fix in the latest code (download with the green Code button).

@arjuna-dev
Copy link

I am facing the same issue in macOS 13.6.3.

Indeed the initial problem is solved in the current master branch. Nevertheless the problem where the program crashes when trying to add files remains. The problem is also there in version 3.4 so downgrading doesn't help.

Terminal output:

$ python3 qualcoder/__main__.py qt.qpa.fonts: Populating font family aliases took 120 ms. Replace uses of missing font family "Noto Sans" with one that exists to avoid this cost. The cached device pixel ratio value was stale on window expose. Please file a QTBUG which explains how to reproduce. zsh: segmentation fault python3 qualcoder/__main__.py

Environment :

  • Python 3.9.13
  • macOS 13.6.3
  • QualCoder-3.4
  • QualCoder-3.5

@bfisseler
Copy link
Author

I finally managed to get QualCoder 3.5 working on another Apple machine. I assume that my initial approach using pyenv to create a virtual environment is not working properly with pyQT, so I switched to using venv instead.
As macOS is somewhere based on UNIX/Linux, I followed the installation steps for Debian/Ubuntu Linux. USing Homebrew instead of apt, I followed steps 1-7. Then I was able to run QualCoder as mentioned in step 6 of the macOS installation procedure. I also did not install QualCoder to /Applications, but in a folder on my desktop. This might also make a difference. Installing Noto Sans helps improve the GUI appearance, but is not essential to this.
After this, I was able add documents to a fresh created project. Everything worked fine. Only when selecting "Settings" from the menu QualCoder crashed.

@arjuna-dev
Copy link

It didn't work for me, no idea what I'm doing wrong... I'm using venv, tried python 3.9 and 3.10

@ccbogel
Copy link
Owner

ccbogel commented Jan 13, 2024

hmm. when it crashes I need more info to try and fix it.
I have had a few issues with macOS over the years. I am wondering if maybe its better not to state that QualCoder runs on macOS and only focus on Windows and some linuxes.

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