jupyter / jupyter/notebook

Error importing pandas on Jupyter notebook with Anaconda

Open
#3,592 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
13.3k
Forks
5.8k
Avg merge
6d 11h
Merged PRs (30d)
7

Description

Hi all,

I'm having the same issues above - when I try to do:
import pandas as pd,

I get the following:

```
ModuleNotFoundError Traceback (most recent call last)
~\AppData\Roaming\Python\Python36\site-packages\pandas_init_.py in ()
25 try:
---> 26 from pandas._libs import (hashtable as _hashtable,
27 lib as _lib,

~\AppData\Roaming\Python\Python36\site-packages\pandas_libs_init_.py in ()
3
----> 4 from .tslib import iNaT, NaT, Timestamp, Timedelta, OutOfBoundsDatetime
5

ModuleNotFoundError: No module named 'pandas._libs.tslib'

During handling of the above exception, another exception occurred:

ImportError Traceback (most recent call last)
in ()
----> 1 import pandas as pd

~\AppData\Roaming\Python\Python36\site-packages\pandas_init_.py in ()
33 "pandas from the source directory, you may need to run "
34 "'python setup.py build_ext --inplace --force' to build "
---> 35 "the C extensions first.".format(module))
36
37 from datetime import datetime

ImportError: C extension: No module named 'pandas._libs.tslib' 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 have tried installing anaconda multiple times, miniconda as well.
Now I'm back to anaconda and have set up the environment path myself.
But not sure how to solve this error after trying to follow the recommended steps.

Current paths are:
C:\Users\User\Anaconda3;C:\Users\User\Anaconda3\Scripts;C:\Users\User\Anaconda3\pkgs;C:\Users\User\AppData\Roaming\Python\Python36\site-packages

Have been stuck for 2 days, any help would be much appreciated.

Thanks,

Contributor guide

Open the contributing guide

Research direction

Start with the traceback showing pandas._libs.tslib missing and compare the listed Anaconda and Python 3.6 paths with the interpreter used by the Jupyter notebook. Reproduce the import in that environment and determine whether the issue belongs to Jupyter Notebook or the pandas/Anaconda installation; done means the cause is identified and import pandas succeeds.

Written by the indexing model from the issue text.

Assessment

Tech stack
anaconda, jupyter-notebook, pandas, python
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
15/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.