I am using
pyarmor pack --clean -e "--onefile" main.py
After Running the Compiled .py file I get the following error:
Traceback (most recent call last):
File "<dist \obf\ Builder19948 .py>", line 3, in <module>
File "<frozen Builder19948> ", line 7, in <module
ModuleNotFoundError: No module named 'keyboard"
[12560] Failed to execute script *Builder19948 due to unhandled exception!
I have imported keyboard module in my code, so how can I Fix this?
thanks in advance
Related
I am using windows and would like to use the curses package,I installed it with the command:
pip install windows-curses
but when I try to import curses
it gives an eror from the python source file
__init__.py
here's the eror:
C:\Users\user\PycharmProjects\snake\venv\Scripts\python.exe C:/Users/user/AppData/Local/Programs/Python/Python39/Lib/curses/__init__.py
Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Programs\Python\Python39\Lib\curses\__init__.py", line 12, in <module>
from _curses import *
ModuleNotFoundError: No module named '_curses'
Can someone please help me fix it?
Consider this python test file main.py
# main.py
from paraview.simple import *
def paraTest():
Cone()
SetProperties(Resolution=32)
Shrink()
Show()
Render()
if __name__ == '__main__':
paraTest()
that depends on paraview package installed from Anaconda using
conda install -c conda-forge paraview
according to
https://anaconda.org/conda-forge/paraview.
The program works as expected when directly run with python.
The Problem
When I package it using pyinstaller with the Terminal command
pyinstaller main.py, and then run the executable, I get the following error:
Traceback (most recent call last):
File "paraview/__init__.py", line 161, in <module>
ImportError: Failed to load vtkRemotingCore: No module named paraview.modules.vtkPVVTKExtensionsCore
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "main.py", line 1, in <module>
from paraview.simple import *
File "PyInstaller/loader/pyimod03_importers.py", line 546, in exec_module
File "paraview/__init__.py", line 163, in <module>
ModuleNotFoundError: No module named '_paraview_modules_static'
[14370] Failed to execute script 'main' due to unhandled exception!
My Attempts
I understand there may be some modules not recognized and included by pyinstaller, so I copied all module files from {miniconda_root}/miniconda3/lib/python3.9/site-packages/paraview/modules to my package {MyPackage_root}/dist/main/paraview/modules, but the same error persists.
Environment info
MacOS 11.2 (Big Sur)
python==3.9
paraview==5.9.1
pyinstaller==4.4
Thanks in advance!
Am using python 2.7 and got error like "ImportError: No module named _pjsua" while using "import pjsua". I refered and tried some solution but no luck on those solutions.
pjsua: unable to import pjsua python module
Traceback (most recent call last):
File "", line 1, in
File "pjsua.py", line 59, in
import _pjsua
ImportError: No module named _pjsua
I've tried compiling a Python program on my Mac, and all went well. I then moved to ubuntu, and can't even compile a hello world correctly:
I wrote the simplest hello world:
print("hello world")
then tried compiling it using:
pyinstaller --onefile hello.py
everything seemed to be fine, until I tried running it:
dist/hello
and got the following traceback:
[2886] mod is NULL - structTraceback (most recent call last):
File "/usr/lib/python3.6/struct.py", line 13, in <module>
from _struct import *
ModuleNotFoundError: No module named '_struct'
[2886] mod is NULL - pyimod02_archiveTraceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/PyInstaller-3.4.dev0+g5f91905-py3.6.egg/PyInstaller/loader/pyimod02_archive.py", line 28, in <module>
import struct
ModuleNotFoundError: No module named 'struct'
[2886] mod is NULL - pyimod03_importersTraceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/PyInstaller-3.4.dev0+g5f91905-py3.6.egg/PyInstaller/loader/pyimod03_importers.py", line 24, in <module>
from pyimod02_archive import ArchiveReadError, ZlibArchiveReader
ModuleNotFoundError: No module named 'pyimod02_archive'
Traceback (most recent call last):
File "PyInstaller-3.4.dev0+g5f91905-py3.6.egg/PyInstaller/loader/pyiboot01_bootstrap.py", line 15, in <module>
ModuleNotFoundError: No module named 'pyimod03_importers'
[2886] Failed to execute script pyiboot01_bootstrap
It seems weird as I don't import any modules explicitly, but I followed a suggestion to add the missing modules in hello.spec under hiddenimports. so I added
hiddenimports=['_struct', 'struct', 'pyimod02_archive','pyimod03_importers']
and tried compiling with
pyinstaller --onefile hello.spec
but got the exact same error as before when I tried to run the exe file.
What am I doing wrong?
I'm using pyinstaller 3.4.dev0+g5f91905 with Python 3.6.2 on Ubuntu 16.04.3
I just created an exe from python script and when I tried to run it, it did not show up.
Then, I tried to run it from cmd and I got ImportError below:
Traceback (most recent call last):
File "tkintertest2.py", line 17, in <module>
File "Lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line
389, in load_module
File "MySQL.py", line 1, in <module>
ImportError: No module named mysql.connector
Failed to execute script tkintertest2
How to solve this? I have installed mysql.connector using both pip install and conda install.
According to the pyinstaller docs here, pyinstaller is not finding the python module, so explicitly include it like so:
pyinstaller --hidden-import mysql.connector myscript.py