pyttsx3 initialization error, can't use pyttsx3 - python

I was having some problems when using the .getproperty('voices') attribute in pyttsx3. So I decided to uninstall it and then re-install it using PIP to see if that may fix the problem.
Previous link to when I had the .getproperty('voices') error: Why do I get an error with pyttsx3 when I try to access the properties of the voice?
Now, when I installed it again using PIP, I can't even initialize it
import pyttsx3
engine = pyttsx3.init()
It gives this error:
Traceback (most recent call last):
File "C:\Users\saife\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyttsx3\__init__.py", line 20, in init
eng = _activeEngines[driverName]
File "C:\Users\saife\AppData\Local\Programs\Python\Python38-32\lib\weakref.py", line 131, in __getitem__
o = self.data[key]()
KeyError: None
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\saife\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyttsx3\drivers\sapi5.py", line 3, in <module>
from comtypes.gen import SpeechLib # comtypes
ImportError: cannot import name 'SpeechLib' from 'comtypes.gen' (C:\Users\saife\AppData\Local\Programs\Python\Python38-32\lib\site-packages\comtypes\gen\__init__.py)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\saife\AppData\Local\Programs\Python\Python38-32\lib\ctypes\__init__.py", line 123, in WINFUNCTYPE
return _win_functype_cache[(restype, argtypes, flags)]
KeyError: (<class 'ctypes.HRESULT'>, (<class 'comtypes.automation.tagVARIANT'>, <class 'comtypes.LP_POINTER(ISpeechRecoGrammar)'>), 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
engine = pyttsx3.init()
File "C:\Users\saife\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyttsx3\__init__.py", line 22, in init
eng = Engine(driverName, debug)
File "C:\Users\saife\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyttsx3\engine.py", line 30, in __init__
self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug)
File "C:\Users\saife\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyttsx3\driver.py", line 50, in __init__
self._module = importlib.import_module(name)
File "C:\Users\saife\AppData\Local\Programs\Python\Python38-32\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\saife\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyttsx3\drivers\sapi5.py", line 6, in <module>
engine = comtypes.client.CreateObject("SAPI.SpVoice")
File "C:\Users\saife\AppData\Local\Programs\Python\Python38-32\lib\site-packages\comtypes\client\__init__.py", line 250, in CreateObject
return _manage(obj, clsid, interface=interface)
File "C:\Users\saife\AppData\Local\Programs\Python\Python38-32\lib\site-packages\comtypes\client\__init__.py", line 188, in _manage
obj = GetBestInterface(obj)
File "C:\Users\saife\AppData\Local\Programs\Python\Python38-32\lib\site-packages\comtypes\client\__init__.py", line 110, in GetBestInterface
mod = GetModule(tlib)
File "C:\Users\saife\AppData\Local\Programs\Python\Python38-32\lib\site-packages\comtypes\client\_generate.py", line 110, in GetModule
mod = _CreateWrapper(tlib, pathname)
File "C:\Users\saife\AppData\Local\Programs\Python\Python38-32\lib\site-packages\comtypes\client\_generate.py", line 184, in _CreateWrapper
mod = _my_import(fullname)
File "C:\Users\saife\AppData\Local\Programs\Python\Python38-32\lib\site-packages\comtypes\client\_generate.py", line 24, in _my_import
return __import__(fullname, globals(), locals(), ['DUMMY'])
File "C:\Users\saife\AppData\Local\Programs\Python\Python38-32\lib\site-packages\comtypes\gen\_C866CA3A_32F7_11D2_9602_00C04F8EE628_0_5_4.py", line 455, in <module>
ISpeechRecoContext._methods_ = [
File "C:\Users\saife\AppData\Local\Programs\Python\Python38-32\lib\site-packages\comtypes\__init__.py", line 329, in __setattr__
self._make_methods(value)
File "C:\Users\saife\AppData\Local\Programs\Python\Python38-32\lib\site-packages\comtypes\__init__.py", line 698, in _make_methods
prototype = WINFUNCTYPE(restype, *argtypes)
File "C:\Users\saife\AppData\Local\Programs\Python\Python38-32\lib\ctypes\__init__.py", line 125, in WINFUNCTYPE
class WinFunctionType(_CFuncPtr):
TypeError: item 1 in _argtypes_ passes a union by value, which is unsupported.

Open command prompt
Write:
pip uninstall pyttsx3
Then:
pip install pyttsx3==2.71
And your problem will solve.

If you are using Linux install libespeak1 using
sudo apt install libespeak1 if using debian based distros.

Try instead this:
engine= pyttsx3.init('dummy')

I hope you are trying to install pyttsx3 from https://pypi.org/project/pyttsx3/.
were you able to execute pip install pyttsx3 with out any issues?
Are you trying to run the above code from jupyter?
if yes then, please don't run the complete code at a time i.e the below code
import pyttsx3
engine = pyttsx3.init()
engine.say("I will speak this text")
engine.runAndWait()
first run import pyttsx3 alone and thern try to put up your code one by one.
I have faced similar issue earlier many times while running it on diferent systems.
I don't know why this issue shows up but the above steps will surely do resolve the issue.

I don't know if you managed to work around this issue, but I had the same thing this morning and fixed it by downgrading the version of pyttsx3 from the latest to version 2.71.
There seems to be some missing commits with the latest version that haven't been resolved (if you read the thread this post is from)

You need to provide a driver key argument to init. 'dummy' or 'sapi5' would work.
engine = pyttsx3.init('dummy')
or
engine = pyttsx3.init('sapi5')

I was facing same problem in my project but simply changing the python version from 3.8 to 3.6 works for me.

Related

PermissionError: [WinError 32] when importing the requests module

When I run the command import requests, I get this:
Traceback (most recent call last):
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\importlib\_common.py", line 89, in _tempfile
os.write(fd, reader())
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\importlib\abc.py", line 371, in read_bytes
with self.open('rb') as strm:
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\importlib\_adapters.py", line 54, in open
raise ValueError()
ValueError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\__init__.py", line 118, in <module>
from . import utils
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\utils.py", line 25, in <module>
from . import certs
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\certs.py", line 15, in <module>
from certifi import where
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\wrapt\importer.py", line 170, in exec_module
notify_module_loaded(module)
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\wrapt\decorators.py", line 470, in _synchronized
return wrapped(*args, **kwargs)
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\wrapt\importer.py", line 136, in notify_module_loaded
hook(module)
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\certifi_win32\wrapt_certifi.py", line 20, in apply_patches
certifi_win32.wincerts.CERTIFI_PEM = certifi.where()
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\certifi\core.py", line 37, in where
_CACERT_PATH = str(_CACERT_CTX.__enter__())
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\contextlib.py", line 135, in __enter__
return next(self.gen)
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\importlib\_common.py", line 95, in _tempfile
os.remove(raw_path)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\user1\\AppData\\Local\\Temp\\tmpz9h1wrjd'
If I delete the file at the bottom of the error, it generates a new random file and the new file comes up in the error code.
Are you on Visual Studio Code?
If the answer is yes, than it might be the problem. Try reinstalling it and the PYTHON extension.
More info here.
Fixed, baruch Hashem! I:
Uninstalled python
Deleted the Lib folder in C:/User/user1/AppData/Local/Programs/Python/Python39 and C:/User/user1/AppData/Local/Programs/Python/Python310
Re-installed python.
It works!
No need to delete and reinstall Python completely when you are using virtual environments.
This is very useful to keep python environment separated from one project to another.
Just (re)create a new Python venv. Tested successfully. You can use Anaconda Navigator on Windows to do that easily.
On Linux, just run the following commands of a terminal: conda create --name py35 python=3.5 (here we specify the name of the venv to be py35 and we select Python 3.5 as default Python in the venv. Then run source activate py34 to activate the venv and source deactivate to go back to default one. More commands and info here | cheatsheet.
More info here: Creation of virtual environments

Pyinstaller speedtest convert to exe error; no module name "__builtin__"

I am trying to convert a program to an exe using pyinstaller. The program performs a hardware assessment of a user's computer to include running an internet speed test utilizing speedtest-cli. The program runs fine until I compile it at which point I receive the following error:
Traceback (most recent call last): File "speedtest.py", line 156, in <module> ModuleNotFoundError: No module named '__builtin__'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "hw-assesment-tool.py", line 9, in <module> File "<frozen importlib._bootstrap>", line 1007, in
_find_and_load File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 680, in _load_unlocked File "PyInstaller\loader\pyimod03_importers.py", line 546, in exec_module File "speedtest.py", line 179, in <module> File "speedtest.py", line 166, in __init__ AttributeError: 'NullWriter' object has no attribute 'fileno'
I have tried upgrading and re-installing speedtest-cli and it has not corrected the issue.
P.S. Here is a screenshot of the error:
Compiled Python EXE error originating in Speedtest-cli
First you need to go to C:\Users\user\AppData\Local\Programs\Python\Python38\Lib\site-packages. Then find the speedtest.py and open it with Notepad or any other Text Editor.
Now you need to edit these lines of code
Line 156: to
import builtins
Line 158 : to
import builtins
Line 199: to
del builtins
To confirm, you can find for __builtin__ and replace it with builtins
__builtin__ was changed to builtins in Python 3. I pulled the speedtest-cli code from the repo and edited out the Python2 functionality and it worked fine.
I met same issue before, you need to modify the spec file: hiddenimports=['speedtest'], and build exe via spec file(type command: pyinstaller -F main.spec), It's work!

ModuleNotFoundError: No module named 'tensorflow.python.types'

Does anyone know how to solve this error? I have tensorflow installed as I am using Anaconda Navigator and I get this error when trying to compile my model on Jupyter Notebook.
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 3326, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-45-a28ca810f51d>", line 5, in <module>
keras.layers.Flatten(input_shape=(39)),
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow_core\python\keras\layers\core.py", line 570, in __init__
super(Flatten, self).__init__(**kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow_core\python\training\tracking\base.py", line 457, in _method_wrapper
result = method(self, *args, **kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow_core\python\keras\engine\base_layer.py", line 363, in __init__
batch_input_shape = (batch_size,) + tuple(kwargs['input_shape'])
TypeError: 'int' object is not iterable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 2040, in showtraceback
stb = value._render_traceback_()
AttributeError: 'TypeError' object has no attribute '_render_traceback_'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\IPython\core\ultratb.py", line 1101, in get_records
return _fixed_getinnerframes(etb, number_of_lines_of_context, tb_offset)
File "C:\ProgramData\Anaconda3\lib\site-packages\IPython\core\ultratb.py", line 319, in wrapped
return f(*args, **kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\IPython\core\ultratb.py", line 353, in _fixed_getinnerframes
records = fix_frame_records_filenames(inspect.getinnerframes(etb, context))
File "C:\ProgramData\Anaconda3\lib\inspect.py", line 1502, in getinnerframes
frameinfo = (tb.tb_frame,) + getframeinfo(tb, context)
File "C:\ProgramData\Anaconda3\lib\inspect.py", line 1460, in getframeinfo
filename = getsourcefile(frame) or getfile(frame)
File "C:\ProgramData\Anaconda3\lib\inspect.py", line 696, in getsourcefile
if getattr(getmodule(object, filename), '__loader__', None) is not None:
File "C:\ProgramData\Anaconda3\lib\inspect.py", line 733, in getmodule
if ismodule(module) and hasattr(module, '__file__'):
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\__init__.py", line 50, in __getattr__
module = self._load()
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\__init__.py", line 44, in _load
module = _importlib.import_module(self.__name__)
File "C:\ProgramData\Anaconda3\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow_core\contrib\__init__.py", line 39, in <module>
from tensorflow.contrib import compiler
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow_core\contrib\compiler\__init__.py", line 21, in <module>
from tensorflow.contrib.compiler import jit
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow_core\contrib\compiler\__init__.py", line 22, in <module>
from tensorflow.contrib.compiler import xla
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow_core\contrib\compiler\xla.py", line 22, in <module>
from tensorflow.python.estimator import model_fn as model_fn_lib
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow_core\python\estimator\model_fn.py", line 26, in <module>
from tensorflow_estimator.python.estimator import model_fn
File "C:\Users\nxf65465\AppData\Roaming\Python\Python37\site-packages\tensorflow_estimator\python\estimator\model_fn.py", line 29, in <module>
from tensorflow.python.types import core
ModuleNotFoundError: No module named 'tensorflow.python.types'
The installed versions are:
Tensorflow Version: 2.3.1
conda version: 4.8.3
Downgrading to tensorflow 2.0 worked for me.
pip install tensorflow==2.0 --user
I think it is because of .dll dependencies but I am not sure.
Having installed tensorflow with Bazel package builder, I reinstall tensorflow with:
pip install tensorflow==2.0 --user
For the benefit of posterity... I had the same problem with tensorflow.python.types and it did not require a resintallation of tensorflow to resolve: I was running TF1.15 but had somehow managed to get tensorflow-estimator 2.4 installed as well.
Removing TE 2.4 (and the wrong version of tensorboard) and making sure I had TF 1.15.1 and all was well again.
To note in passing, the mangled environment might also have been responsible for the strange "cannot load the convolution algorithm" error with cuDNN.
I make no specific claims, merely adduce evidence.
Having installed tensorflow with Bazel package builder, shall I reinstall tensor flow with:
pip install tensorflow==2.0 --user
Because I have the same error:
from tensorflow.python.types import core
ModuleNotFoundError: No module named 'tensorflow.python.types'
When I run TF but no Anaconda involved... It is from pycharm.
Probably you're using a Tensorflow version == 1.15, try to execute in your terminal the next line:
pip install tensorflow-estimator==1.15.0

Django Crispy Forms

I am fairly new to Django and I have installed and am trying to use crispy forms in my web app.I have added crispy_forms to my installed apps with a comma after it. When I run the server I get this error:
Watching for file changes with StatReloader
Performing system checks...
Exception in thread Thread-3:
Traceback (most recent call last):
File "c:\users\amart\django\django\template\utils.py", line 66, in __getitem__
return self._engines[alias]
KeyError: 'django'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\users\amart\django\django\template\backends\django.py", line 121, in get_package_libraries
module = import_module(entry[1])
File "C:\Users\amart\AppData\Local\Programs\Python\Python36-32\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\amart\AppData\Local\Programs\Python\Python36-32\lib\site-packages\crispy_forms\templatetags\crispy_forms_field.py", line 10, in <module>
from crispy_forms.utils import TEMPLATE_PACK, get_template_pack
File "C:\Users\amart\AppData\Local\Programs\Python\Python36-32\lib\site-packages\crispy_forms\utils.py", line 11, in <module>
from django.utils.lru_cache import lru_cache
ModuleNotFoundError: No module named 'django.utils.lru_cache'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\amart\AppData\Local\Programs\Python\Python36-32\lib\threading.py", line 916, in _bootstrap_inner
self.run()
File "C:\Users\amart\AppData\Local\Programs\Python\Python36-32\lib\threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "c:\users\amart\django\django\utils\autoreload.py", line 54, in wrapper
fn(*args, **kwargs)
File "c:\users\amart\django\django\core\management\commands\runserver.py", line 117, in inner_run
self.check(display_num_errors=True)
File "c:\users\amart\django\django\core\management\base.py", line 390, in check
include_deployment_checks=include_deployment_checks,
File "c:\users\amart\django\django\core\management\base.py", line 377, in _run_checks
return checks.run_checks(**kwargs)
File "c:\users\amart\django\django\core\checks\registry.py", line 72, in run_checks
new_errors = check(app_configs=app_configs)
File "c:\users\amart\django\django\contrib\admin\checks.py", line 59, in check_dependencies
for engine in engines.all():
File "c:\users\amart\django\django\template\utils.py", line 90, in all
return [self[alias] for alias in self]
File "c:\users\amart\django\django\template\utils.py", line 90, in <listcomp>
return [self[alias] for alias in self]
File "c:\users\amart\django\django\template\utils.py", line 81, in __getitem__
engine = engine_cls(params)
File "c:\users\amart\django\django\template\backends\django.py", line 25, in __init__
options['libraries'] = self.get_templatetag_libraries(libraries)
File "c:\users\amart\django\django\template\backends\django.py", line 43, in get_templatetag_libraries
libraries = get_installed_libraries()
File "c:\users\amart\django\django\template\backends\django.py", line 108, in get_installed_libraries
for name in get_package_libraries(pkg):
File "c:\users\amart\django\django\template\backends\django.py", line 125, in get_package_libraries
"trying to load '%s': %s" % (entry[1], e)
django.template.library.InvalidTemplateLibrary: Invalid template library specified. ImportError raised when trying to load 'crispy_forms.templatetags.crispy_forms_field': No module named 'django.utils.lru_cache'
I don't know what is wrong with my code. I have found some other users who have issues using crispy forms but are getting a different error. They were also unable to import crispy forms from the python shell but that is working for me. Even if I only add crispy forms to my installed apps without trying to apply it in my templates, I still get an error. Please let me know what I'm doing wrong. Thanks in advance.
Your version of django-crispy-forms is outdated, this has been fixed.
Update it by running:
pip install django-crispy-forms -U
-U makes pip upgrade your current installation to the newest.
You can find more about it by running pip install -h
The problem has been solved. I uninstalled the django version I had and used:
pip install Django==2.1.7
Thank you #YugandharChaudhari for helping me realize to change versions.

AttributeError: 'PyxImporter' object has no attribute 'find_spec' with Pandas/BigQuery

We're trying to pull some data off of BigQuery using Pandas and running into this absolutely enormous trace about imports. As far as I can tell, all the right dependencies are installed.
Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 879, in _find_spec
AttributeError: 'PyxImporter' object has no attribute 'find_spec'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "run_forecasts.py", line 117, in <module>
run_forecasts()
File "run_forecasts.py", line 50, in run_forecasts
a.run()
File "./budgetforecastmodel/prepare/funnel_entrance.py", line 37, in run
self._project_id
File "./budgetforecastmodel/prepare/funnel_entrance.py", line 60, in _read_data
funnel_entrances = fe_query.run()
File "./budgetforecastmodel/extract/bigquery/biq_query_base.py", line 41, in run
self.read_data()
File "./budgetforecastmodel/extract/bigquery/biq_query_base.py", line 141, in read_data
self.df = pd.read_gbq(self.query, self.project_id)
File "./venv/lib/python3.6/site-packages/pandas/io/gbq.py", line 100, in read_gbq
**kwargs)
File "./venv/lib/python3.6/site-packages/pandas_gbq/gbq.py", line 906, in read_gbq
dialect=dialect, auth_local_webserver=auth_local_webserver)
File "./venv/lib/python3.6/site-packages/pandas_gbq/gbq.py", line 202, in __init__
self.credentials = self.get_credentials()
File "./venv/lib/python3.6/site-packages/pandas_gbq/gbq.py", line 214, in get_credentials
credentials = self.get_application_default_credentials()
File "./venv/lib/python3.6/site-packages/pandas_gbq/gbq.py", line 243, in get_application_default_credentials
credentials, _ = google.auth.default(scopes=[self.scope])
File "./venv/lib/python3.6/site-packages/google/auth/_default.py", line 281, in default
credentials, project_id = checker()
File "./venv/lib/python3.6/site-packages/google/auth/_default.py", line 158, in _get_gae_credentials
from google.auth import app_engine
File "./venv/lib/python3.6/site-packages/google/auth/app_engine.py", line 32, in <module>
from google.appengine.api import app_identity
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 946, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 881, in _find_spec
File "<frozen importlib._bootstrap>", line 855, in _find_spec_legacy
File "./venv/lib/python3.6/site-packages/pyximport/pyximport.py", line 253, in find_module
fp, pathname, (ext,mode,ty) = imp.find_module(fullname,package_path)
File "~/.pyenv/versions/3.6.1/lib/python3.6/imp.py", line 270, in find_module
"not {}".format(type(path)))
RuntimeError: 'path' must be None or a list, not <class '_frozen_importlib_external._NamespacePath'>
Our requirements file looks like the following:
cachetools==2.0.1
certifi==2017.7.27.1
chardet==3.0.4
et-xmlfile==1.0.1
fbprophet==0.2
google-api-python-client==1.6.4
google-auth==1.1.1
google-auth-httplib2==0.0.2
google-auth-oauthlib==0.1.1
httplib2==0.10.3
idna==2.6
jdcal==1.3
numpy==1.12.1
oauth2client==4.1.2
oauthlib==2.0.4
openpyxl==2.4.8
pandas==0.20.1
pandas-gbq==0.2.0
psycopg2==2.7.3.1
py==1.4.34
pyasn1==0.3.7
pyasn1-modules==0.1.5
pyodbc==4.0.17
pytest==3.2.2
python-dateutil==2.6.0
pytz==2017.2
PyYAML==3.12
requests==2.18.4
requests-oauthlib==0.8.0
rpy2==2.8.5
rsa==3.4.2
six==1.10.0
SQLAlchemy==1.1.9
sqlalchemy-redshift==0.6.0
uritemplate==3.0.0
urllib3==1.22
xlrd==1.1.0
This happens on a fresh clone with a fresh virtual environment, running Python 3.6.1 on OS X. Reproduced on two machines. Honestly at a bit of a loss where to even start. It worked before but something has regressed causing it to fail, but the way it dies suggests it isn't entirely because of us?
Literally any clues would be helpful! :)
This is a bug due to a conflict between PyStan (which Facebook's Prophet uses) and one of the Google authentication libraries (which the BigQuery API uses). Something to do with the use of pyximport.
There's an issue on Prophet here which you can track, but finding a fix looks like it'll be difficult.
I was able to resolve this by upgrading Cython from 0.25.2 to 0.29 as suggested here.

Categories