pyinstaller import error, no image found - macos

I'm trying to make an application for a mac. When I use pyinstaller to make an exe on a windows machine, it works fine, but when I do it on a mac, the file complies, but then when executed I get the following errors.
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PyInstaller/loader/pyi_importers.py", line 270, in load_module
exec(bytecode, module.__dict__)
File "/Library/Frameworks/Python.framework/Versions/2.7/bin/build/new_client/out00-PYZ.pyz/FileDialog", line 11, in <module>
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PyInstaller/loader/pyi_importers.py", line 270, in load_module
exec(bytecode, module.__dict__)
File "/Library/Frameworks/Python.framework/Versions/2.7/bin/build/new_client/out00-PYZ.pyz/Tkinter", line 39, in <module>
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PyInstaller/loader/pyi_importers.py", line 409, in load_module
module = imp.load_module(fullname, fp, filename, self._c_ext_tuple)
ImportError: dlopen(/var/folders/vb/vb9xryxdEz467ZADn0LL7U+++TI/-Tmp-/_MEIbvFCo2/_tkinter.so, 2): Library not loaded: #loader_path/Tcl
Referenced from: /var/folders/vb/vb9xryxdEz467ZADn0LL7U+++TI/-Tmp-/_MEIbvFCo2/_tkinter.so
Reason: image not found
It appears to be something wrong with Tkinter and TCL. Here are the modules that are loaded by the program.
import socket, thread, time, json, traceback, FileDialog
from functools import partial
from mtTkinter import *

I was using openpyxl and it required jdcal in the datetime.py module. None of the hidden imports or any of those pyinstaller work-arounds helped, running the exe would still say jdcal not found. The work-around that I used was to just copy the few functions from jdcal directly into the datetime.py in the openpyxl code. Then ran pyinstaller -F program.py
and it worked! Not the best answer, but when you are trying to get a project out the door for a client, it works.

Related

cannot compile wammu on opensuse-15.3

Successfully compiled from source gammu-1.42.0.
Despite a missing a final sudo ldconfig it worked as described.
Now I want to compile wammu-0.44.
I maually installed wxPython
then
python setup.py build
sudo python setup.py install
However, running wammu ends up in searching for missing modules.
First it does not find /usr/share/Wammu/images - copied it maually from the source directory /usr/local/src/wammu-0.44/images to /usr/share/Wammu
MT1:~ # wammu
Failed to load translation!
Traceback (most recent call last):
File "/usr/local/bin/wammu", line 4, in <module>
__import__('pkg_resources').run_script('wammu==0.44', 'wammu')
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 661, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1441, in run_script
exec(code, namespace, namespace)
File "/usr/local/lib/python2.7/site-packages/wammu-0.44-py2.7.egg/EGG-INFO/scripts/wammu", line 199, in <module>
import Wammu.App
File "/usr/local/lib/python2.7/site-packages/wammu-0.44-py2.7.egg/Wammu/App.py", line 29, in <module>
import Wammu.Main
File "/usr/local/lib/python2.7/site-packages/wammu-0.44-py2.7.egg/Wammu/Main.py", line 57, in <module>
import Wammu.Editor
File "/usr/local/lib/python2.7/site-packages/wammu-0.44-py2.7.egg/Wammu/Editor.py", line 28, in <module>
from wx import DateTimeFromDMY, DateTime_Today
ImportError: cannot import name DateTime_Today
MT1:~ #
Being only an experienced c/c++ developer I would very much appreciate a comprehensive install summary for a non python expert :-).
Tanks for reading and comments.

Unable to run anaconda neither anaconda-prompt on Windows

I have a following problem. I am not able to run anaconda navigator, neither anaconda-prompt after anaconda3 installation.
Nothing happens when I click on anaconda-navigator.exe as saved in C:\Users\misak\anaconda3\Scripts. When I check environmental variables paths I have there C:\Users\misak\anaconda3\Scripts.
When I try to run anaconda navigator from cmd I get this error:
C:\Users\misak>anaconda-navigator
Traceback (most recent call last):
File "C:\Users\misak\anaconda3\lib\site-packages\qtpy\__init__.py", line 204, in <module>
from PySide import __version__ as PYSIDE_VERSION # analysis:ignore
ModuleNotFoundError: No module named 'PySide'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\misak\anaconda3\Scripts\anaconda-navigator-script.py", line 6, in <module>
from anaconda_navigator.app.main import main
File "C:\Users\misak\anaconda3\lib\site-packages\anaconda_navigator\app\main.py", line 22, in <module>
from anaconda_navigator.utils.conda import is_conda_available
File "C:\Users\misak\anaconda3\lib\site-packages\anaconda_navigator\utils\__init__.py", line 15, in <module>
from qtpy.QtGui import QIcon
File "C:\Users\misak\anaconda3\lib\site-packages\qtpy\__init__.py", line 210, in <module>
raise PythonQtError('No Qt bindings could be found')
qtpy.PythonQtError: No Qt bindings could be found
I tried to reinstall Anaconda many times, co the problem seems to be somewhere else. Can you help my please?

No module named 'tokenize'

Trouble with anaconda:
Error message below.
Reason why I think this is happening:
Accidentally deleted some files
I tried to uninstall Anaconda, and reinstall, however, when reinstalling - installer says Anaconda already installed, hence, not able to get Anaconda working.
Scanned through the net and stackoverflow, but unable to find an answer. Error message below:
"
Traceback (most recent call last):
File "/miniconda3/bin/conda", line 13, in <module>
sys.exit(main())
File "/miniconda3/lib/python3.7/site-packages/conda/cli/main.py", line 149, in main
from ..exceptions import conda_exception_handler
File "/miniconda3/lib/python3.7/site-packages/conda/exceptions.py", line 10, in <module>
from logging import getLogger
File "/miniconda3/lib/python3.7/logging/__init__.py", line 26, in <module>
import sys, os, time, io, traceback, warnings, weakref, collections.abc
File "/miniconda3/lib/python3.7/traceback.py", line 5, in <module>
import linecache
File "/miniconda3/lib/python3.7/linecache.py", line 11, in <module>
import tokenize
ModuleNotFoundError: No module named 'tokenize' "

Theano error after pip install

I have been trying to get Theano as backend for Keras on my 32-bit Windows 10. I have installed a bunch of different things, such as CUDA and Python 3.5 (I have 3.6.5 as my default) and even installed with Anaconda. The Anaconda download wasn't there when I used pip freeze in my terminal, and my code didn't recognize it after the conda install, so I simply pip installed Theano, which always gives me this error when I run it. I normally use Atom, not Anaconda, so I'm not sure if a conda install doesn't work for Atom. I am also unsure of how to switch my code in Atom to Python 3.5, as I know Theano only works up to 3.5, or if it's even necessary. I had previously installed my g++ gcc compiler through MinGW, which I have a suspicion might be the culprit for this error as well, as similar errors on StackOverflow questions had to do with this. The error is listed below. This has been a nightmare installation process, so I apologize for all the info about everything I've been doing. Help would be much appreciated.
Also, when I import Keras in my terminal with python 3.5, it says there is no such module.
Something is horribly wrong.
The error:
Using Theano backend.
You can find the C code in this temporary file: C:\Users\AARONM~1\AppData\Local\Temp\theano_compilation_error_9whx6ow7
Traceback (most recent call last):
File "C:\Users\Aaron Mazie\AppData\Local\Programs\Python\Python36-32\lib\site-packages\theano\gof\lazylinker_c.py", line 75, in <module>
raise ImportError()
ImportError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Aaron Mazie\AppData\Local\Programs\Python\Python36-32\lib\site-packages\theano\gof\lazylinker_c.py", line 92, in <module>
raise ImportError()
ImportError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Aaron Mazie\Desktop\tradingbots\testntrain6.py", line 11, in <module>
from keras.layers.core import Dense, Activation, Dropout
File "C:\Users\Aaron Mazie\AppData\Local\Programs\Python\Python36-32\lib\site-packages\keras\__init__.py", line 3, in <module>
from . import utils
File "C:\Users\Aaron Mazie\AppData\Local\Programs\Python\Python36-32\lib\site-packages\keras\utils\__init__.py", line 6, in <module>
from . import conv_utils
File "C:\Users\Aaron Mazie\AppData\Local\Programs\Python\Python36-32\lib\site-packages\keras\utils\conv_utils.py", line 9, in <module>
from .. import backend as K
File "C:\Users\Aaron Mazie\AppData\Local\Programs\Python\Python36-32\lib\site-packages\keras\backend\__init__.py", line 81, in <module>
from .theano_backend import *
File "C:\Users\Aaron Mazie\AppData\Local\Programs\Python\Python36-32\lib\site-packages\keras\backend\theano_backend.py", line 7, in <module>
import theano
File "C:\Users\Aaron Mazie\AppData\Local\Programs\Python\Python36-32\lib\site-packages\theano\__init__.py", line 110, in <module>
from theano.compile import (
File "C:\Users\Aaron Mazie\AppData\Local\Programs\Python\Python36-32\lib\site-packages\theano\compile\__init__.py", line 12, in <module>
from theano.compile.mode import *
File "C:\Users\Aaron Mazie\AppData\Local\Programs\Python\Python36-32\lib\site-packages\theano\compile\mode.py", line 11, in <module>
import theano.gof.vm
File "C:\Users\Aaron Mazie\AppData\Local\Programs\Python\Python36-32\lib\site-packages\theano\gof\vm.py", line 673, in <module>
from . import lazylinker_c
File "C:\Users\Aaron Mazie\AppData\Local\Programs\Python\Python36-32\lib\site-packages\theano\gof\lazylinker_c.py", line 127, in <module>
preargs=args)
File "C:\Users\Aaron Mazie\AppData\Local\Programs\Python\Python36-32\lib\site-packages\theano\gof\cmodule.py", line 2359, in compile_str
(status, compile_stderr.replace('\n', '. ')))
Exception: Compilation failed (return status=1): In file included from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\math.h:36:0,
. from C:\Users\Aaron Mazie\AppData\Local\Programs\Python\Python36-32\include/pyport.h:194,
. from C:\Users\Aaron Mazie\AppData\Local\Programs\Python\Python36-32\include/Python.h:53,
. from C:\Users\Aaron Mazie\AppData\Local\Theano\compiledir_Windows-10-10.0.16299-SP0-Intel64_Family_6_Model_142_Stepping_9_GenuineIntel-3.6.5-32\lazylinker_ext\mod.cpp:1:
. c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\cmath:1157:11: error: '::hypot' has not been declared
. using ::hypot;
. ^~~~~
.
For anyone wondering, I uninstalled everything, including the Theano cache files manually, and watched this vid: https://www.youtube.com/watch?v=J70j6q7aOi4&t=131s&index=1&list=LLwpbw2KREgJdXEC0gLRTy4g

Error importing tensorflow because of wrong architecture

I am attempting to install TensorFlow on my Mac ( OSX El Capitan 10.11.2) following the instructions listed here
I used pip to install tensorflow for Python3 and it appears that everything installed successfully.
But when I go to test it, I am greeted with this error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/tensorflow/__init__.py", line 23, in <module>
from tensorflow.python import *
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/tensorflow/python/__init__.py", line 45, in <module>
from tensorflow.python import pywrap_tensorflow
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/tensorflow/python/pywrap_tensorflow.py", line 28, in <module>
_pywrap_tensorflow = swig_import_helper()
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/tensorflow/python/pywrap_tensorflow.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow', fp, pathname, description)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/tensorflow/python/_pywrap_tensorflow.so, 10): no suitable image found. Did find:
/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/tensorflow/python/_pywrap_tensorflow.so: mach-o, but wrong architecture
This error is not listed on the common problems and I couldn't find anything conclusive on my own.
Update:
#mrry Alrighty, import sys; print(sys.maxsize) is returning 2147483647 so python is running in 32bit mode.

Resources