ccbogel / QualCoder

Qualitative data analysis for text, images, audio, video. Cross platform. Python 3.10 or newer and PyQt6.
https://qualcoder.wordpress.com/
MIT License
360 stars 84 forks source link

Failed to convert Py module to executable #933

Open seelebrn opened 1 week ago

seelebrn commented 1 week ago

Describe the bug :

When trying to run python setup.py py2exe (using the setup.py file included in the code .zip pulled from github), the app is built, but running it results in this kind of error log : Traceback (most recent call last): File "main.py", line 49, in File "zipextimporter.pyc", line 150, in create_module ImportError: MemoryLoadLibrary failed loading PyQt6\QtCore.pyd: Le module spécifié est introuvable. (126) Traceback (most recent call last): File "main.py", line 49, in File "zipextimporter.pyc", line 150, in create_module ImportError: MemoryLoadLibrary failed loading PyQt6\QtCore.pyd: Le module spécifié est introuvable. (126) Traceback (most recent call last): File "main.py", line 49, in File "", line 15, in File "", line 13, in load ImportError: (No module named 'PyQt6.sip') 'C:\Users\needa\Downloads\QualCoder-master\dist\PyQt6.QtCore.pyd' Traceback (most recent call last): File "main.py", line 49, in File "", line 15, in File "", line 13, in load ImportError: (DLL load failed while importing QtCore: Le module spécifié est introuvable.) 'C:\Users\needa\Downloads\QualCoder-master\dist\PyQt6.QtCore.pyd' Traceback (most recent call last): File "main.py", line 49, in File "zipextimporter.pyc", line 150, in create_module ImportError: MemoryLoadLibrary failed loading PyQt6\QtCore.pyd: Le module spécifié est introuvable. (126) [etc.]

Additional bit of info : the created app is named main.exe and with no icons. I feel it shouldn't be that way, so something may be wrong here.

Edit : Failed to mention that running the py module with "python -m qualcoder" works flawlessly.

To Reproduce :
Described above. It's very possible it shouldn't be how I try to convert the module to an exe. In which case, I'm very sorry.

Expected behavior :
Well, I suppose using either the python setup.py py2exe (or a more correct way to do it), the .exe should be working ?

Screenshots :
If applicable, add screenshots that helps to explain your problem.

Desktop (please complete the following information):

Additional context :
Maybe it should be useful to include a few steps to exe-ify the module ? I'm trying to rebuild it this way because I added a few QoL tweaks for my specific use case.

Thanks in advance and sorry if I'm just being noob.

ccbogel commented 1 week ago

Hi. I am glad you can use QualCoder for your needs. And that you can edit the code to suit your special QoL needs.

On Windows 10 or 11:

To make an exe from source code: Ignore the setup.py Without using a virtual environment - No venv

1 Download the QualCoder-master zip (This is the latest code, or you can download the 3.5 source code from the releases) Edit the files you need to edit for your QoL.

2 Unzip

3 py -m pip install --upgrade pip (OR replace py with python3 - some Windows need this instead) python3 -m pip install --upgrade pip

4 Install these modules - pyinstaller is the important one to create the exe py -m pip install wheel pyqt6 chardet ebooklib openpyxl Pillow ply pdfminer.six pandas plotly pydub python-vlc rispy SpeechRecognition pyinstaller

5 cd to the QualCoder-master folder

6 Run this command from the above folder, to create an exe. It takes about 10 minutes pyinstaller -w -n "QualCoder-3.6" --onefile qualcoder/__main__.py

7 The exe will be in another folder called Dist

8 Open Dist Folder - and Double-click the exe to run

seelebrn commented 1 week ago

Thank you very much, worked like a charm !

ccbogel commented 1 week ago

I'm pleased. If some of the QoL tweaks would improve QualCoder - please let me know.

seelebrn commented 4 days ago

Ty so much ! I didn't really dare to make a pull request since I'm basically an amateur coder, but if you find some ideas interesting I made a specific fork for my attempts at adding a few QoL tweaks, namely :

-Making columns resizeable in the code_text widget (since we're working with quite lengthy code labels here) -Making it possible to bulk rename files in manage_files, incrementing from a user defined {base_name}, so that if the user enters "Interview", the files will be renamed to : Interview_001 Interview_002, etc.

This second tweak was to answer a specific situation with more than a hundred files and to make life easier for a student.

If you think it'd be interesting to do a PR even with my.. err.. bad coding skills, I'll gladly do it. But if you want to take things for the fork, refine them and include them in the base version, I'll be super happy too (and maybe less ashamed !).

Best regards,