Failed to execute script fbs_pyinstaller_hook - python

I'm trying to create an executable file from the my PyQt5 application. my system specs:
ubuntu 18.04
python (3.6.9)
fbs (0.8.9)
matplotlib (3.3.0)
numpy (1.19.1)
pandas (1.1.0)
I'm following fbs tutorial to build a executable file from my application. I run the application without error with fbs run command.
The fbs freeze command produce this output:
-c:12: MatplotlibDeprecationWarning:
The matplotlib.backends.backend_qt4agg backend was deprecated in Matplotlib 3.3 and will be removed two minor releases later.
Done. You can now run `target/DataVisualization/DataVisualization`. If
that doesn't work, see https://build-system.fman.io/troubleshooting.
But I'm importing version 5 of matplotlib.backends.backend_qt4agg in my code as:
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg, NavigationToolbar2QT as NavigationToolbar
when I run the executable file from
~/MyProject/target/AppName
I get this error:
./AppName
Traceback (most recent call last):
File "fbs_pyinstaller_hook.py", line 2, in <module>
File "importlib/__init__.py", line 126, in import_module
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 941, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'fbs_runtime'
[1331] Failed to execute script fbs_pyinstaller_hook
I have checked the solutions given in these links, but none of them came handy!
The most common mistake
Failed to execute script fbs_pyinstaller_hook for pyqt5 gui application
Any ideas of what to do?

I entirely gave up using FBS.. pyinstaller works very well for compiling PyQt5 code.. try using just pyinstaller and see if that works.

Related

No file found when converting a python project with NUITKA with library OWLREADY2

After I converted my python project with NUITKA and I started running the following message appeared:
Owlready2 * Warning: optimized Cython parser module 'owlready2_optimized' is not available, defaulting to slower Python implementation
Traceback (most recent call last):
File "/user/try.dist/try.py", line 1, in <module>
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "/user/try.dist/owlready2/__init__.py", line 35, in <module owlready2>
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "/user/try.dist/owlready2/reasoning.py", line 41, in <module owlready2.reasoning>
FileNotFoundError: [Errno 2] No such file or directory: '/user/try.dist/owlready2/pellet'
Indicating that after I compiled the program some files were not found.
The code that I run was python3 -m nuitka --follow-imports --enable-plugin=numpy --onefile try.py
and the code that I compiled was just simple this:
from owlready2 import *
onto = get_ontology("file:///user/ontologies/try.owl").load()
with onto:
types.new_class("Drug", (Thing,))
onto.save()
So simple there was something wrong with the library.
If anyone knows what to do it will be helpful.
Thanks in advance.
I have changed the location of the file for privacy

IDAPython with PyCharm throws: "ModuleNotFoundError: No module named '_ida_hexrays'"

I want to use PyCharm with IDAPython. I setup the Python Interpreter by adding the following path to the "Interpreter Paths":
C:\Program Files\IDA Pro 7.7\python\3
After that, it recognize the modules idaapi and idautils which is a good sign.
I wrote a simple scripts to test it:
import idaapi
import idautils
filename = idaapi.get_input_file_path()
I set a breakpoint on the filename... row and it failed with:
Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 790, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "C:\Program Files\IDA Pro 7.7\python\3\ida_hexrays.py", line 12, in <module>
import _ida_hexrays
ModuleNotFoundError: No module named '_ida_hexrays'
It doesn't recognize the modules _ida_hexrays. How can I make it work?
I see that there is a file: C:\Program Files\IDA Pro 7.7\python\3\ida_64\_ida_hexrays.pyd.
In the ida_hexrays.py it throws the error when it try to import it like that:
# Import the low-level C/C++ module
if __package__ or "." in __name__:
from . import _ida_hexrays
else:
import _ida_hexrays

ModuleNotFoundError: No module named 'PySide2' while trying to use poetry env

i'm trying to use slicereg (https://github.com/brainglobe/slicereg) for data registration.
after import code from github page and install poetry to run slicereg i keep getting the following error :
The virtual environment found in ~\.conda\envs\sliceregenv seems to be broken.
Recreating virtualenv slicereg-6kSWvOuc-py3.8 in ~\AppData\Local\pypoetry\Cache\virtualenvs\slicereg-6kSWvOuc-py3.8
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "~\.conda\envs\sliceregenv\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 843, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "~\slicereg\slicereg\main.py", line 3, in <module>
from PySide2.QtWidgets import QApplication
ModuleNotFoundError: No module named 'PySide2'
Pyside2 is already installed in my env using pip.
Any advice on how to resolve this issue ?
Thx
Seems to be an issue, poetry fails to recognize conda environments as valid
see more at https://github.com/python-poetry/poetry/issues/4566
Remain unresolved for the current release (1.1.12)
Update : https://github.com/python-poetry/poetry/issues/5907

AttributeError: module 'numpy.core' has no attribute 'numerictypes'

Strange behavior in PyCharm (2021.2.1 Professional Edition) with Python 3.9 and numpy 1.21.2.
When I run my program with "Run" then it works as expected. But when I run it with "Debug" then the following error messages appears and the program stops:
Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "C:\Python\JobAnalyzer\venv\lib\site-packages\numpy\__init__.py", line 200, in <module>
core.numerictypes.typeDict,
AttributeError: module 'numpy.core' has no attribute 'numerictypes'
python-BaseException
Any hints what could be the cause?
It crashes immediately at the following line:
import matplotlib.pyplot as plt
And in numpy at this line:
# Numpy 1.20.0, 2020-10-19
__deprecated_attrs__["typeDict"] = (
core.numerictypes.typeDict, <--- CRASH HERE
"`np.typeDict` is a deprecated alias for `np.sctypeDict`."
)
The bug is documented here, it is related to PySide2, which is used by default by PyCharm for PyQt compatibility. The workaround (besides downgrading numpy) is to go to PyCharm's settings / "Build, Execution, Deployment" / "Python debugger", and there uncheck or change the value of the PyQt compatibility drop-down to something else than Auto or PySide2:

PyInstaller error "Python not installed as framework"

I am working on MacOS and I am trying to use PyInstaller to circulate a script to some non tech colleagues. The script is imaginatively called script_V1.py and runs fine.
Up to now, I have had issues with PANDAS and SCIPY but they seem to be resolved with with the command
pyinstaller --onefile --hidden-import pandas._libs.tslibs.timedeltas --hidden-import scipy._lib.messagestream script_V1.py
However, I am now getting a different error (I'll post the full error below)
RuntimeError: Python is not installed as a framework. The Mac OS X
backend will not be able to function correctly if Python is not
installed as a framework. See the Python documentation for more
information on installing Python as a framework on Mac OS X. Please
either reinstall Python as a framework, or try one of the other
backends. If you are using (Ana)Conda please install python.app and
replace the use of 'python' with 'pythonw'. See 'Working with
Matplotlib on OSX' in the Matplotlib FAQ for more information.
I have tried the solution in a similar question on Stack Exchange:
Installation Issue with matplotlib Python
But I think that is actually a different problem with import statements not working within the script itself. In my case if I run the script as a .py script it works fine. Anyway adding the suggested file did not alter the error message. Im new to this and seem to be really struggling with PyInstaller (more than with python itself) so any help much appreciated.
The full error message is (I've added line breaks for clarity)
Traceback (most recent call last):
File "script_V1.py", line 5, in <module>
import matplotlib.pyplot as plt
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
File "<frozen importlib._bootstrap>", line 1129, in _exec
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/PyInstaller/loader/pyimod03_importers.py", line 631, in exec_module
exec(bytecode, module.__dict__)
File "site-packages/matplotlib/pyplot.py", line 115, in <module>
File "site-packages/matplotlib/backends/__init__.py", line 62, in pylab_setup
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
File "<frozen importlib._bootstrap>", line 1129, in _exec
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/PyInstaller/loader/pyimod03_importers.py", line 631, in exec_module
exec(bytecode, module.__dict__)
File "site-packages/matplotlib/backends/backend_macosx.py", line 17, in <module>
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1191, in _load_unlocked
File "<frozen importlib._bootstrap>", line 1161, in _load_backward_compatible
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/PyInstaller/loader/pyimod03_importers.py", line 714, in load_module
module = loader.load_module(fullname)
RuntimeError: Python is not installed as a framework. The Mac OS X
backend will not be able to function correctly if Python is not
installed as a framework. See the Python documentation for more
information on installing Python as a framework on Mac OS X. Please
either reinstall Python as a framework, or try one of the other
backends. If you are using (Ana)Conda please install python.app and
replace the use of 'python' with 'pythonw'. See 'Working with
Matplotlib on OSX' in the Matplotlib FAQ for more information.
[2582] Failed to execute script script_V1
logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.
[Process completed]
So the way I got this to work in the end was to force Matplotlib to use WebAGG and also install the 'tornado' package (which is needed for some reason).

Categories

Resources