0

I'm using auto-py-to-exe (which uses pyinstaller) , i've used it numerous times before with no issue, but for some reason I tried it today and couldn't get it to work with Pandas.

Simple Program that only has:

Import Pandas as pd

For some reason I now get this error... I tried everything to figure it out (here's the entire output with error):

Running auto-py-to-exe v2.32.0
Building directory: C:\Users\Jason Fuller\AppData\Local\Temp\tmpvy3w8d2_
Provided command: pyinstaller --noconfirm --onedir --windowed "C:/ProgramData/Anaconda3/envs/pythonProject/tempfiles/simple_toolbar_test.py"`
Recursion Limit is set to 5000`
Executing: pyinstaller --noconfirm --onedir --windowed C:/ProgramData/Anaconda3/envs/pythonProject/tempfiles/simple_toolbar_test.py --distpath C:\Users\Jason Fuller\AppData\Local\Temp\tmpvy3w8d2_\application --workpath C:\Users\Jason Fuller\AppData\Local\Temp\tmpvy3w8d2_\build --specpath C:\Users\Jason Fuller\AppData\Local\Temp\tmpvy3w8d2_

4957311 INFO: PyInstaller: 5.8.0
4957314 INFO: Python: 3.8.13 (conda)
4957316 INFO: Platform: Windows-10-10.0.18363-SP0
4957323 INFO: wrote C:\Users\Jason Fuller\AppData\Local\Temp\tmpvy3w8d2_\simple_toolbar_test.spec
4957326 INFO: UPX is not available.
4957335 INFO: Extending PYTHONPATH with paths
['C:\\ProgramData\\Anaconda3\\envs\\pythonProject\\tempfiles']
4959090 INFO: checking Analysis
4959092 INFO: Building Analysis because Analysis-16.toc is non existent
4959098 INFO: Reusing cached module dependency graph...
4959135 INFO: Caching module graph hooks...
4959394 INFO: running Analysis Analysis-16.toc
4959402 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
  required by C:\ProgramData\Anaconda3\envs\pythonProject\python.exe
4959643 INFO: Analyzing C:\ProgramData\Anaconda3\envs\pythonProject\tempfiles\simple_toolbar_test.py
4959717 INFO: Loading module hook 'hook-pandas.py' from 'C:\\ProgramData\\Anaconda3\\envs\\pythonProject\\lib\\site-packages\\PyInstaller\\hooks'...
4963161 INFO: Loading module hook 'hook-platform.py' from 'C:\\ProgramData\\Anaconda3\\envs\\pythonProject\\lib\\site-packages\\PyInstaller\\hooks'...
4963248 INFO: Loading module hook 'hook-numpy.py' from 'C:\\ProgramData\\Anaconda3\\envs\\pythonProject\\lib\\site-packages\\PyInstaller\\hooks'...
4964240 INFO: Loading module hook 'hook-numpy._pytesttester.py' from 'C:\\ProgramData\\Anaconda3\\envs\\pythonProject\\lib\\site-packages\\PyInstaller\\hooks'...
4964326 INFO: Processing pre-find module path hook distutils from 'C:\\ProgramData\\Anaconda3\\envs\\pythonProject\\lib\\site-packages\\PyInstaller\\hooks\\pre_find_module_path\\hook-distutils.py'.
4965154 INFO: Loading module hook 'hook-distutils.py' from 'C:\\ProgramData\\Anaconda3\\envs\\pythonProject\\lib\\site-packages\\PyInstaller\\hooks'...
4965214 INFO: Loading module hook 'hook-distutils.util.py' from 'C:\\ProgramData\\Anaconda3\\envs\\pythonProject\\lib\\site-packages\\PyInstaller\\hooks'...
4965496 INFO: Loading module hook 'hook-multiprocessing.util.py' from 'C:\\ProgramData\\Anaconda3\\envs\\pythonProject\\lib\\site-packages\\PyInstaller\\hooks'...
4965968 INFO: Loading module hook 'hook-xml.py' from 'C:\\ProgramData\\Anaconda3\\envs\\pythonProject\\lib\\site-packages\\PyInstaller\\hooks'...
4967688 INFO: Loading module hook 'hook-sysconfig.py' from 'C:\\ProgramData\\Anaconda3\\envs\\pythonProject\\lib\\site-packages\\PyInstaller\\hooks'...
4969713 INFO: Loading module hook 'hook-difflib.py' from 'C:\\ProgramData\\Anaconda3\\envs\\pythonProject\\lib\\site-packages\\PyInstaller\\hooks'...
4971754 INFO: Loading module hook 'hook-pytz.py' from 'C:\\ProgramData\\Anaconda3\\envs\\pythonProject\\lib\\site-packages\\PyInstaller\\hooks'...
4972292 INFO: Loading module hook 'hook-pkg_resources.py' from 'C:\\ProgramData\\Anaconda3\\envs\\pythonProject\\lib\\site-packages\\PyInstaller\\hooks'...
4980113 INFO: Processing pre-safe import module hook six.moves from 'C:\\ProgramData\\Anaconda3\\envs\\pythonProject\\lib\\site-packages\\PyInstaller\\hooks\\pre_safe_import_module\\hook-six.moves.py'.
4982268 INFO: Loading module hook 'hook-pandas.io.formats.style.py' from 'C:\\ProgramData\\Anaconda3\\envs\\pythonProject\\lib\\site-packages\\PyInstaller\\hooks'...
4985415 INFO: Loading module hook 'hook-pandas.plotting.py' from 'C:\\ProgramData\\Anaconda3\\envs\\pythonProject\\lib\\site-packages\\PyInstaller\\hooks'...
4985521 INFO: Loading module hook 'hook-matplotlib.py' from 'C:\\ProgramData\\Anaconda3\\envs\\pythonProject\\lib\\site-packages\\PyInstaller\\hooks'...
4986089 INFO: Loading module hook 'hook-packaging.py' from 'C:\\ProgramData\\Anaconda3\\envs\\pythonProject\\lib\\site-packages\\PyInstaller\\hooks'...
4986484 INFO: Processing pre-safe import module hook gi from 'C:\\ProgramData\\Anaconda3\\envs\\pythonProject\\lib\\site-packages\\PyInstaller\\hooks\\pre_safe_import_module\\hook-gi.py'.
4986635 INFO: Loading module hook 'hook-PIL.py' from 'C:\\ProgramData\\Anaconda3\\envs\\pythonProject\\lib\\site-packages\\PyInstaller\\hooks'...
4986716 INFO: Loading module hook 'hook-PIL.Image.py' from 'C:\\ProgramData\\Anaconda3\\envs\\pythonProject\\lib\\site-packages\\PyInstaller\\hooks'...
4989282 INFO: Loading module hook 'hook-pycparser.py' from 'C:\\ProgramData\\Anaconda3\\envs\\pythonProject\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
4990129 INFO: Loading module hook 'hook-setuptools.py' from 'C:\\ProgramData\\Anaconda3\\envs\\pythonProject\\lib\\site-packages\\PyInstaller\\hooks'...
4997162 INFO: Loading module hook 'hook-importlib_metadata.py' from 'C:\\ProgramData\\Anaconda3\\envs\\pythonProject\\lib\\site-packages\\PyInstaller\\hooks'...
4997995 INFO: Loading module hook 'hook-jinja2.py' from 'C:\\ProgramData\\Anaconda3\\envs\\pythonProject\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
4999691 INFO: Loading module hook 'hook-PIL.ImageFilter.py' from 'C:\\ProgramData\\Anaconda3\\envs\\pythonProject\\lib\\site-packages\\PyInstaller\\hooks'...
5000922 INFO: Loading module hook 'hook-matplotlib.backends.py' from 'C:\\ProgramData\\Anaconda3\\envs\\pythonProject\\lib\\site-packages\\PyInstaller\\hooks'...
5003116 INFO: Loading module hook 'hook-certifi.py' from 'C:\\ProgramData\\Anaconda3\\envs\\pythonProject\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
5005032 INFO: Loading module hook 'hook-openpyxl.py' from 'C:\\ProgramData\\Anaconda3\\envs\\pythonProject\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
5005368 INFO: Loading module hook 'hook-lxml.py' from 'C:\\ProgramData\\Anaconda3\\envs\\pythonProject\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
5008273 INFO: Loading module hook 'hook-xml.etree.cElementTree.py' from 'C:\\ProgramData\\Anaconda3\\envs\\pythonProject\\lib\\site-packages\\PyInstaller\\hooks'...
5011876 INFO: Loading module hook 'hook-xml.dom.domreg.py' from 'C:\\ProgramData\\Anaconda3\\envs\\pythonProject\\lib\\site-packages\\PyInstaller\\hooks'...
5012767 INFO: Loading module hook 'hook-sqlite3.py' from 'C:\\ProgramData\\Anaconda3\\envs\\pythonProject\\lib\\site-packages\\PyInstaller\\hooks'...
5015625 INFO: Loading module hook 'hook-PyQt5.py' from 'C:\\ProgramData\\Anaconda3\\envs\\pythonProject\\lib\\site-packages\\PyInstaller\\hooks'...
5016357 INFO: Processing module hooks...
5016362 INFO: Loading module hook 'hook-lxml.etree.py' from 'C:\\ProgramData\\Anaconda3\\envs\\pythonProject\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
5017009 INFO: Loading module hook 'hook-lxml.isoschematron.py' from 'C:\\ProgramData\\Anaconda3\\envs\\pythonProject\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
5017120 INFO: Loading module hook 'hook-encodings.py' from 'C:\\ProgramData\\Anaconda3\\envs\\pythonProject\\lib\\site-packages\\PyInstaller\\hooks'...
5020222 INFO: Loading module hook 'hook-heapq.py' from 'C:\\ProgramData\\Anaconda3\\envs\\pythonProject\\lib\\site-packages\\PyInstaller\\hooks'...
5020226 INFO: Loading module hook 'hook-matplotlib.backends.py' from 'C:\\ProgramData\\Anaconda3\\envs\\pythonProject\\lib\\site-packages\\PyInstaller\\hooks'...
5020233 INFO: Matplotlib backend selection method: automatic discovery of used backends
5020863 INFO: Trying determine the default backend as first importable candidate from the list: ['Qt5Agg', 'Gtk3Agg', 'TkAgg', 'WxAgg']
5021775 INFO: Selected matplotlib backends: ['Qt5Agg']
5022007 INFO: Loading module hook 'hook-pickle.py' from 'C:\\ProgramData\\Anaconda3\\envs\\pythonProject\\lib\\site-packages\\PyInstaller\\hooks'...
5022437 INFO: Loading module hook 'hook-PIL.SpiderImagePlugin.py' from 'C:\\ProgramData\\Anaconda3\\envs\\pythonProject\\lib\\site-packages\\PyInstaller\\hooks'...
5022601 INFO: Processing pre-safe import module hook win32com from 'C:\\ProgramData\\Anaconda3\\envs\\pythonProject\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\pre_safe_import_module\\hook-win32com.py'.
5023130 INFO: Loading module hook 'hook-win32com.py' from 'C:\\ProgramData\\Anaconda3\\envs\\pythonProject\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
5023138 INFO: Loading module hook 'hook-pythoncom.py' from 'C:\\ProgramData\\Anaconda3\\envs\\pythonProject\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
5023904 INFO: Loading module hook 'hook-pywintypes.py' from 'C:\\ProgramData\\Anaconda3\\envs\\pythonProject\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
5025702 INFO: Loading module hook 'hook-PyQt5.QtCore.py' from 'C:\\ProgramData\\Anaconda3\\envs\\pythonProject\\lib\\site-packages\\PyInstaller\\hooks'...
5025970 INFO: Loading module hook 'hook-PyQt5.QtGui.py' from 'C:\\ProgramData\\Anaconda3\\envs\\pythonProject\\lib\\site-packages\\PyInstaller\\hooks'...
5026357 INFO: Loading module hook 'hook-PyQt5.QtWidgets.py' from 'C:\\ProgramData\\Anaconda3\\envs\\pythonProject\\lib\\site-packages\\PyInstaller\\hooks'...
5026605 INFO: Loading module hook 'hook-scipy.py' from 'C:\\ProgramData\\Anaconda3\\envs\\pythonProject\\lib\\site-packages\\PyInstaller\\hooks'...
An error occurred while packaging
Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\envs\pythonProject\lib\site-packages\auto_py_to_exe\packaging.py", line 131, in package
    run_pyinstaller()
  File "C:\ProgramData\Anaconda3\envs\pythonProject\lib\site-packages\PyInstaller\__main__.py", line 180, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "C:\ProgramData\Anaconda3\envs\pythonProject\lib\site-packages\PyInstaller\__main__.py", line 61, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "C:\ProgramData\Anaconda3\envs\pythonProject\lib\site-packages\PyInstaller\building\build_main.py", line 977, in main
    build(specfile, distpath, workpath, clean_build)
  File "C:\ProgramData\Anaconda3\envs\pythonProject\lib\site-packages\PyInstaller\building\build_main.py", line 899, in build
    exec(code, spec_namespace)
  File "C:\Users\Jason Fuller\AppData\Local\Temp\tmpvy3w8d2_\simple_toolbar_test.spec", line 7, in <module>
    a = Analysis(
  File "C:\ProgramData\Anaconda3\envs\pythonProject\lib\site-packages\PyInstaller\building\build_main.py", line 412, in __init__
    self.__postinit__()
  File "C:\ProgramData\Anaconda3\envs\pythonProject\lib\site-packages\PyInstaller\building\datastruct.py", line 173, in __postinit__
    self.assemble()
  File "C:\ProgramData\Anaconda3\envs\pythonProject\lib\site-packages\PyInstaller\building\build_main.py", line 581, in assemble
    self.graph.process_post_graph_hooks(self)
  File "C:\ProgramData\Anaconda3\envs\pythonProject\lib\site-packages\PyInstaller\depend\analysis.py", line 330, in process_post_graph_hooks
    module_hook.post_graph(analysis)
  File "C:\ProgramData\Anaconda3\envs\pythonProject\lib\site-packages\PyInstaller\depend\imphook.py", line 447, in post_graph
    self._load_hook_module(keep_module_ref=True)
  File "C:\ProgramData\Anaconda3\envs\pythonProject\lib\site-packages\PyInstaller\depend\imphook.py", line 387, in _load_hook_module
    self._hook_module = importlib_load_source(self.hook_module_name, self.hook_filename)
  File "C:\ProgramData\Anaconda3\envs\pythonProject\lib\site-packages\PyInstaller\compat.py", line 612, in importlib_load_source
    return mod_loader.load_module()
  File "<frozen importlib._bootstrap_external>", line 522, in _check_name_wrapper
  File "<frozen importlib._bootstrap_external>", line 1022, in load_module
  File "<frozen importlib._bootstrap_external>", line 847, in load_module
  File "<frozen importlib._bootstrap>", line 265, in _load_module_shim
  File "<frozen importlib._bootstrap>", line 702, in _load
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 843, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "C:\ProgramData\Anaconda3\envs\pythonProject\lib\site-packages\PyInstaller\hooks\hook-scipy.py", line 26, in <module>
    dll_glob = os.path.join(os.path.dirname(get_module_file_attribute('scipy')), location, "*.dll")
  File "C:\ProgramData\Anaconda3\envs\pythonProject\lib\ntpath.py", line 223, in dirname
    return split(p)[0]
  File "C:\ProgramData\Anaconda3\envs\pythonProject\lib\ntpath.py", line 185, in split
    p = os.fspath(p)
TypeError: expected str, bytes or os.PathLike object, not NoneType

Project output will not be moved to output folder
Complete.

EDIT: I just created another virtual environment and installed auto-py-to-exe and Pandas.... and it worked. So there must be something conflicting or wrong with the original virtual environment. I'd really like to use the original... don't want to have to reinstall all the modules I use regularly.... any ideas would be helpful.

jxfuller1
  • 1
  • 2

1 Answers1

0

Well... I can see open AI chat is the way to go for answering questions instead of StackOverflow. I used Opengpt to help me figure this issue out. The AI pointed out that the following error:

dll_glob = os.path.join(os.path.dirname(get_module_file_attribute('scipy')), location, "*.dll")
  File "C:\ProgramData\Anaconda3\envs\pythonProject\lib\ntpath.py", line 223, in dirname
    return split(p)[0]
  File "C:\ProgramData\Anaconda3\envs\pythonProject\lib\ntpath.py", line 185, in split
    p = os.fspath(p)
TypeError: expected str, bytes or os.PathLike object, not NoneType

Is an error that Pyinstaller cannot find any DLL files in the scipy module. (looking back it seems kind of obvious....lol) I reinstalled the scipy library and then the error resolved itself.

The reason I thought it was a Pandas issue is because when I removed the Pandas Import from my program, the program would compile into an exe just fine. Removing the Pandas import just meant that Pyinstaller would no longer try to compile the scipy library though.

However... I then started to run into other odd issues. It compiled the code correctly, but then when running the exe, I got an error that it couldn't find a DLL, even though the DLL was there in the directory!! (when using one directory mode in pyinstaller).

After some thinking/tinkering, I realized that I had 2 paths in the Environment Variables Path that each pointed to a different virtual environment. I deleted the path to the virtual environment I didn't want and LO AND BEHOLD my python program compiled to an exe without issue and ran!

Apparently, having paths to different virtual environments in the Environment Variables Path is something to avoid.... I've never seen or read about this kind of issue before.

jxfuller1
  • 1
  • 2