Pylivetrader pandas issue


Getting below error after installing pylivetrader and tried to run a simple example. The issue seems to be with pandas and wondering if anyone can shed some light on how to solve this.

Appreciate the help in advance.


c:\spb_data.conda\envs\alpaca\lib\site-packages\pylivetrader\misc\ FutureWarning: The pandas.tslib module is deprecated and will be removed in a future version.
from pandas.tslib import normalize_date # noqa
Traceback (most recent call last):
File “c:\spb_data.conda\envs\alpaca\lib\site-packages\pylivetrader\misc\”, line 18, in
from pandas._libs.tslib import normalize_date # noqa
ImportError: cannot import name ‘normalize_date’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “c:\spb_data.conda\envs\alpaca\lib\”, line 193, in run_module_as_main
main”, mod_spec)
File “c:\spb_data.conda\envs\alpaca\lib\”, line 85, in run_code
exec(code, run_globals)
File "C:\SPB_Data.conda\envs\alpaca\Scripts\pylivetrader.exe_main
.py", line 4, in
File "c:\spb_data.conda\envs\alpaca\lib\site-packages\pylivetrader_init
.py", line 17, in
from .algorithm import Algorithm # noqa
File “c:\spb_data.conda\envs\alpaca\lib\site-packages\pylivetrader\”, line 30, in
from import handle_non_market_minutes
File “c:\spb_data.conda\envs\alpaca\lib\site-packages\pylivetrader\data\”, line 22, in
from pylivetrader.misc.pd_utils import normalize_date
File “c:\spb_data.conda\envs\alpaca\lib\site-packages\pylivetrader\misc\”, line 20, in
from pandas.tslib import normalize_date # noqa
File “c:\spb_data.conda\envs\alpaca\lib\site-packages\pandas\”, line 6, in
from pandas._libs.tslib import (Timestamp, Timedelta,
ImportError: cannot import name ‘Timedelta’

what version of pandas do you have installed?

Tried to create new env with fresh installation. Got below error. You can see the list of pandas version below also. Thanks in advance for looking into this issue.


[2020-10-29 21:28:30.337582] INFO: Algorithm: livetrader start running with backend = alpaca data-frequency = minute
Traceback (most recent call last):
File “c:\users\veguthik.conda\envs\alpaca\lib\”, line 193, in _run_module_as_main
main”, mod_spec)
File “c:\users\veguthik.conda\envs\alpaca\lib\”, line 85, in run_code
exec(code, run_globals)
File "C:\Users\veguthik.conda\envs\alpaca\Scripts\pylivetrader.exe_main
.py", line 7, in
File “c:\users\veguthik.conda\envs\alpaca\lib\site-packages\click\”, line 829, in call
return self.main(*args, **kwargs)
File “c:\users\veguthik.conda\envs\alpaca\lib\site-packages\click\”, line 782, in main
rv = self.invoke(ctx)
File “c:\users\veguthik.conda\envs\alpaca\lib\site-packages\click\”, line 1259, in invoke
return process_result(sub_ctx.command.invoke(sub_ctx))
File “c:\users\veguthik.conda\envs\alpaca\lib\site-packages\click\”, line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “c:\users\veguthik.conda\envs\alpaca\lib\site-packages\click\”, line 610, in invoke
return callback(*args, **kwargs)
File “c:\users\veguthik.conda\envs\alpaca\lib\site-packages\click\”, line 21, in new_func
return f(get_current_context(), *args, **kwargs)
File "c:\users\veguthik.conda\envs\alpaca\lib\site-packages\pylivetrader_main
.py", line 277, in run
File “c:\users\veguthik.conda\envs\alpaca\lib\site-packages\pylivetrader\”, line 268, in run
File “c:\users\veguthik.conda\envs\alpaca\lib\site-packages\pylivetrader\”, line 223, in initialize
self.state_store.load(self, self.algoname)
File "c:\users\veguthik.conda\envs\alpaca\lib\site-packages\pylivetrader\statestore_init
.py", line 105, in load
loaded_state = self.storage_engine.load()
File "c:\users\veguthik.conda\envs\alpaca\lib\site-packages\pylivetrader\statestore_init
.py", line 40, in load
loaded_state = pickle.load(f)
ModuleNotFoundError: No module named ‘pandas._libs.tslibs.timestamps’

packages in environment at C:\Users\username.conda\envs\alpaca:

Name Version Build Channel

alembic 1.4.3 pypi_0 pypi
alpaca-trade-api 0.51.0 pypi_0 pypi
astor 0.8.1 pypi_0 pypi
backcall 0.2.0 pypi_0 pypi
bcolz 0.12.1 pypi_0 pypi
blas 1.0 mkl
bottleneck 1.3.2 pypi_0 pypi
certifi 2020.6.20 py36haa95532_2
chardet 3.0.4 pypi_0 pypi
click 7.1.2 pypi_0 pypi
colorama 0.4.4 pypi_0 pypi
contextlib2 0.6.0.post1 pypi_0 pypi
cyordereddict 1.0.0 pypi_0 pypi
cython 0.29.21 pypi_0 pypi
decorator 4.4.2 pypi_0 pypi
empyrical 0.5.5 pypi_0 pypi
icc_rt 2019.0.0 h0cc432a_1
idna 2.10 pypi_0 pypi
iexfinance 0.4.3 pypi_0 pypi
intel-openmp 2019.4 245
intervaltree 3.1.0 pypi_0 pypi
ipython 7.16.1 pypi_0 pypi
ipython-genutils 0.2.0 pypi_0 pypi
jedi 0.17.2 pypi_0 pypi
logbook 1.5.3 pypi_0 pypi
lru-dict 1.1.6 pypi_0 pypi
lxml 4.6.1 pypi_0 pypi
mako 1.1.3 pypi_0 pypi
markupsafe 1.1.1 pypi_0 pypi
mkl 2018.0.3 1
mkl_fft 1.0.6 py36hdbbee80_0
mkl_random 1.0.1 py36h77b88f5_1
multipledispatch 0.6.0 pypi_0 pypi
networkx 1.11 pypi_0 pypi
numexpr 2.7.1 pypi_0 pypi
numpy 1.14.5 py36h9fa60d3_4
numpy-base 1.14.5 py36h5c71026_4
pandas 0.22.0 py36h6538335_0
pandas-datareader 0.8.1 pypi_0 pypi
parso 0.7.1 pypi_0 pypi
patsy 0.5.1 pypi_0 pypi
pickleshare 0.7.5 pypi_0 pypi
pip 20.2.4 py36_0
pipeline-live 0.1.9 pypi_0 pypi
prompt-toolkit 3.0.8 pypi_0 pypi
pygments 2.7.2 pypi_0 pypi
pylivetrader 0.5.2 pypi_0 pypi
python 3.6.12 h5500b2f_2
python-dateutil 2.8.1 py_0
python-editor 1.0.4 pypi_0 pypi
pytz 2020.1 py_0
pyyaml 5.3.1 pypi_0 pypi
requests 2.24.0 pypi_0 pypi
requests-file 1.5.1 pypi_0 pypi
scipy 1.5.3 pypi_0 pypi
setuptools 50.3.0 py36h9490d1a_1
six 1.15.0 py_0
sortedcontainers 2.2.2 pypi_0 pypi
sqlalchemy 1.3.20 pypi_0 pypi
sqlite 3.33.0 h2a8f88b_0
statsmodels 0.11.1 pypi_0 pypi
tables 3.6.1 pypi_0 pypi
tbb 2020.3 h74a9793_0
tbb4py 2020.3 py36h74a9793_0
toolz 0.11.1 pypi_0 pypi
trading-calendars 2.0.0 pypi_0 pypi
traitlets 4.3.3 pypi_0 pypi
urllib3 1.25.11 pypi_0 pypi
vc 14.1 h0510ff6_4
vs2015_runtime 14.16.27012 hf0eaf9b_3
wcwidth 0.2.5 pypi_0 pypi
websocket-client 0.57.0 pypi_0 pypi
websockets 8.1 pypi_0 pypi
wheel 0.35.1 py_0
wincertstore 0.2 py36h7fe50ca_0
zipline 1.3.0 pypi_0 pypi
zlib 1.2.11 h62dcd97_4

versions look alright…
I would try uninstalling pandas and then manually installing with pip.

Hmmmm…Showing the same issue even after uninstalling and re-installing everything from scratch.
I am using Anconda. Wondering if there are any step-by-step instructions from any user who is successful in getting it right?

PS: I know Quantopian is shutting down but I have several algos from there that I want to deploy.

Hopefully pylivetrader would be supported in future also since it is based on zipline.

Pylivetrader is still supported, regardless to Quantopian closing.

try installing with pip.

Hi Shlomik,

Tried with pip. Still same issue.

Below are my exact steps:

  1. conda create --name alpaca
  2. conda install python=3.6
  3. pip install pandas=0.22.0
  4. pip install pylivetrader
  5. pylivetrader run --backend-config config.yaml

Do you mind repeating steps to see if the problem replicates? I have been stuck for quite sometime on this.


try this:
this is an issue someone faced before with settings similar to yours


I followed installed ubuntu virtualenv based on the link that you provided. Still the problem is same.

I finally tried pandas=0.23.0 instead of pandas=0.22.0 even though pylivetrader guthub requirement documents says to use pandas<=0.22.0. I was expecting some kind of error but to my surprise it worked!


1 Like

Limit on Pandas come from zipline 1.3.0
I will test that