-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
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
Changes from 1 commit
428ef84
78e8790
cf616ec
e2667b3
99e3fc1
3b830e0
13188ff
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -164,6 +164,35 @@ 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 | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
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 | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. better use double backticks for |
||||||
using. If it's something like "/usr/bin/python", you're using the Python from the system.(Not recommended) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
If you used Python before you may have used virtual environments and pip. While this is fine for many | ||||||
gonemad97 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
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 | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
small detail, but I think it's better to clarify, since we don't want to give the impression that pip is unreliable. |
||||||
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. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
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.
|
||||||
|
||||||
Another possible way of fixing the error is by first finding the version of your python installation with: | ||||||
python --version | ||||||
|
||||||
If you get Python 2.7.x, then try the following command to install pandas: | ||||||
gonemad97 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
sudo pip2 install pandas | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. :) |
||||||
|
||||||
If you get Python 3.7.x, then try the following command to install pandas: | ||||||
sudo pip3 install pandas | ||||||
|
||||||
Installing from source | ||||||
~~~~~~~~~~~~~~~~~~~~~~ | ||||||
|
There was a problem hiding this comment.
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:
and this link something like:
There was a problem hiding this comment.
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.