pyinstaller and matplotlib - error while executring .exe - matplotlib

I'm building a simple program in Python that creates a bar chart. Since further I want to build a more complicated version, that will be used in other PC (where there is no python installed), I need to create a .exe. In order to create the executable, I'm using pyinstaller.
Pyinstaller seems to work without any problem and creates the executable. But, when I run it, I got the following error:
Traceback (most recent call last):
File "PyInstaller\loader\rthooks\pyi_rth_pkgres.py", line 11, in <module>
File "C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\loader\pyimod03_importers.py", line 389, in load_module exec(bytecode, module.__dict__)
File "pkg_resources\__init__.py", line 68, in <module>
File "pkg_resources\extern\__init__.py", line 60, in load_module
ImportError: The 'packaging' package is required; normally this is bundled with this package so if you get this warning, consult the packager of your distribution.Failed to execute script pyi_rth_pkgres
Do you guys have any idea how to solve it?
Here the sourcecode:
import matplotlib.pyplot as plt
A = [5., 30., 45., 22.]
B = [5., 25., 50., 20.]
X = range(4)
plt.bar(X, A, color = 'b')
plt.bar(X,B, color = 'r', bottom = A)
plt.show()
and here the output log of pyinstaller:
223 INFO: PyInstaller: 3.2
223 INFO: Python: 3.5.2
223 INFO: Platform: Windows-7-6.1.7601-SP1
226 INFO: wrote C:\Users\310251823\PycharmProjects\Prove1\Prova.spec
243 INFO: UPX is not available.
251 INFO: Extending PYTHONPATH with paths
['C:\\Users\\310251823\\PycharmProjects\\Prove1',
'C:\\Users\\310251823\\PycharmProjects\\Prove1']
251 INFO: checking Analysis
252 INFO: Building Analysis because out00-Analysis.toc is non existent
252 INFO: Initializing module dependency graph...
255 INFO: Initializing module graph hooks...
256 INFO: Analyzing base_library.zip ...
4572 INFO: running Analysis out00-Analysis.toc
4646 WARNING: Can not get binary dependencies for file: C:\Users\310251823\AppData\Local\Continuum\Anaconda3\api-ms-win-crt-stdio-l1-1-0.dll
Traceback (most recent call last):
File "C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\depend\bindepend.py", line 695, in getImports
return _getImports_pe(pth)
File "C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\depend\bindepend.py", line 122, in _getImports_pe
dll, _ = sym.forwarder.split('.')
TypeError: a bytes-like object is required, not 'str'
4652 WARNING: Can not get binary dependencies for file: C:\Users\310251823\AppData\Local\Continuum\Anaconda3\api-ms-win-crt-heap-l1-1-0.dll
Traceback (most recent call last):
File "C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\depend\bindepend.py", line 695, in getImports
return _getImports_pe(pth)
File "C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\depend\bindepend.py", line 122, in _getImports_pe
dll, _ = sym.forwarder.split('.')
TypeError: a bytes-like object is required, not 'str'
4657 WARNING: Can not get binary dependencies for file: C:\Users\310251823\AppData\Local\Continuum\Anaconda3\api-ms-win-crt-locale-l1-1-0.dll
Traceback (most recent call last):
File "C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\depend\bindepend.py", line 695, in getImports
return _getImports_pe(pth)
File "C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\depend\bindepend.py", line 122, in _getImports_pe
dll, _ = sym.forwarder.split('.')
TypeError: a bytes-like object is required, not 'str'
4689 WARNING: Can not get binary dependencies for file: C:\Users\310251823\AppData\Local\Continuum\Anaconda3\api-ms-win-crt-math-l1-1-0.dll
Traceback (most recent call last):
File "C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\depend\bindepend.py", line 695, in getImports
return _getImports_pe(pth)
File "C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\depend\bindepend.py", line 122, in _getImports_pe
dll, _ = sym.forwarder.split('.')
TypeError: a bytes-like object is required, not 'str'
4703 WARNING: Can not get binary dependencies for file: C:\Users\310251823\AppData\Local\Continuum\Anaconda3\api-ms-win-crt-runtime-l1-1-0.dll
Traceback (most recent call last):
File "C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\depend\bindepend.py", line 695, in getImports
return _getImports_pe(pth)
File "C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\depend\bindepend.py", line 122, in _getImports_pe
dll, _ = sym.forwarder.split('.')
TypeError: a bytes-like object is required, not 'str'
5129 WARNING: Can not get binary dependencies for file: C:\Users\310251823\AppData\Local\Continuum\Anaconda3\api-ms-win-crt-time-l1-1-0.dll
Traceback (most recent call last):
File "C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\depend\bindepend.py", line 695, in getImports
return _getImports_pe(pth)
File "C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\depend\bindepend.py", line 122, in _getImports_pe
dll, _ = sym.forwarder.split('.')
TypeError: a bytes-like object is required, not 'str'
5134 WARNING: Can not get binary dependencies for file: C:\Users\310251823\AppData\Local\Continuum\Anaconda3\api-ms-win-crt-conio-l1-1-0.dll
Traceback (most recent call last):
File "C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\depend\bindepend.py", line 695, in getImports
return _getImports_pe(pth)
File "C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\depend\bindepend.py", line 122, in _getImports_pe
dll, _ = sym.forwarder.split('.')
TypeError: a bytes-like object is required, not 'str'
5160 WARNING: Can not get binary dependencies for file: C:\Users\310251823\AppData\Local\Continuum\Anaconda3\api-ms-win-crt-string-l1-1-0.dll
Traceback (most recent call last):
File "C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\depend\bindepend.py", line 695, in getImports
return _getImports_pe(pth)
File "C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\depend\bindepend.py", line 122, in _getImports_pe
dll, _ = sym.forwarder.split('.')
TypeError: a bytes-like object is required, not 'str'
5169 WARNING: Can not get binary dependencies for file: C:\Users\310251823\AppData\Local\Continuum\Anaconda3\api-ms-win-crt-process-l1-1-0.dll
Traceback (most recent call last):
File "C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\depend\bindepend.py", line 695, in getImports
return _getImports_pe(pth)
File "C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\depend\bindepend.py", line 122, in _getImports_pe
dll, _ = sym.forwarder.split('.')
TypeError: a bytes-like object is required, not 'str'
5186 WARNING: Can not get binary dependencies for file: C:\Users\310251823\AppData\Local\Continuum\Anaconda3\api-ms-win-crt-convert-l1-1-0.dll
Traceback (most recent call last):
File "C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\depend\bindepend.py", line 695, in getImports
return _getImports_pe(pth)
File "C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\depend\bindepend.py", line 122, in _getImports_pe
dll, _ = sym.forwarder.split('.')
TypeError: a bytes-like object is required, not 'str'
5190 WARNING: Can not get binary dependencies for file: C:\Users\310251823\AppData\Local\Continuum\Anaconda3\api-ms-win-crt-environment-l1-1-0.dll
Traceback (most recent call last):
File "C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\depend\bindepend.py", line 695, in getImports
return _getImports_pe(pth)
File "C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\depend\bindepend.py", line 122, in _getImports_pe
dll, _ = sym.forwarder.split('.')
TypeError: a bytes-like object is required, not 'str'
5203 WARNING: Can not get binary dependencies for file: C:\Users\310251823\AppData\Local\Continuum\Anaconda3\api-ms-win-crt-filesystem-l1-1-0.dll
Traceback (most recent call last):
File "C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\depend\bindepend.py", line 695, in getImports
return _getImports_pe(pth)
File "C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\depend\bindepend.py", line 122, in _getImports_pe
dll, _ = sym.forwarder.split('.')
TypeError: a bytes-like object is required, not 'str'
5207 INFO: Caching module hooks...
5213 INFO: Analyzing C:\Users\310251823\PycharmProjects\Prove1\Prova.py
5471 INFO: Processing pre-find module path hook distutils
10751 INFO: Processing pre-find module path hook site
10752 INFO: site: retargeting to fake-dir 'C:\\Users\\310251823\\AppData\\Local\\Continuum\\Anaconda3\\lib\\site-packages\\pyinstaller-3.2-py3.5.egg\\PyInstaller\\fake-modules'
10772 INFO: Processing pre-safe import module hook win32com
13072 INFO: Processing pre-safe import module hook six.moves
28631 INFO: Loading module hooks...
28633 INFO: Loading module hook "hook-jinja2.py"...
28644 INFO: Loading module hook "hook-xml.dom.domreg.py"...
28647 INFO: Loading module hook "hook-_tkinter.py"...
28922 INFO: checking Tree
28922 INFO: Building Tree because out00-Tree.toc is non existent
28922 INFO: Building Tree out00-Tree.toc
28991 INFO: checking Tree
28991 INFO: Building Tree because out01-Tree.toc is non existent
28992 INFO: Building Tree out01-Tree.toc
29005 INFO: Loading module hook "hook-pythoncom.py"...
29569 INFO: Loading module hook "hook-sqlite3.py"...
29573 INFO: Loading module hook "hook-PyQt4.QtGui.py"...
30078 INFO: Loading module hook "hook-jsonschema.py"...
30082 INFO: Loading module hook "hook-win32com.py"...
30194 INFO: Loading module hook "hook-pydoc.py"...
30196 INFO: Loading module hook "hook-encodings.py"...
30205 INFO: Loading module hook "hook-setuptools.py"...
30207 INFO: Loading module hook "hook-requests.py"...
30212 INFO: Loading module hook "hook-matplotlib.py"...
30644 INFO: Loading module hook "hook-lib2to3.py"...
30647 INFO: Loading module hook "hook-matplotlib.backends.py"...
31457 INFO: Matplotlib backend "GTK": ignored
Gtk* backend requires pygtk to be installed.
32068 INFO: Matplotlib backend "GTKAgg": ignored
Gtk* backend requires pygtk to be installed.
32468 INFO: Matplotlib backend "GTKCairo": ignored
No module named 'gtk'
33046 INFO: Matplotlib backend "MacOSX": ignored
cannot import name '_macosx'
33684 INFO: Matplotlib backend "Qt4Agg": added
34328 INFO: Matplotlib backend "Qt5Agg": added
34923 INFO: Matplotlib backend "TkAgg": added
35499 INFO: Matplotlib backend "WX": ignored
Matplotlib backend_wx and backend_wxagg require wxPython >=2.8.12
36105 INFO: Matplotlib backend "WXAgg": ignored
Matplotlib backend_wx and backend_wxagg require wxPython >=2.8.12
36529 INFO: Matplotlib backend "GTK3Cairo": ignored
Gtk3 backend requires pygobject to be installed.
37143 INFO: Matplotlib backend "GTK3Agg": ignored
Gtk3 backend requires pygobject to be installed.
38607 INFO: Matplotlib backend "WebAgg": added
39577 INFO: Matplotlib backend "nbAgg": added
40146 INFO: Matplotlib backend "agg": added
40539 INFO: Matplotlib backend "cairo": ignored
Cairo backend requires that cairocffi or pycairo is installed.
40930 INFO: Matplotlib backend "emf": ignored
No module named 'matplotlib.backends.backend_emf'
41330 INFO: Matplotlib backend "gdk": ignored
No module named 'gobject'
41939 INFO: Matplotlib backend "pdf": added
42663 INFO: Matplotlib backend "pgf": added
43259 INFO: Matplotlib backend "ps": added
44023 INFO: Matplotlib backend "svg": added
44768 INFO: Matplotlib backend "template": added
45009 INFO: Loading module hook "hook-pytz.py"...
45088 INFO: Loading module hook "hook-IPython.py"...
45101 INFO: Excluding import 'PySide'
45113 WARNING: Removing import IPython.external.qt_loaders from module PySide.QtSvg
45113 WARNING: Removing import IPython.external.qt_loaders from module PySide
45113 WARNING: Removing import IPython.external.qt_loaders from module PySide.QtGui
45113 WARNING: Removing import IPython.external.qt_loaders from module PySide.QtCore
45114 INFO: Excluding import 'PyQt4'
45124 WARNING: Removing import IPython.external.qt_loaders from module PyQt4.QtCore
45124 WARNING: Removing import IPython.external.qt_loaders from module PyQt4.QtSvg
45124 WARNING: Removing import IPython.external.qt_loaders from module PyQt4
45141 WARNING: Removing import IPython.external.qt_loaders from module PyQt4.QtGui
45144 INFO: Excluding import 'matplotlib'
45159 WARNING: Removing import IPython.core.pylabtools from module matplotlib
45163 WARNING: Removing import IPython.core.pylabtools from module matplotlib._pylab_helpers
45163 WARNING: Removing import IPython.core.pylabtools from module matplotlib.rcParams
45164 WARNING: Removing import IPython.core.pylabtools from module matplotlib.pylab
45164 WARNING: Removing import IPython.core.pylabtools from module matplotlib.figure
45164 WARNING: Removing import IPython.core.pylabtools from module matplotlib.pyplot
45164 WARNING: Removing import IPython.core.pylabtools from module matplotlib.figure.Figure
45166 INFO: Excluding import 'gtk'
45175 WARNING: Removing import IPython.lib.inputhook from module gtk
45175 WARNING: Removing import IPython.lib.inputhookgtk from module gtk
45177 INFO: Excluding import 'tkinter'
45186 WARNING: Removing import IPython.lib.inputhook from module tkinter
45189 WARNING: Removing import IPython.lib.clipboard from module tkinter
45189 INFO: Excluding import 'PyQt5'
45200 WARNING: Removing import IPython.external.qt_loaders from module PyQt5.QtGui
45202 WARNING: Removing import IPython.external.qt_loaders from module PyQt5.QtCore
45202 WARNING: Removing import IPython.external.qt_loaders from module PyQt5
45202 WARNING: Removing import IPython.external.qt_loaders from module PyQt5.QtSvg
45202 WARNING: Removing import IPython.external.qt_loaders from module PyQt5.QtWidgets
45203 INFO: Loading module hook "hook-pycparser.py"...
45358 INFO: Loading module hook "hook-pygments.py"...
46509 INFO: Loading module hook "hook-PIL.py"...
46514 INFO: Excluding import 'PyQt5'
46519 WARNING: Removing import PIL.ImageQt from module PyQt5.QPixmap
46519 WARNING: Removing import PIL.ImageQt from module PyQt5.qRgba
46519 WARNING: Removing import PIL.ImageQt from module PyQt5.QImage
46521 WARNING: Removing import PIL.ImageQt from module PyQt5
46521 INFO: Excluding import 'PySide'
46526 WARNING: Removing import PIL.ImageQt from module PySide.QImage
46527 WARNING: Removing import PIL.ImageQt from module PySide
46527 WARNING: Removing import PIL.ImageQt from module PySide.QPixmap
46527 WARNING: Removing import PIL.ImageQt from module PySide.qRgba
46528 INFO: Excluding import 'tkinter'
46532 INFO: Import to be excluded not found: 'FixTk'
46532 INFO: Excluding import 'PyQt4'
46539 WARNING: Removing import PIL.ImageQt from module PyQt4.QtCore
46539 WARNING: Removing import PIL.ImageQt from module PyQt4.QtCore.QBuffer
46539 WARNING: Removing import PIL.ImageQt from module PyQt4.QtGui.qRgba
46539 WARNING: Removing import PIL.ImageQt from module PyQt4.QtCore.QIODevice
46539 WARNING: Removing import PIL.ImageQt from module PyQt4.QtGui.QImage
46541 WARNING: Removing import PIL.ImageQt from module PyQt4.QtGui.QPixmap
46542 WARNING: Removing import PIL.ImageQt from module PyQt4.QtGui
46544 INFO: Loading module hook "hook-PyQt4.QtCore.py"...
46643 INFO: Loading module hook "hook-zmq.py"...
47427 INFO: Excluding import 'zmq.libzmq'
47432 WARNING: Removing import zmq from module zmq.libzmq
47433 INFO: Loading module hook "hook-PyQt4.QtSvg.py"...
47435 INFO: Loading module hook "hook-xml.etree.cElementTree.py"...
47436 INFO: Loading module hook "hook-distutils.py"...
47437 INFO: Loading module hook "hook-xml.py"...
47439 INFO: Loading module hook "hook-pkg_resources.py"...
47440 INFO: Loading module hook "hook-sysconfig.py"...
47442 INFO: Loading module hook "hook-PyQt4.py"...
47443 INFO: Loading module hook "hook-PIL.Image.py"...
47621 INFO: Loading module hook "hook-cryptography.py"...
47627 INFO: Loading module hook "hook-pywintypes.py"...
48177 INFO: Loading module hook "hook-shelve.py"...
48187 INFO: Loading module hook "hook-gevent.monkey.py"...
48192 INFO: Loading module hook "hook-PIL.SpiderImagePlugin.py"...
48198 INFO: Excluding import 'tkinter'
48202 INFO: Import to be excluded not found: 'FixTk'
48350 INFO: checking Tree
48351 INFO: Building Tree because out02-Tree.toc is non existent
48351 INFO: Building Tree out02-Tree.toc
48581 INFO: checking Tree
48582 INFO: Building Tree because out03-Tree.toc is non existent
48582 INFO: Building Tree out03-Tree.toc
48585 INFO: Looking for ctypes DLLs
48657 INFO: Analyzing run-time hooks ...
48677 INFO: Including run-time hook 'pyi_rth_pkgres.py'
48680 INFO: Including run-time hook 'pyi_rth_traitlets.py'
48682 INFO: Including run-time hook 'pyi_rth_win32comgenpy.py'
48687 INFO: Including run-time hook 'pyi_rth__tkinter.py'
48690 INFO: Including run-time hook 'pyi_rth_qt4plugins.py'
48693 INFO: Including run-time hook 'pyi_rth_mplconfig.py'
48695 INFO: Including run-time hook 'pyi_rth_mpldata.py'
48742 INFO: Looking for dynamic libraries
65958 WARNING: lib not found: libzmq.cp35-win_amd64.pyd dependency of C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\zmq\backend\cython\socket.cp35-win_amd64.p
yd
66065 WARNING: lib not found: libzmq.cp35-win_amd64.pyd dependency of C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\zmq\backend\cython\_device.cp35-win_amd64.
pyd
66161 WARNING: lib not found: libzmq.cp35-win_amd64.pyd dependency of C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\zmq\backend\cython\error.cp35-win_amd64.py
d
66361 WARNING: lib not found: libzmq.cp35-win_amd64.pyd dependency of C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\zmq\backend\cython\context.cp35-win_amd64.
pyd
66574 WARNING: lib not found: libzmq.cp35-win_amd64.pyd dependency of C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\zmq\backend\cython\_version.cp35-win_amd64
.pyd
66679 WARNING: lib not found: libzmq.cp35-win_amd64.pyd dependency of C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\zmq\backend\cython\utils.cp35-win_amd64.py
d
66797 WARNING: lib not found: libzmq.cp35-win_amd64.pyd dependency of C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\zmq\backend\cython\message.cp35-win_amd64.
pyd
66983 WARNING: lib not found: libzmq.cp35-win_amd64.pyd dependency of C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\zmq\backend\cython\_poll.cp35-win_amd64.py
d
75241 WARNING: Can not get binary dependencies for file: C:\Users\310251823\AppData\Local\Continuum\Anaconda3\api-ms-win-crt-utility-l1-1-0.dll
Traceback (most recent call last):
File "C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\depend\bindepend.py", line 695, in getImports
return _getImports_pe(pth)
File "C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\depend\bindepend.py", line 122, in _getImports_pe
dll, _ = sym.forwarder.split('.')
TypeError: a bytes-like object is required, not 'str'
76302 WARNING: Can not get binary dependencies for file: C:\Users\310251823\AppData\Local\Continuum\Anaconda3\api-ms-win-crt-multibyte-l1-1-0.dll
Traceback (most recent call last):
File "C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\depend\bindepend.py", line 695, in getImports
return _getImports_pe(pth)
File "C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\depend\bindepend.py", line 122, in _getImports_pe
dll, _ = sym.forwarder.split('.')
TypeError: a bytes-like object is required, not 'str'
86495 INFO: Found C:\windows\WinSxS\Manifests\amd64_policy.9.0.microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4940_none_acd19a1fe1da248a.manifest
86496 INFO: Found C:\windows\WinSxS\Manifests\amd64_policy.9.0.microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.6161_none_acd388d7e1d8689f.manifest
86726 INFO: Searching for assembly amd64_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.30729.6161_none ...
86726 INFO: Found manifest C:\windows\WinSxS\Manifests\amd64_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.6161_none_08e61857a83bc251.manifest
86728 INFO: Searching for file msvcr90.dll
86728 INFO: Found file C:\windows\WinSxS\amd64_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.6161_none_08e61857a83bc251\msvcr90.dll
86728 INFO: Searching for file msvcp90.dll
86729 INFO: Found file C:\windows\WinSxS\amd64_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.6161_none_08e61857a83bc251\msvcp90.dll
86729 INFO: Searching for file msvcm90.dll
86729 INFO: Found file C:\windows\WinSxS\amd64_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.6161_none_08e61857a83bc251\msvcm90.dll
86947 INFO: Found C:\windows\WinSxS\Manifests\amd64_policy.9.0.microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4940_none_acd19a1fe1da248a.manifest
86948 INFO: Found C:\windows\WinSxS\Manifests\amd64_policy.9.0.microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.6161_none_acd388d7e1d8689f.manifest
86949 INFO: Adding redirect Microsoft.VC90.CRT version (9, 0, 21022, 8) -> (9, 0, 30729, 6161)
92515 WARNING: Attempted to add Python module twice with different upper/lowercases: PyQt4.QtCore
92515 WARNING: Attempted to add Python module twice with different upper/lowercases: PyQt4.QtSvg
92515 WARNING: Attempted to add Python module twice with different upper/lowercases: PyQt4.QtGui
92516 WARNING: Attempted to add Python module twice with different upper/lowercases: PIL._imaging
92516 WARNING: Attempted to add Python module twice with different upper/lowercases: PIL._imagingft
92516 INFO: Looking for eggs
92517 INFO: Using Python library C:\Users\310251823\AppData\Local\Continuum\Anaconda3\python35.dll
92517 INFO: Found binding redirects:
[BindingRedirect(name='Microsoft.VC90.CRT', language=None, arch='amd64', oldVersion=(9, 0, 21022, 8), newVersion=(9, 0, 30729, 6161), publicKeyToken='1fc8b3b9a1e18e3b')]
92561 INFO: Warnings written to C:\Users\310251823\PycharmProjects\Prove1\build\Prova\warnProva.txt
92722 INFO: checking PYZ
92722 INFO: Building PYZ because out00-PYZ.toc is non existent
92722 INFO: Building PYZ (ZlibArchive) C:\Users\310251823\PycharmProjects\Prove1\build\Prova\out00-PYZ.pyz
96605 INFO: checking PKG
96605 INFO: Building PKG because out00-PKG.toc is non existent
96605 INFO: Building PKG (CArchive) out00-PKG.pkg
96703 INFO: Bootloader C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\bootloader\Windows-64bit\run.exe
96703 INFO: checking EXE
96703 INFO: Building EXE because out00-EXE.toc is non existent
96703 INFO: Building EXE from out00-EXE.toc
96703 INFO: Appending archive to EXE C:\Users\310251823\PycharmProjects\Prove1\build\Prova\Prova.exe
96733 INFO: checking COLLECT
96733 INFO: Building COLLECT because out00-COLLECT.toc is non existent
96733 INFO: Building COLLECT out00-COLLECT.toc
Here seems something like what I have, but I do not understand the solution. How can I import the 'packaging' package into the .spec file?
Thank you,
Sm

First of all I see in the pyinstaller log that the PIL hook is loaded, which excludes the tkinter module required by matplotlib. This is a common problem, that I also had, and the error message doesn't always point to that direction.
To solve it, I did two things.
Use import Tkinter and import FileDialog in my code. Preferably after importing PIL.
Download and install the latest development version of pyinstaller. 3.2 was still giving me issues.
If the packaging error persists, you can add it as a hidden-import. In the .spec file, that is an option of the Analysis.

A part of setuptools, pkg_resources._vendor.packaging is missing in case of anaconda. As it says, it might be necessary to contact the packager of the distribution.
Development version of pyinstaller can be installed by
pip install https://github.com/pyinstaller/pyinstaller/archive/develop.zip
That version seems to work with anaconda3 and it even copies necessary dll dependencies. tkinter.filedialog needs to be specified as a hidden import though.
It is possible to install a more standard version of setuptools by
python -m pip install --upgrade --force-reinstall setuptools
I don't know if this causes problems with anaconda though.
I was able to build an executable of your script after installing another version of setuptools, adding tkinter.filedialog as a hidden import, and copying mkl_*.dll files from Anaconda3/Library/bin folder.

Related

Conda with Python3.9 using numpy in Python3.10

I'm trying to install statsmodels in Oracle Machine Learning in Conda enviroment.
My conda version is:
%conda
info
active environment : None
shell level : 0
user config file : /u01/.condarc
populated config files : /usr/share/conda/condarc.d/defaults.yaml
/u01/.condarc
conda version : 4.6.14
conda-build version : not installed
python version : 3.6.8.final.0
base environment : /usr (read only)
channel URLs : https://repo.anaconda.com/pkgs/main/linux-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/free/linux-64
https://repo.anaconda.com/pkgs/free/noarch
https://repo.anaconda.com/pkgs/r/linux-64
https://repo.anaconda.com/pkgs/r/noarch
package cache : /u01/.conda/pkgs
/var/cache/conda/pkgs
envs directories : /u01/.conda/envs
/usr/envs
platform : linux-64
user-agent : conda/4.6.14 requests/2.27.1 CPython/3.6.8 Linux/5.4.17-2136.314.6.3.el7uek.x86_64 oracle/7.9 glibc/2.17
UID:GID : 65000:65000
netrc file : None
offline mode : False
I created the conda enviroment with the next command:
%conda
create -n arima_enviroment python=3.9 xz sqlite libuuid statsmodels numpy
I activated the enviroment with:
%conda
activate arima_enviroment
Test the enviroment with:
%python
import sys
import platform
print("sys.version:", sys.version)
print("sys.version_info:", sys.version_info)
print("platform.python_version:", platform.python_version())
sys.version: 3.9.12 (main, Jun 1 2022, 11:38:51) [GCC 7.5.0]
sys.version_info: sys.version_info(major=3, minor=9, micro=12, releaselevel='final', serial=0)
platform.python_version: 3.9.12
Then I execute the next command for import the ARIMA model.
%python
from statsmodels.tsa.arima_model import arima
But give me the next error:
Fail to execute line 2: from statsmodels.tsa.arima_model import arima
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/numpy/core/__init__.py", line 23, in <module>
from . import multiarray
File "/usr/local/lib/python3.10/site-packages/numpy/core/multiarray.py", line 10, in <module>
from . import overrides
File "/usr/local/lib/python3.10/site-packages/numpy/core/overrides.py", line 6, in <module>
from numpy.core._multiarray_umath import (
ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/tmp/1675189382222-0/zeppelin_python.py", line 206, in <module>
exec(code, _zcUserQueryNameSpace)
File "<stdin>", line 2, in <module>
File "/u01/.conda/active_env/lib/python3.9/site-packages/statsmodels/tsa/__init__.py", line 1, in <module>
from statsmodels.tools._testing import PytestTester
File "/u01/.conda/active_env/lib/python3.9/site-packages/statsmodels/tools/__init__.py", line 1, in <module>
from .tools import add_constant, categorical
File "/u01/.conda/active_env/lib/python3.9/site-packages/statsmodels/tools/tools.py", line 4, in <module>
import numpy as np
File "/usr/local/lib/python3.10/site-packages/numpy/__init__.py", line 144, in <module>
from . import core
File "/usr/local/lib/python3.10/site-packages/numpy/core/__init__.py", line 49, in <module>
raise ImportError(msg)
ImportError:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
We have compiled some common reasons and troubleshooting tips at:
https://numpy.org/devdocs/user/troubleshooting-importerror.html
Please note and check the following:
* The Python version is: Python3.9 from "/u01/.conda/active_env/bin/python3"
* The NumPy version is: "1.22.1"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: No module named 'numpy.core._multiarray_umath'
Why conda is using Numpy in Python 3.10 folder and not the Numpy version installed in Python 3.9? How can repair it?

"ImportError: DLL load failed: The specified module could not be found" when trying to import gensim

While trying to import gensim, I run into the following error
Traceback (most recent call last):
File "c:\Users\usr\Documents\hello\test.py", line 3, in <module>
import gensim
File "C:\Users\usr\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\gensim\__init__.py", line 5, in <module>
from gensim import parsing, corpora, matutils, interfaces, models, similarities, summarization, utils # noqa:F401
File "C:\Users\usr\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\gensim\corpora\__init__.py", line 6, in <module>
from .indexedcorpus import IndexedCorpus # noqa:F401 must appear before the other classes
File "C:\Users\usr\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\gensim\corpora\indexedcorpus.py", line 15, in <module>
from gensim import interfaces, utils
File "C:\Users\usr\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\gensim\interfaces.py", line 21, in <module>
from gensim import utils, matutils
File "C:\Users\usr\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\gensim\matutils.py", line 21, in <module>
from scipy.stats import entropy
File "C:\Users\usr\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\scipy\stats\__init__.py", line 384, in <module>
from .stats import *
File "C:\Users\usr\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\scipy\stats\stats.py", line 179, in <module>
from scipy.spatial.distance import cdist
File "C:\Users\usr\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\scipy\spatial\__init__.py", line 99, in <module>
from .qhull import *
ImportError: DLL load failed: The specified module could not be found.
I have tried uninstalling numpy, scipy and gensim using pip in the command prompt and installing them again, but this does not resolve the issue.
I have also looked at the suggestions to a similar problem here, and tried installing numpy‑1.19.0+mkl‑cp37‑cp37m‑win_amd64.whl, but it resulted in a separate error Importing the numpy c-extensions failed. Thus, I have stuck to using numpy, scipy and gensim installed via pip.
Additionally, I installed scipy version 1.4.1 as the latest 1.5.0 version will give the following error as described in this link:
Error when loading scipy: OSError: [WinError 126] The specified module could not be found
Any help is greatly appreciated!
For additional information, I am using Python 3.7 and Windows 10.
I had the same problem and tried various things, but the only thing that worked for me was to install an older version of Gensim.
pip install gensim==3.7.0

rpy2.ipython errors with pandas / numpy

Trying to use the rpy2.ipython (formerly 'rmagic') extension of IPython, to get interactive R (%R line magic and %%R cell magic functions), I get the following errors...
louis ~ $ python
Python 3.5.1 |Anaconda 2.4.0 (64-bit)| (default, Dec 7 2015, 11:16:01)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import rpy2.ipython
Traceback (most recent call last):
File "/home/louis/anaconda3/lib/python3.5/site-packages/pandas/__init__.py", line 7, in <module>
from pandas import hashtable, tslib, lib
File "pandas/src/numpy.pxd", line 157, in init pandas.hashtable (pandas/hashtable.c:38262)
File "/home/louis/anaconda3/lib/python3.5/site-packages/numpy/__init__.py", line 180, in <module>
from . import add_newdocs
File "/home/louis/anaconda3/lib/python3.5/site-packages/numpy/add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "/home/louis/anaconda3/lib/python3.5/site-packages/numpy/lib/__init__.py", line 18, in <module>
from .polynomial import *
File "/home/louis/anaconda3/lib/python3.5/site-packages/numpy/lib/polynomial.py", line 20, in <module>
from numpy.linalg import eigvals, lstsq, inv
File "/home/louis/anaconda3/lib/python3.5/site-packages/numpy/linalg/__init__.py", line 51, in <module>
from .linalg import *
File "/home/louis/anaconda3/lib/python3.5/site-packages/numpy/linalg/linalg.py", line 29, in <module>
from numpy.linalg import lapack_lite, _umath_linalg
ImportError: /home/louis/anaconda3/lib/python3.5/site-packages/numpy/linalg/lapack_lite.cpython-35m-x86_64-linux-gnu.so: undefined symbol: zgelsd_
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/louis/anaconda3/lib/python3.5/site-packages/rpy2/ipython/rmagic.py", line 59, in <module>
from rpy2.robjects import pandas2ri as baseconversion
File "/home/louis/anaconda3/lib/python3.5/site-packages/rpy2/robjects/pandas2ri.py", line 6, in <module>
from pandas.core.frame import DataFrame as PandasDataFrame
File "/home/louis/anaconda3/lib/python3.5/site-packages/pandas/__init__.py", line 13, in <module>
"extensions first.".format(module))
ImportError: C extension: /home/louis/anaconda3/lib/python3.5/site-packages/numpy/linalg/lapack_lite.cpython-35m-x86_64-linux-gnu.so: undefined symbol: zgelsd_ not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext --inplace' to build the C extensions first.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/louis/anaconda3/lib/python3.5/site-packages/rpy2/ipython/__init__.py", line 1, in <module>
from .rmagic import load_ipython_extension
File "/home/louis/anaconda3/lib/python3.5/site-packages/rpy2/ipython/rmagic.py", line 63, in <module>
from rpy2.robjects import numpy2ri as baseconversion
File "/home/louis/anaconda3/lib/python3.5/site-packages/rpy2/robjects/numpy2ri.py", line 6, in <module>
import numpy
File "/home/louis/anaconda3/lib/python3.5/site-packages/numpy/__init__.py", line 180, in <module>
from . import add_newdocs
File "/home/louis/anaconda3/lib/python3.5/site-packages/numpy/add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "/home/louis/anaconda3/lib/python3.5/site-packages/numpy/lib/__init__.py", line 18, in <module>
from .polynomial import *
File "/home/louis/anaconda3/lib/python3.5/site-packages/numpy/lib/polynomial.py", line 13, in <module>
import numpy.core.numeric as NX
AttributeError: module 'numpy' has no attribute 'core'
I've always ignored the fact that Anaconda3 seems to have been built on RHEL (I'm on Linux Mint, which is based on Ubuntu), but I'm wondering now if this might be the cause of the problem here - "C extensions not built" for my machine?
Since it's in the conda virtual environment, I'm not sure how I can fix this.
Should I attempt to python setup.py build_ext --inplace within ~/anaconda3/lib/python3.5/site-packages/pandas ?
When I step through the above imports, of e.g. :
from numpy.linalg import lapack_lite, _umath_linalg
there's no error, so I'm not certain there are actually unbuilt files, perhaps it's just some masking of one variable by another (as in this question with similar error message but different traceback, i.e. an error in rpy2).
import numpy.core (etc.) without first trying to load rpy2.ipython works fine
Summary of pip show :
---
Metadata-Version: 2.0
Name: rpy2
Version: 2.7.5
---
Metadata-Version: 1.1
Name: numpy
Version: 1.10.1
---
Metadata-Version: 1.1
Name: pandas
Version: 0.17.0
---
Metadata-Version: 2.0
Name: ipython
Version: 4.0.1
(all locations /home/louis/anaconda3/lib/python3.5/site-packages)
System info from cat /proc/version and lsb_release -a :
Linux version 3.13.0-35-generic (buildd#panlong) (gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1) ) #62-Ubuntu SMP Fri Aug 15 01:58:42 UTC 2014
LSB Version: core-2.0-amd64:core-2.0-noarch:core-3.0-amd64:core-3.0-noarch:core-3.1-amd64:core-3.1-noarch:core-3.2-amd64:core-3.2-noarch:core-4.0-amd64:core-4.0-noarch:core-4.1-amd64:core-4.1-noarch
Description: Linux Mint 17 Qiana
I am suspecting an incompatibility between versions of the LAPACK library: the one picked at runtime on your system, the one numpy was built with, and the one R was built with.
Installing numpy, R, and rpy2 from source in your virtual environment should solve the issue. An alternative would be to notify the maintainers of the anaconda packages involved and see it they confirm that numpy and R packaged by anaconda use the same LAPACK.

Strange error when compiling matplotlib with PyQt4 via pyinstaller

My headaches of trying to compile PyQt4 and Matplotlib are seeming pretty endless.
Here is my test program test.py
from PyQt4 import QtGui, QtCore
import math
import sys
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.backends.backend_qt4agg import NavigationToolbar2QTAgg as NavigationToolbar
import matplotlib.pyplot as plt
and here is my attempt to freeze this file by the command line
pyinstaller -w --onefile test.py
(tested with no options - pyinstaller test.py - with identical results)
And here is my console output:
16 INFO: wrote C:\Users\Tyson\Desktop\PHS3031 Lab1.2 - Alpha\test.spec
30 INFO: Testing for ability to set icons, version resources...
46 INFO: ... resource update available
62 INFO: UPX is not available.
78 INFO: Processing hook hook-os
171 INFO: Processing hook hook-time
171 INFO: Processing hook hook-cPickle
233 INFO: Processing hook hook-_sre
328 INFO: Processing hook hook-cStringIO
405 INFO: Processing hook hook-encodings
421 INFO: Processing hook hook-codecs
717 INFO: Extending PYTHONPATH with C:\Users\Tyson\Desktop\PHS3031 Lab1.2 - Alph
a
717 INFO: checking Analysis
796 INFO: checking PYZ
826 INFO: checking PKG
826 INFO: rebuilding out00-PKG.toc because out00-PKG.pkg is missing
826 INFO: building PKG (CArchive) out00-PKG.pkg
Traceback (most recent call last):
File "C:\Python27\Scripts\pyinstaller-script.py", line 9, in <module>
load_entry_point('PyInstaller==2.1', 'console_scripts', 'pyinstaller')()
File "C:\Python27\lib\site-packages\PyInstaller\main.py", line 88, in run
run_build(opts, spec_file, pyi_config)
File "C:\Python27\lib\site-packages\PyInstaller\main.py", line 46, in run_buil
d
PyInstaller.build.main(pyi_config, spec_file, **opts.__dict__)
File "C:\Python27\lib\site-packages\PyInstaller\build.py", line 1924, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'
))
File "C:\Python27\lib\site-packages\PyInstaller\build.py", line 1873, in build
execfile(spec)
File "C:\Users\Tyson\Desktop\PHS3031 Lab1.2 - Alpha\test.spec", line 17, in <m
odule>
console=False )
File "C:\Python27\lib\site-packages\PyInstaller\build.py", line 1170, in __ini
t__
strip_binaries=self.strip, upx_binaries=self.upx,
File "C:\Python27\lib\site-packages\PyInstaller\build.py", line 1008, in __ini
t__
self.__postinit__()
File "C:\Python27\lib\site-packages\PyInstaller\build.py", line 309, in __post
init__
self.assemble()
File "C:\Python27\lib\site-packages\PyInstaller\build.py", line 1050, in assem
ble
dist_nm=inm)
File "C:\Python27\lib\site-packages\PyInstaller\build.py", line 842, in checkC
ache
digest = cacheDigest(fnm)
File "C:\Python27\lib\site-packages\PyInstaller\build.py", line 796, in cacheD
igest
data = open(fnm, "rb").read()
IOError: [Errno 22] invalid mode ('rb') or filename: ''
I'm attempting to do this on Windows 7 with Python 2.7.
It appears there's some empty string which was expected to be a filename, but this error obviously exists outside my code.
Any and all help appreciarted.
Thanks,
Tyson
It looks like the PyInstaller is having a problem with the cache which it uses to not read all the sourcefiles every time.
In the %Appdata% folder is a pyinstaller folder which store the cache in the bincache* folder. Maybe it helps to clean the cache and try again to run the pyinstaller

Trouble importing Pandas

I am using the Anaconda distribution on Win7 - when I run python through the powershell I can import pandas and numpy without issue. However, when I run it through sublime (as i do on all my other machines by using a build system that targets the python executable), I get ImportError: No module named builtins
Here is the full detail:
No module named builtins
Traceback (most recent call last):
File "C:\Users\jarjarbinks\Sublime Text Build 3065\test.py", line 3, in <module>
import pandas as pd
File "C:\Users\jarjarbinks\AppData\Local\Continuum\Anaconda\lib\site-packages\pandas\__init__.py", line 6, in <module>
from . import hashtable, tslib, lib
File "tslib.pyx", line 40, in init pandas.tslib (pandas\tslib.c:63148)
File "C:\Users\jarjarbinks\AppData\Local\Continuum\Anaconda\lib\site-packages\pandas\compat\__init__.py", line 51, in <module>
import builtins
ImportError: No module named builtins
[Finished in 0.3s with exit code 1]
[cmd: ['C:/Users/jarjarbinks/AppData/Local/Continuum/Anaconda/python.exe', 'C:\\Users\\jarjarbinks\\Sublime Text Build 3065\\test.py']]
[dir: C:\Users\jarjarbinks\Sublime Text Build 3065]
[path: C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Hyland\Web ActiveX\;C:\Users\jarjarbinks\AppData\Local\Continuum\Anaconda;C:\Users\jarjarbinks\AppData\Local\Continuum\Anaconda\Scripts]
No clue on this one, any help would be greatly appreciated.