Skip to content

DOC: Added documentation for ImportError's #30912

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Feb 12, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions doc/source/getting_started/10min.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ Customarily, we import as follows:
import numpy as np
import pandas as pd

Note: In case you encounter an import error, :ref:`Handling ImportErrors` section of installation documentation.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the CI error: https://github.com/pandas-dev/pandas/pull/30912/checks?check_run_id=388068051#step:6:4623

I don't think you can add a link using the title section. You'll have to create a label before the title section, and link with the label. You should plenty of examples in the docs, but the label should be something like:

.. _install.import_errors:

and this link something like:

:ref:`Handling ImportErrors<install.import_errors>`

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much for the help!! I felt that it was an unnecessary line either way so on removal, the checks passed.


Object creation
---------------

Expand Down
25 changes: 25 additions & 0 deletions doc/source/getting_started/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,31 @@ To install pandas for Python 2, you may need to use the ``python-pandas`` packag
to get the newest version of pandas, it's recommended to install using the ``pip`` or ``conda``
methods described above.

Handling ImportErrors
~~~~~~~~~~~~~~~~~~~~~~

If you encounter an ImportError, it usually means that Python couldn't find pandas in the list of available
libraries. Python internally has a list of directories it searched through, to find packages. You can
obtain these directories with::

import sys
sys.path

One way you could be encountering this error is if you have multiple Python installations on your system
and you don't have pandas installed in the Python installation you're currently using.
In Linux/Mac you can run ``which python`` on your terminal and it will tell you which is the Python you're
using. If it's something like "/usr/bin/python", you're using the Python from the system, which is not recommended.

If you used Python before you may have used virtual environments and pip. While this is fine for many
Python projects (e.g. Django), when using data projects (pandas, numpy, tensorflow, etc.) this is discouraged.
It's easily susceptible to installation errors in non-Python dependencies and the libraries can run slower
while using pip to perform installations.
The widely used solution to this problem is to use conda. You can find simple installation instructions
for pandas in this document: `installation instructions </getting_started.html>`.

Another possible way of fixing the error is by first finding the version of your python installation with::

python --version

Installing from source
~~~~~~~~~~~~~~~~~~~~~~
Expand Down