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

Conversation

gonemad97
Copy link
Contributor

…stall.rst

Copy link
Member

@datapythonista datapythonista left a comment

Choose a reason for hiding this comment

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

Thanks for working on this @gonemad97, nice work. Added few comments, but looks great.

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

If you encounter an ImportError,it usually means that Python couldn't find pandas in the list of available
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
If you encounter an ImportError,it usually means that Python couldn't find pandas in the list of available
If you encounter an ImportError, it usually means that Python couldn't find pandas in the list of available


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
Copy link
Member

Choose a reason for hiding this comment

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

better use double backticks for which python.

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.(Not recommended)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
using. If it's something like "/usr/bin/python", you're using the Python from the system.(Not recommended)
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 and the libraries can run slower while using pip to perform
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
It's easily susceptible to installation errors and the libraries can run slower while using pip to perform
It's easily susceptible to installation errors in non-Python dependencies and the libraries can run slower while using pip to perform

small detail, but I think it's better to clarify, since we don't want to give the impression that pip is unreliable.

It's easily susceptible to installation errors 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: https://dev.pandas.io/getting_started.html.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
for pandas in this document: https://dev.pandas.io/getting_started.html.
for pandas in this document: /getting_started.html.

The dev.pandas.io domain is probably going to disappear, and the production page anyway will be in pandas.io. But it's better to not use the domain, in case we change it in the future.

Also, it's probably better to use something like (or at least make the link clickable.

You can use the simple `installation instructions </getting_started.html>`_ in the pandas website.


If you get Python 2.7.x, then try the following command to install pandas::

sudo pip2 install pandas
Copy link
Member

Choose a reason for hiding this comment

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

Remove this last part please, we surely don't want anyone to install pandas in the root environment as root. :)

@datapythonista datapythonista marked this pull request as ready for review January 13, 2020 14:31
@datapythonista datapythonista changed the title Added documentation for ImportError in docs/source/getting_started/in… DOC: Added documentation for ImportError's Jan 13, 2020
@gonemad97
Copy link
Contributor Author

I've made the changes you've mentioned! While building on my system, I didn't face any issues, but while building it here, I'm unable to find the reason for the build failure. Could you help me out @datapythonista ?

@@ -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.

@gonemad97
Copy link
Contributor Author

gonemad97 commented Jan 27, 2020

@datapythonista Can you check if this can be merged? All the checks have passed!
Thanks!

Copy link
Member

@datapythonista datapythonista left a comment

Choose a reason for hiding this comment

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

Looks good to me, thanks @gonemad97

@gonemad97 gonemad97 requested a review from WillAyd February 1, 2020 07:03
@WillAyd WillAyd added this to the 1.1 milestone Feb 12, 2020
@WillAyd WillAyd merged commit 1e6cf96 into pandas-dev:master Feb 12, 2020
@WillAyd
Copy link
Member

WillAyd commented Feb 12, 2020

Thanks @gonemad97

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DOC: ImportError: No module named pandas
3 participants