I can't package my program with Pyinstaller because I have enum34 installed, can't uninstall because a used module needs it. Any suggestions?

Question:

So I am trying to package a program I wrote for my job that allows people to add, update, delete the same row/columns over multiple spreadhseets (@ Smartsheets) at the same time. I am using Kivy, and the Smartsheet-Python-SDK

When I go to package the app with PyInstaller, per Kivy’s direction, I get errors:
“module ‘enum34’ has no attribute ‘IntFlag’ ”
and
“‘str’ object has no attribute ‘items’ “

Now when I search this error, the only suggestions I see are to uninstall enum34 and install the regular enum module.

Even bigger problem is that the Smartsheet API requires enum34, and the PyInstaller requires regular enum.

Any suggestions on how to tackle this? Can I have my cake and eat it too, in having both installed some how? It seems that enum34 installs in the same folder as enum (I could be wrong but I thought I read this more than once).

I have looked at the suggestions all over this site, but I need to somehow have both per each things requirements.

I’ve tried just uninstalling enum34 and installing regular enum, but as you can guess it breaks my smartsheet module.

Here is the error, not sure my code is necessary (plus I worked hard, don’t want it stolen).

53 INFO: PyInstaller: 3.4
53 INFO: Python: 3.7.2
54 INFO: Platform: Windows-10-10.0.17763-SP0
55 INFO: wrote C:UsersmpaluDesktopSmartsheet Mass EditorSSMassEditor.spec
57 INFO: UPX is not available.
58 INFO: Extending PYTHONPATH with paths
['C:\Users\mpalu\Desktop\Smartsheet Mass Editor',
 'C:\Users\mpalu\Desktop\Smartsheet Mass Editor']
58 INFO: checking Analysis
58 INFO: Building Analysis because Analysis-00.toc is non existent
59 INFO: Initializing module dependency graph...
61 INFO: Initializing module graph hooks...
63 INFO: Analyzing base_library.zip ...
Traceback (most recent call last):
  File "<string>", line 41, in <module>
  File "<string>", line 13, in walk_packages
  File "C:UsersmpaluAppDataLocalProgramsPythonPython37-32libpkgutil.py", line 130, in iter_modules
    for name, ispkg in iter_importer_modules(i, prefix):
  File "C:UsersmpaluAppDataLocalProgramsPythonPython37-32libpkgutil.py", line 149, in _iter_file_finder_modules
    import inspect
  File "C:UsersmpaluAppDataLocalProgramsPythonPython37-32libinspect.py", line 40, in <module>
    import linecache
  File "C:UsersmpaluAppDataLocalProgramsPythonPython37-32liblinecache.py", line 11, in <module>
    import tokenize
  File "C:UsersmpaluAppDataLocalProgramsPythonPython37-32libtokenize.py", line 33, in <module>
    import re
  File "C:UsersmpaluAppDataLocalProgramsPythonPython37-32libre.py", line 143, in <module>
    class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'....
....
3090 INFO: Caching module hooks...
3096 INFO: Analyzing C:UsersmpaluDesktopSmartsheet Mass EditorSS_Mass_Editor.py
3676 INFO: Processing pre-safe import module hook   urllib3.packages.six.moves
Traceback (most recent call last):
  File "<string>", line 2, in <module>
  File "C:UsersmpaluAppDataLocalProgramsPythonPython37-32libsite-packagesurllib3__init__.py", line 8, in <module>
    from .connectionpool import (
  File "C:UsersmpaluAppDataLocalProgramsPythonPython37-32libsite-packagesurllib3connectionpool.py", line 3, in <module>
    import logging ....
 AttributeError: 'str' object has no attribute 'items' </code>    

As mentioned, I just want to package this program so people in the office can use it and not have to install python and all the packages (no one is computer savy here) and use a batch file to run the program.

Asked By: Matthew Palumbo

||

Answers:

enum34 is a back-ported library for the enum type introduced in python3.4, see PEP435 and maybe this SO post. But since you are running python3.7, this dependency cannot be correct.

Apparently, the smartsheet developers already know about this issue and provided a fix. See this issue description and the fixing commit. Upgrading smartsheet likely will fix your problem.

pip install smartsheet-python-sdk --upgrade

In case the most recent version is not available yet through pip, you can install it from source:

# Clone the repository
git clone https://github.com/smartsheet-platform/smartsheet-python-sdk.git
# As of now (Jan 2019), the fix has not been merged to master yet.
# Hence, directly clone the patch branch:
# git clone -b tw-updates-2.0 https://github.com/smartsheet-platform/smartsheet-python-sdk.git
cd smartsheet-python-sdk
# Install the module.
python setup.py install
Answered By: normanius