pyinstaller-ModuleNotFoundError, How to incl module which added manually by __init__.py in pyinstaller - pyqt5

I have my_ui.py and resources_rc.py are automatically generated from a QT GUI designer.
I can run my_ui.py using python my_ui.py.
This is my-module structure
\my-module
\__init__.py
\my_ui.py
\resouces_rc.py
Content of init.py. resource_rc will be imported and later used inside my_ui.py
from my-module import resources_rc
sys.modules['resource_rc'] = resources_rc
pyinstaller command:
pyinstaller --paths=resources_rc.py myui.py --onefile
I got an error message when running ./dist/my_ui
ModuleNotFoundError: No module named 'resources_rc'
I have tried to run pyinstalled outside my-module directory and still i get this error message.
Any idea how to solve this problem? Many thanks.

Related

Import does not function as bat file; but works in spyder

I am still not the most sophisticated python user; but I cannot overcome this probably simple problem. I have a code that works perfectly with the spyder interface. I would like to make it a recurring task via creating a bat file. The bat file which in turn triggers a cmd interface does not import pandas_data reader and the code gets stuck and aborts.
import pandas_datareader.data as web
this line above creates the error below. It's a lengthy text.
File "C:\Users\myself\anaconda3\lib\site-packages\pandas_datareader\__init__.py", line 2, in <module>
from .data import ( File "C:\Users\myself\anaconda3\lib\site-packages\pandas_datareader\data.py", line 9, in <module>
from pandas.util._decorators import deprecate_kwarg File "C:\Users\myself\anaconda3\lib\site-packages\pandas\__init__.py", line 17, in <module>
"Unable to import required dependencies:\n" + "\n".join(missing_dependencies) ImportError: Unable to import required dependencies: numpy:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy c-extensions failed.
- Try uninstalling and reinstalling numpy.
- If you have already done that, then:
1. Check that you expected to use Python3.7 from "C:\Users\myself\anaconda3\python.exe",
and that you have no directories in your PATH or PYTHONPATH that can
interfere with the Python and numpy version "1.17.0" you're trying to use.
2. If (1) looks fine, you can open a new issue at
https://github.com/numpy/numpy/issues. Please include details on:
- how you installed Python
- how you installed numpy
- your operating system
- whether or not you have multiple versions of Python installed
- if you built from source, your compiler versions and ideally a build log
- If you're working with a numpy git repository, try `git clean -xdf`
(removes all files not under version control) and rebuild numpy.
Note: this error has many possible causes, so please don't comment on
an existing issue about this - open a new one instead.
Original error was: DLL load failed: The specified module could not be found.

Why I am getting error as "ImportError: No module named pyPdf" even after installing PyPdf3

I am trying to customize a module in Odoo 10. And I have created a addon path for the new module but I have no good right!
I am getting error "ImportError: No module named pyPdf". Since I am beginner on coding industry I find difficult to sort out this issue. Can anyone help me to sort out this issue?
Python3 support was introduced in Odoo 11, IIRC. So just try to install pyPdf for Python2.
This is usually a path problem. You should check that the directory containing pyPDF is on the Python path.
> # Print a list with the directories in the Python path
> import sys
> sys.path
Note: If you are running Odoo under a python virtual environment activate it first.
Try to run using python2
Try this on the terminal,
python2 path_to_odoo_folder/./odoo-bin

No module named lstm_predictor

When I am trying to import the following module,
>>> from lstm_predictor import lstm_model
The error says no module named lstm_predictor.
How can I solve the problem?
It seems like you are utilizing the lstm_predictor package present in https://github.com/tgjeon/TensorFlow-Tutorials-for-Time-Series.
Since this is not a standard module, make sure you have cloned this project and you have the lstm_predictor.py file in the same folder as your python terminal.

Installing Torch Extension fb-caffe-exts from github

I am trying to install the fb-caffe-exts extension for Torch from Github fb-caffe-exts, specifically I am trying to use torch2caffe.
I am trying to run the test.lua demo for torch2caffe, but I am getting the following error, which refers to a line in the test.lua file:
t2c.run(opts, module) --attempt to call field 'run' (a nil value)
All the tests fail, with the stack trace referring to this error. I have installed the dependencies (fb.lualib etc) and added the lua packages to my path. Fb.python and the other dependencies import without producing errors.
Any help appreciated.

Kivy: PyInstaller not including Kivy modules upon compiling spec file

I've been following Creating Packages for Mac OS from Kivy.org in order to try and create a .app for my Kivy .py file.
However, despite following the guide through, my App never works, it crashes instantly upon opening. Pyinstaller's warning's concerning the build were dumped in a .txt that contained the following:
W: no module named kivy.graphics.ClearBuffers (top-level import by kivy.uix.screenmanager)
W: no module named kivy.core.spelling.SpellingBase (top-level import by kivy.core.spelling.spelling_enchant)
W: no module named kivy.core.image.ImageLoader (top-level import by kivy.core.image.img_gif)
W: no module named multiprocessing.RLock (top-level import by multiprocessing.sharedctypes)
and so on . . . (Full file is very long, but can be viewed here)
It seems like no kivy modules at all could be found, so they must have not been included for some reason. This is what I want to ask how to fix.
As of right now, I have been using the commands:
kivy pyinstaller.py myapp.py
kivy pyinstaller.py myapp.spec
respectively to create both the spec file and the App.
The spec file doesn't seem to have anything missing. (I've included the hooks and checked with a working spec file I used to create an .exe in the past)
# -*- mode: python -*-
# -*- coding: utf-8 -*-
from kivy.tools.packaging.pyinstaller_hooks import install_hooks
install_hooks(globals())
a = Analysis(['Meep/Meep.py'],
pathex=['/Users/Owatch/Documents/pyinstaller/Meep'],
hiddenimports=[],
runtime_hooks=None)
pyz = PYZ(a.pure)
exe = EXE(pyz,
a.scripts,
exclude_binaries=True,
name='Meep',
debug=False,
strip=None,
upx=True,
console=False , icon='Meep/icon.icns')
coll = COLLECT(exe,Tree('/Users/Owatch/Desktop/examples/demo/touchtracer/'),
a.binaries,
a.zipfiles,
a.datas,
strip=None,
upx=True,
name='Meep')
Anyways, I'm not sure why this is occuring. My suspicions are mostly around the following:
1: I downloaded pyinstaller as a .zip since I could not find the .py file on my system. This is despite having it installed via pip on what I believe to be a separate python installation (I have 2.7 separately)
2: My reference to touchtracer is somehow wrong, it is linked to the touchtracer directory that came bundled in the dmg for Kivy. (A folder named Examples, which I dragged to my desktop)
Other than that, I'm afraid I'm pretty clueless. Thanks for helping (If you can!)
It appears that the error was associated with a flawed spec file. Nothing else to report.