AttributeError: module 'pandas' has no attribute 'tslib' when I use blaze module

1.9k Views Asked by At

I have below environment

Linux "16.04"
Python 3.6.11
conda 4.8(latest)

I've two dependencies in my project

- blaze=0.11.3=py36_0
- pandas=1.0.5=py36h0573a6f_0

While resolving conda and pip dependencies, it is throwing below error

Traceback (most recent call last):
AttributeError: module 'pandas' has no attribute 'tslib'
  File "/home/ubuntu/miniconda/envs/my_env/bin/my_project", line 6, in <module>
    from my_project.cli import main
  File "/home/ubuntu/my_project/src/my_project/cli.py", line 3, in <module>
    from my_project.dbi import DatabaseConfig, DatabaseType
  File "/home/ubuntu/my_project/src/my_project/dbi.py", line 3, in <module>
    import blaze as bz
  File "/home/ubuntu/miniconda/envs/my_env/lib/python3.6/site-packages/blaze/__init__.py", line 9, in <module>
    from odo import odo, convert, append, drop, resource
  File "/home/ubuntu/miniconda/envs/my_env/lib/python3.6/site-packages/odo/__init__.py", line 29, in <module>
    from .backends.pandas import pd
  File "/home/ubuntu/miniconda/envs/my_env/lib/python3.6/site-packages/odo/backends/pandas.py", line 94, in <module>
    @convert.register((pd.Timestamp, pd.Timedelta), (pd.tslib.NaTType, type(None)))

It looks like blaze is failing to get proper pandas version. So I tried to upgrade blaze(so that it'll auto download nested latest version of pandas), but I found that there are no updates for the blaze library. https://github.com/blaze/blaze/tags

Also I see that 0.11.3 version is compatible with conda latest version, https://docs.anaconda.com/anaconda/packages/py3.6_linux-64/

Please let me know what is the best solution to resolve this...

2

There are 2 best solutions below

2
On

I was having a similar problem with odo which has a blaze dependence, I installed the github package and it was fine. Try installing the GitHub version of blaze and see if it works.

1
On

I found the solution on github.

There are problem with pandas.py file inside odo package. So in Ubuntu you need to go to Computer/usr/local/lib/python3.8/dist-packages/odo/backends/ and open pandas.py. Than in line 94, change

pd.tslib.NaTType

to

type(pd.NaT)