Pyinstaller not compiling joblib - pyinstaller

I've got code that loads a joblib file and works perfectly in my IDE. However when making an exe with pyinstaller it fails. This is some test code:
from joblib import load
print('imported joblib')
load('Repeat.joblib')
When running the exe it successfully imports load, but fails when reading the joblib file. The joblib file is a machine learning model build using scikit learn 0.22.1 and I have joblib 0.14.1.
I've tried everything I can think of. Pyinstaller initially failed with a recursion error but I fixed that using a spec file using
import sys
sys.setrecursionlimit(5000)
Any help?

A, I did find this post about people rolling back Joblib to v0.11 with some success. However that doesn't appear to have resolved your issue.
IT might be an issue with PyInstaller. The key might lie in your `hiddenimports'.
Bounty Source solution

Related

PyInstaller EXE not executing

I have created an executable file from .py using PyInstaller. My python file contains the packages PySAM, pandas and os. Although the executable has been created successfully, while running it aborts before/while importing the packages and closes. I believe this is due to the PySAM package. I am looking for a solution such that the executable runs the entire code
Thanks in advance!

Colab Jupyter notebook doesn't recognize functions after correct module import of fastai.vision

I worked quite a while on my .ipynb file on Colab. I'm working with fastai(v.2), yesterday I unintentionally tried to use open_image function from fastai(v.1), which wasn't recognized - no surprise. After restarting the runtime I got NameErrors on every fastai(also v2) function used in the whole code.
To fix this I:
restarted runtime
closed all running sessions
imported every module by name although the import functions worked fine before
restarted computer
tried on a different computer
started a new notebook
Once in a while it works on another notebook, but as soon as I run the original one I get the Name errors on every notebook I use.
Minimal code I used to reproduce the error myself is here. But since I guess it's a bug of my colab it'll be hard to reproduce. Anyway if somebody has got an idea let me know!
!pip install -Uqq fastai
from fastai.vision.all import *
from scipy.io import loadmat
print(fastai.__version__)
my_batch_tfms = aug_transforms(size=224)
Change your code here
from fastai.vision import *
To
from fastai.vision.all import *
Seems to be a Colab bug which is Accound bound. I started the exact same code with another Google Account in Colab and everything worked perfectly fine!

How to import pyFirmata correctly?

I'm working on a project that involves experimenting with Arduino Mega and I'm learning about it from this book https://books.google.co.uk/books/about/Python_Programming_for_Arduino.html?id=O0PfBgAAQBAJ&printsec=frontcover&source=kp_read_button&redir_esc=y#v=onepage&q&f=false
I'm in a stage where I need to import pyfirmata library but for whatever reason it keeps throwing an import error.
I installed the library using pip3 and when that didn't help I built it from source therefore I'm quite confident that I've got it in my system. I even got a file path where it is installed. Within my Python site-packages directory.
The book is favouring Python 2.7 but I figured I can make this work in Python 3 as well. I tried import pyfirmata, from pyfirmata import Arduino and in both cases I get import error.
It shouldn't be that hard to get this to work. What should I try ?
#!/usr/bin/python
# Import required libraries
import pyfirmata
from time import sleep
I also tried replacing the first line with the exact file path of the directory but no effect.
you did everything needed with python but you also need to open Arduino IDE and press files, examples, Firmata, StandardFirmata then transfer the code to your board. Your board will now easily communicate with Python through the module Pyfirmata.

PyQt5 translation: is it possible to run pylupdate5 from Python?

I have some PyQt5 application with some tr() translations in it. I have a Python script that compiles UI forms and resources, and I want it to also update the ts file with translations, because it's a bit annoying to run pylupdate manually each time.
Alas, I haven't find any information, how to run the Python functions that provide translation file compilation in PyQt5. Haven't you ever got the same problem?
I was able to do it like this
import os
ret = os.system("E:\Anaconda3\Library\\bin\\pylupdate5.exe -verbose Main.py otherfile.py thirdfile.py -ts zh_CN.ts")
Hopefully you found it as well

How to resolve No or missing module errors when converting to an executable using pyinstaller -Python

I am attempting to convert a python file to an executable file. Easy enough right?
I used pyinstaller on a simple program that doesn't import anything. It worked like a charm. Then, I tried it with another dummy program with imported modules, (PyQt4, sys, matplotlib) that my actual program would have. Here I encountered problems.
This error appeared when I ran the application in the 'dist' folder pyinstaller created.
Fatal Python error: Py_Initialize: unable to load the file system codec
ImportError: No module named 'encodings'
I found another site with a possible solution to this problem, but his situation wasn't exactly the same: http://code.activestate.com/lists/python-dev/118463/
This lead me to trying the QT designer that I downloaded earlier. Perhaps if I could convert the .ui file it produced into a .py file, I would be fine. I could use his solution and all would be well.
That's when I got this error:
File "C:\Anaconda3\Lib\site-packages\PyQt4\uic\pyuic.py", line 26, in module
from PyQt4 import QtCore
mportError: No module named 'PyQt4'
I should also probably mention that all the modules I have are through Anaconda 3
I thought installing pyqt in a conda... project? Would fix the problem. It didn't. To be honest I don't entirely know what those are for.
Now I'm entertaining the idea of just using the c++ files that QT designer makes instead of converting them and importing python to tell the gui what to do.
What do you guys think would solve the errors above?
Short solution / workaround:
In your python file import the missing module explicitly. In your case: import encodings.
Proper solution:
By importing every module separately so you might end up imorting many modules and submodules. In this case you need tell pyinstaller where to find the modules (e. g. using compile flags).

Resources