1

Whenever I run the command python3.6 Check.py, I get the following error,

Pandas Error

Traceback (most recent call last): File "/usr/lib/python3/dist-packages/pandas/init.py", line 30, in from pandas._libs import hashtable as _hashtable, lib as _lib, tslib as _tslib File "/usr/lib/python3/dist-packages/pandas/_libs/init.py", line 3, in from .tslibs import ( File "/usr/lib/python3/dist-packages/pandas/_libs/tslibs/init.py", line 3, in from .conversion import localize_pydatetime, normalize_date
ModuleNotFoundError: No module named 'pandas._libs.tslibs.conversion'

During handling of the above exception, another exception occurred: Traceback (most recent call last): ​File "Check.py", line 2, in ​import pandas as pd ​File "/usr/lib/python3/dist-packages/pandas/init.py", line 38, in ​"the C extensions first.".format(module) 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 setup.py build_ext --inplace --force' to build the C extensions first.

I quickly google the error and find this link: No module named 'pandas._libs.tslib'

I uninstall pandas: uninstall message

Found existing installation: pandas 1.3.3 Uninstalling pandas-1.3.3: Would remove: /u/riker/u97/pmohanty/.local/lib/python3.8/site-packages/pandas-1.3.3.dist-info/* /u/riker/u97/pmohanty/.local/lib/python3.8/site-packages/pandas/* Proceed (y/n)? y Successfully uninstalled pandas-1.3.3

I reinstall it: reinstall message

Requirement already satisfied: pandas in /usr/lib/python3/dist-packages (0.25.3)

I upgrade it too: upgrade message

Collecting pandas Using cached pandas-1.3.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.5 MB) Requirement already satisfied, skipping upgrade: numpy>=1.17.3 in /u/riker/u97/pmohanty/.local/lib/python3.8/site-packages (from pandas) (1.21.2) Requirement already satisfied, skipping upgrade: pytz>=2017.3 in /u/riker/u97/pmohanty/.local/lib/python3.8/site-packages (from pandas) (2021.1) Requirement already satisfied, skipping upgrade: python-dateutil>=2.7.3 in /u/riker/u97/pmohanty/.local/lib/python3.8/site-packages (from pandas) (2.8.2) Requirement already satisfied, skipping upgrade: six>=1.5 in /u/riker/u97/pmohanty/.local/lib/python3.8/site-packages (from python-dateutil>=2.7.3->pandas) (1.16.0) Installing collected packages: pandas Successfully installed pandas-1.3.3

Despite following the steps my file won't run. Strangely it works for python3, python3.8, but not for python3.6.

python3 --version outputs 3.8.10

python3.6 --version outputs 3.6.9

pip --version outputs pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)

I am new to python and pandas and stackoverflow. Any help is appreciated.

PS: I need to get it to work in 3.6 :'(

2
  • 1
    Show errors and other messages as properly formatted text in the question, not as image or external link. Commented Sep 29, 2021 at 18:25
  • Please provide enough code so others can better understand or reproduce the problem. Commented Oct 7, 2021 at 9:08

1 Answer 1

1

If you really need it to work in python 3.6, you need to install it for python 3.6:

python3.6 -m pip install pandas

See e.g. this article for a discussion of why this works.

Sign up to request clarification or add additional context in comments.

7 Comments

I get " ModuleNotFoundError: No module named 'distutils.util'"
then your python 3.6 installation is broken, and you need to fix that before installing pandas. You might be able to get round it with python3.6 -m ensurepip.
I will try installing it. But ssh won't let me use sudo commands for installing python3.6. Are there other ways? Sorry I am really new to this 😅
ah, so you're sshing into a server. If you can't sudo that's got nothing to do with ssh. Do you run the server? why exactly do you have to use python 3.6? AFAIK you don't need root to run ensurepip anyhow, but I could be wrong
In that case you have no choice: you have been given the option of a deliberately limited python3.6, or a working 3.8. If you are allowed to use pandas, write for the 3.8 taking care not to use f-strings. In any case this is something to take up with your institution: ask them how they expect you to install packages, and what you are allowed to install.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.