I made an exe to read images including gifs using pyinstaller. However, the exe can't read gif and the below error occurs. I have installed the latest version of imageio and the program works in interpreter. Could you advise? Thanks in advance.
The line raising error:
cv_gif = imageio.mimread(pic_path)
Error:
Traceback (most recent call last):
File "Image Viewer.py", line 3085, in <module>
File "Image Viewer.py", line 522, in go
File "Image Viewer.py", line 1264, in ShowANI
File "imageio\core\functions.py", line 247, in mimread
File "imageio\core\imopen.py", line 277, in imopen
ValueError: Could not find a backend to open `C:\Users\simon\Practice\testdir3\alpaca.gif`` with iomode `rI`.
Based on the extension, the following plugins might add capable backends:
pillow: pip install imageio[pillow]
GIF-PIL: pip install imageio[pillow]
I have exactly the same problem.
This might have something to do with the new feature of imageio introduced in version 2.11.0: Choose plugin based on extension and plugin lazy-import. Revert back to 2.10.5 solves the problem.
Just manually copied the folder \Lib\site-packages\imageio and replaced the imagoio folder of the exe, then it works.
Related
I'm working on a project that can use webcam to detect people's face and whether they wear mask or not, and I used a model from Kaggle.com (https://www.kaggle.com/nageshsingh/mask-and-social-distancing-detection-using-vgg19). Then, the images will be assigned to two directories ("mask_on","mask_off"). However, when I converted the Webcam.py to Webcam.exe by pyinstaller and tried to run it, errors happened like below:
Traceback (most recent call last):
File "webcam.py", line 9, in <module>
File "keras\saving\save.py", line 205, in load_model
File "keras\saving\saved_model\load.py", line 108, in load
File "tensorflow\python\saved_model\loader_impl.py", line 118, in parse_saved_model
OSError: SavedModel file does not exist at: masknet.h5\{saved_model.pbtxt|saved_model.pb}
[11056] Failed to execute script 'webcam' due to unhandled exception!
And here is my command
pyinstaller webcam.py
The directory has several .py files I am using for other purposes.
Later, I tried another command
pyinstaller --onefile webcam.py
Although the exe file was generated, when I ran it on the cmd
C:\Users\Samuel Lee\Desktop\MyPython\Face Mask Detection\dist> Webcam.exe
it had the result like the below:
[4088] Failed to extract _pywrap_tensorflow_internal.pyd: decompression resulted in return code -1!
Thanks!
Im currently working on a tensorflow project and I am getting this error.
ValueError: model_config not of type model_pb2.DetectionModel.
It happens when I'm trying to train my model. Has anyone encountered this issue before? First question asked on here so be gentle.
`Chinatowns-MacBook-Air:object_detection nathangrant$ python3 train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/ssd_mobilenet_v1_pets.config
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/_bootstrap.py:219: RuntimeWarning: compiletime version 3.5 of module 'tensorflow.python.framework.fast_tensor_util' does not match runtime version 3.7
return f(*args, **kwds)
WARNING:tensorflow:From /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tensorflow/python/platform/app.py:48: main (from __main__) is deprecated and will be removed in a future version.
Instructions for updating:
Use object_detection/model_main.py.
Traceback (most recent call last):
File "train.py", line 184, in <module>
tf.app.run()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tensorflow/python/platform/app.py", line 48, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tensorflow/python/util/deprecation.py", line 136, in new_func
return func(*args, **kwargs)
File "train.py", line 180, in main
graph_hook_fn=graph_rewriter_fn)
File "/Users/nathangrant/Downloads/models-master/research/object_detection/legacy/trainer.py", line 245, in train
detection_model = create_model_fn()
File "/Users/nathangrant/Downloads/models-master/research/object_detection/builders/model_builder.py", line 105, in build
raise ValueError('model_config not of type model_pb2.DetectionModel.')
ValueError: model_config not of type model_pb2.DetectionModel.`
Try this first,
Solution A:
Download this complete "models_shareToPublic".rar file.
Unzip/Unrar the file.
Copy all the contains of the folder to your project library directory
Run your code/program again.
Solution B:
Please open the cmd prompt in your project library directory
In my case, it is: (my_project_name\venv\Lib\site-packages)
Clone the master branch of the Tensorflow Models repository by typing the cmd command below in the cmd prompt, which is opened in the specified directory above. (might take a few minutes depending on your network speed)
git clone https://github.com/tensorflow/models.git
Move all the contents inside the models folder into the library directory stated in Step 1.
Create "*.pb2" files by following this steps
Change the import line below in model_builder.py
Change from this:
from protos import model_pb2
to this:
from object_detection.protos import model_pb2
Run your code/program again, and you will notice this same error will be disappeared.
Notes:
If it appears
ModuleNotFoundError: No module named 'object_detection'
Go to "research" folder and copy the "object_detection" folder to the directory same with "research" folder. So that it can call the library directly, if not, you have to adjust the import line in each .py file (very wasting time)
Hope it works to you too, Good Luck!
In my computer, I did these and fixed this problem:
In model_builder.py, don't use
from protos import model_pb2
use
from object_detection.protos import model_pb2
instead.
useing Pyinstaller packages a python script
Pyinstaller version 3.2
OS:Ubuntu
Traceback (most recent call last):
File "<string>", line 57, in <module>
File "<string>", line 29, in feature_extract
File "caffe/io.py", line 295, in load_image
File "skimage/io/_io.py", line 100, in imread
File "skimage/io/manage_plugins.py", line 194, in call_plugin
RuntimeError: No suitable plugin registered for imread.
You may load I/O plugins with the `skimage.io.use_plugin` command. A list of all available plugins can be found using `skimage.io.plugins()`.
file_test returned -1
I have been getting above error. Could some one please tell me how would i fix it?
The problem seems to be related to this github issue, essentially the skimage.io._plugins submodule is making life hard for Pyinstaller.
To make sure everything you need is packaged you should have a hook file that contains
from PyInstaller.utils.hooks import collect_data_files, collect_submodules
datas = collect_data_files("skimage.io._plugins")
hiddenimports = collect_submodules('skimage.io._plugins')
(or if you already have a hook file with these, extend the current datas and hiddenimports).
I am trying to use pyinstaller 2.0 to build an .exe file from a python script which uses matplotlib and numpy, but I keep failing. I tried this code from
Building python pylab/matplotlib exe using pyinstaller
as a simple reference, I get the build done for me, but when I run the exe I get the error:
Traceback (most recent call last):
File "<string>", line 12, in <module>
File "C:\Compilations\pyinstaller-2.0\PyInstaller\loader\iu.py", line 386, in
importHook
mod = _self_doimport(nm, ctx, fqname)
File "C:\Compilations\pyinstaller-2.0\PyInstaller\loader\iu.py", line 480, in
doimport
exec co in mod.__dict__
File "C:\Compilations\pyinstaller-2.0\ptest\build\pyi.win32\ptest\out00-PYZ.py
z\PIL.PpmImagePlugin", line 27, in <module>
LookupError: no codec search functions registered: can't find encoding
Is this a bug or do I need to tinker with the .spec file and link the matplotlib libraries to pyinstaller somehow? If so - can anyone show me a simple example, please?
I tried cx_Freeze before and also seem to have a problem as soon as I use a code with matplotlib.
Thanks in advance!
Edit PpmImagePlugin.py and add 'import encodings' (without the quotes) before any other imports. I had the same problem and this fixed it. Source: http://www.pyinstaller.org/ticket/651
I am new to Python and also Google App Engine, but I am stuck up with the installations of it and its compatibility. I am using mac os -x and eclipse helios and got the pyDev plugin installed but in spite of all this i am still getting errors. . .
Whenever I try to import PIL from the terminal it does not give me any errors meaning that it was installed successfully but when I use the same Import in the eclipse file. I getting the compilation error as:
"Unresolved Import"
Please help me with this
Somehow I tried to fix that, then it gives me the error saying that imaging : no matching architecture in universal wrapper
when I changed the architecture to 32 bit ti gives me this in Eclipse Log :
Traceback (most recent call last):
File "/Users/Vinay/Documents/EclispeHeliosWorkspace/helloworld/Main.py", line 7, in <module>
im.show()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PIL/Image.py", line 1483, in show
_show(self, title=title, command=command)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PIL/Image.py", line 2123, in _show
apply(_showxv, (image,), options)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PIL/Image.py", line 2127, in _showxv
apply(ImageShow.show, (image, title), options)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PIL/ImageShow.py", line 41, in show
if viewer.show(image, title=title, **options):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PIL/ImageShow.py", line 66, in show
self.show_image(image, **options)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PIL/ImageShow.py", line 85, in show_image
return self.show_file(self.save_image(image), **options)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PIL/ImageShow.py", line 81, in save_image
return image._dump(format=self.get_format(image))
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PIL/Image.py", line 488, in _dump
self.load()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PIL/ImageFile.py", line 164, in load
self.load_prepare()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PIL/ImageFile.py", line 231, in load_prepare
self.im = Image.core.new(self.mode, self.size)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PIL/Image.py", line 37, in __getattr__
raise ImportError("The _imaging C module is not installed")
ImportError: The _imaging C module is not installed
What do I do :( ?
PIL has some specific instructions for installation. Have you seen them?
Installing PIL on GAE
Download the PIL .dmg file. For example, you can download the PIL 1.1.6 .dmg file from http://pythonmac.org/packages/py25-fat/index.html.
Double-click on the installer to start the installation process.
Choose the correct directory. Finish the installation.
This is just for use in your local development environment. When you upload it'll use a GAE supplied version of PIL which means you also have to update your app.yaml file like so:
libraries:
- name: PIL
version: "1.1.7"
as detailed here.
IIRC You will want to install it "inside" your application directory itself so it can be accessed by your application locally. Not sure about that on the MAC however.
I just installed Pillow (using: sudo pip install Pillow) to get PIL in Python 2.7.6 on OS X 10.8.5 Mountain Lion.
I had the same issue in PyDev with Eclipse Kepler. To fix:
Go to:
Eclipse -> Preferences -> PyDev -> Interpreter - Python -> Libraries and click on "New Folder."
Then navigate to:
/Library/Python/2.7/site-packages
and click Open, and then Apply, then OK.
Then I quit Eclipse and restarted -- problem fixed. :)