Error with script saved as single file by Pyinstaller - python

I saved python script in single executable file with Pyinstaller, but when I tried to run it in console ./dist/myscript/myscript it raise AttributeError error with log below.
Log info
Traceback (most recent call last):
File "service.py", line 75, in <module>
File "service.py", line 31, in job
File "modelInstance.py", line 20, in __init__
File "prophet/forecaster.py", line 141, in __init__
File "prophet/forecaster.py", line 154, in _load_stan_backend
AttributeError: 'Prophet' object has no attribute 'stan_backend'
[1413] Failed to execute script 'service' due to unhandled exception!
As you see I'm using facebook's Prophet library to forecast time series data and all done in docker the container.

Related

Script runs fine from script, but fails when using PythonAnywhere tasks ("No module named gdbm"

I am using Python Anywhere to run a scheduled task. I have written the script and tested it running from the file and it works fine. However, if I used a scheduled task I get an error message.
Traceback (most recent call last):
File "/home/myaccount/myfile.py", line 45, in <module>
activeData = shelve.open('activeData')
File "/usr/lib/python2.7/shelve.py", line 243, in open
return DbfilenameShelf(filename, flag, protocol, writeback)
File "/usr/lib/python2.7/shelve.py", line 227, in __init__
Shelf.__init__(self, anydbm.open(filename, flag), protocol, writeback)
File "/usr/lib/python2.7/anydbm.py", line 84, in open
mod = __import__(result)
ImportError: No module named gdbm
I'm confused as to why the script runs fine if I run it from the script, but fails when triggered from the scheduled tasks, and why this would produce a missing module.
Any help appreciated.

client_secrets.json not found in pyiinstaller

so I have this program in python that I want to use pyinstaller to make into an executable. It runs perfectly on its own and pyinstaller makes the executable fine but when I run the executable I get this:
Traceback (most recent call last):
File "site-packages/pydrive/auth.py", line 386, in LoadClientConfigFile
File "site-packages/oauth2client/clientsecrets.py", line 165, in loadfile
File "site-packages/oauth2client/clientsecrets.py", line 125, in _loadfile
oauth2client.clientsecrets.InvalidClientSecretsError: ('Error opening file',
'client_secrets.json', 'No such file or directory', 2)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "updating.py", line 17, in <module>
File "site-packages/pydrive/auth.py", line 113, in _decorated
File "site-packages/pydrive/auth.py", line 443, in GetFlow
File "site-packages/pydrive/auth.py", line 366, in LoadClientConfig
File "site-packages/pydrive/auth.py", line 388, in LoadClientConfigFile
pydrive.settings.InvalidConfigError: Invalid client secrets file ('Error
opening file', 'client_secrets.json', 'No such file or directory', 2)
[34574] Failed to execute script updating
Why does this work on its own but pyinstaller doesn't catch anything until the executable is ran? I can't seem to find an answer otherwise.
Notable Info:
I'm running a Mac OS X, Mojave 10.14.2, Python Version 3.7.2.
The client_secrets.json is from a Google Drive API, v3
The file is in my directory just like all my other files, in the same spot.
Thanks!!

AttributeError: LooseVersion instance has no attribute 'version'

I'm working on a python program which reads parquet type file and converts it in to pandas dataframe. It works fine while i use the python command to run it (python framework1.py arg1 arg2). But after converting it to an executable file using pyinstaller and when the executable file is ran , it gives the following error.
Traceback (most recent call last):
File "framework1.py", line 325, in <module>
File "filetype.py", line 24, in fileTypeSelector
File "pandas/io/parquet.py", line 256, in read_parquet
File "pandas/io/parquet.py", line 38, in get_engine
File "pandas/io/parquet.py", line 89, in __init__
File "distutils/version.py", line 296, in __cmp__
AttributeError: LooseVersion instance has no attribute 'version'
[17249] Failed to execute script framework1
Thanks in advance :)
I solved the issue by using fastparquet engine rather than using pyarrow.
df1=pd.read_parquet(filepath,engine='fastparquet')

Python error ValueError: substring not found

I have no experience with python and I am installing a mongodb tools from https://github.com/rueckstiess/mtools. After installation and launch the application I got below exception errors. It seems that there is a grama issue but I am not sure about it. Is it caused by python version? I am using python 2.7. How can I know which version fix this problem?
# mlaunch init --single
Traceback (most recent call last):
File "/usr/local/bin/mlaunch", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python2.7/dist-packages/mtools/mlaunch/mlaunch.py", line 1438, in main
tool.run()
File "/usr/local/lib/python2.7/dist-packages/mtools/mlaunch/mlaunch.py", line 260, in run
getattr(self, self.args['command'])()
File "/usr/local/lib/python2.7/dist-packages/mtools/mlaunch/mlaunch.py", line 280, in init
current_version = self.getMongoDVersion()
File "/usr/local/lib/python2.7/dist-packages/mtools/mlaunch/mlaunch.py", line 475, in getMongoDVersion
if current_version.rindex('v') > 0:
ValueError: substring not found

AWS-CLI throwing unexpected Python based 'Session' error

I have been using AWS CLI on Ubuntu for a month. But today AWS CLI is throwing a python error, I haven't seen before:
sashank#sashank:~$ aws configure
Traceback (most recent call last):
File "/usr/local/bin/aws", line 27, in <module>
sys.exit(main())
File "/usr/local/bin/aws", line 23, in main
return awscli.clidriver.main()
File "/usr/local/lib/python2.7/dist-packages/awscli/clidriver.py", line 48, in main
return driver.main()
File "/usr/local/lib/python2.7/dist-packages/awscli/clidriver.py", line 173, in main
parser = self._create_parser()
File "/usr/local/lib/python2.7/dist-packages/awscli/clidriver.py", line 154, in _create_parser
command_table['help'] = self.create_help_command()
File "/usr/local/lib/python2.7/dist-packages/awscli/clidriver.py", line 149, in create_help_command
cli_data.get('help_usage', None))
File "/usr/local/lib/python2.7/dist-packages/awscli/help.py", line 259, in __init__
HelpCommand.__init__(self, session, session.provider,
AttributeError: 'Session' object has no attribute 'provider'
I have tried purging AWS CLI and removing all package files and re-installing, but error persists. Plz help!! Thanks.
Probably you have upgraded your virtualenv/setuptools and now your utility is screwed up. It happened to me with a wrongly set Chef that upgraded those two packages and, after that, the utility stopped working.

Categories