Why do I get AttributeError: type object 'Placeholder' has no attribute 'loads', when running pyisntaller?

I am using Python 3.10.6, pip 22.2.2 on Windows 11

I have a program which uses yfinance to grab stock data and sklearn.svr to predict stock data. I want to turn this program into a .exe file using pyisntaller. Pyinstaller finished and the .exe file is created but when I want to run it i get:

 File "PyInstaller\loader\pyimod02_importers.py", line 493, in exec_module
  File "requests_cache\__init__.py", line 7, in <module>
  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 "PyInstaller\loader\pyimod02_importers.py", line 493, in exec_module
  File "requests_cache\backends\__init__.py", line 7, in <module>
  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 "PyInstaller\loader\pyimod02_importers.py", line 493, in exec_module
  File "requests_cache\backends\base.py", line 18, in <module>
  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 "PyInstaller\loader\pyimod02_importers.py", line 493, in exec_module
  File "requests_cache\serializers\__init__.py", line 6, in <module>
  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 "PyInstaller\loader\pyimod02_importers.py", line 493, in exec_module
  File "requests_cache\serializers\preconf.py", line 122, in <module>
  File "requests_cache\serializers\pipeline.py", line 44, in __init__
  File "requests_cache\serializers\pipeline.py", line 44, in <listcomp>
AttributeError: type object 'Placeholder' has no attribute 'loads'

And when the pyisntaller is building the .exe file I get:

587 WARNING: Failed to collect submodules for 'pkg_resources._vendor.pyparsing.diagram' because importing 'pkg_resources._vendor.pyparsing.diagram' raised: AttributeError: module 'railroad' has no attribute 'DiagramItem'

So I think that the problem is because of matplotlib? I use it at the end to plot the predicted price.

The imports I am using on my program are:

import yfinance as yf
import requests_cache
import numpy as np
from sklearn.svm import SVR 
import matplotlib.pyplot as plt
import datetime as dt 

I ran the program by moving into the right directory and than running:

pyinstaller --onefile -w stockPredictor.py



Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation