Can't import pandas today

I don’t know what’s changed but I can’t import pandas module in my SWAN jupyter notebook today with below errors.

ModuleNotFoundError Traceback (most recent call last)
~/.local/lib/python3.6/site-packages/pandas/ in
31 try:
—> 32 from pandas._libs import hashtable as _hashtable, lib as _lib, tslib as _tslib
33 except ImportError as e: # pragma: no cover

~/.local/lib/python3.6/site-packages/pandas/_libs/ in
----> 3 from .tslibs import (
4 NaT,

~/.local/lib/python3.6/site-packages/pandas/_libs/tslibs/ in
----> 3 from .conversion import localize_pydatetime, normalize_date
4 from .nattype import NaT, NaTType, iNaT, is_null_datetimelike

ModuleNotFoundError: No module named ‘pandas._libs.tslibs.conversion’

During handling of the above exception, another exception occurred:

ImportError Traceback (most recent call last)
1 import uproot
----> 2 import pandas as pd
3 import sys,os, time
4 import re
5 import numpy as np

~/.local/lib/python3.6/site-packages/pandas/ in
35 module = str(e).replace("cannot import name ", “”)
36 raise ImportError(
—> 37 f"C extension: {module} not built. If you want to import "
38 "pandas from the source directory, you may need to run "
39 "‘python build_ext --inplace --force’ to build "

ImportError: C extension: No module named ‘pandas._libs.tslibs.conversion’ not built. If you want to import pandas from the source directory, you may need to run ‘python build_ext --inplace --force’ to build the C extensions first.
It was fine yesterday.

Hi Zhen,

Directory ls ~/.local/lib/python3.6/site-packages/ is in your personal EOS. You installed pandas also in ~/.local/lib/python3.6/site-packages/pandas that convicts with the one provided by us.

Can you try removing your custom pandas version from ~/.local/lib/python3.6/site-packages/pandas ?

Hi Piotr, yes, I can import pandas without my customized config script. But the version of pandas was out of date. I need 1.0.2+ but default version in SWAN is 0.24.2.
I had a specific thread Update pandas version in swan notebook for this issue.
Anyway, my personal script still worked yesterday and suddenly broken this morning. On another hand, could any administration can update the default version of pandas to the latest one? Or someone should take care the update of most used python modules?(such as Matplotlib, pandas, scipy etc.)

Hi Zyan, we updated to LCG97 today, and now Python3 is default. What was the python version you previously used? Can you try selecting LCG96 python2/python3 and see if this works ?

You can also try installing your Pandas again, meaning, remove everything in ~/.local if this is not a problem and try again Update pandas version in swan notebook ?

Hi Piotr, I just tried with LCG96 python3 and my code is still working.
Then I was confused by which .local/ I should remove as you mentioned because I have different home directories of my lxplus and my eos now. For instance,
I tried to run ‘pip3 install --user pandas’ at lxplus and this command installed the new pandas version 1.0.3 into my ./local/bin/ of my lxplus home directory instead of /eos/user/z/zyan/.local/lib/python3.6/site-packages/ of my EOS home directory. Then I tried with ‘pip install --user pandas’ . This time installation path was pointed to my eos/home-z/.local/ correctly but failed by old pip version because my pip was python2.7 . And I can’t do ‘pip install --upgrade pip’ as well.

Hi Zhen,

Python2 is EOL, and we made it a secondary choice. Also, you can use > sign in SWAN to open terminal, similar to lxplus. My suggested approaches would be

  1. Use as previously LCG96python3 with what you have in EOS
  2. Select LCG97 (python3), remove /eos/…/.local/ and install pandas again.