From 428ef84824f4676942c92d97d651e35ed0db39e8 Mon Sep 17 00:00:00 2001 From: Madhuri Palanivelu Date: Sat, 11 Jan 2020 01:21:23 -0800 Subject: [PATCH 1/7] Added documentation for ImportError in docs/source/getting_started/install.rst --- doc/source/getting_started/10min.rst | 2 ++ doc/source/getting_started/install.rst | 29 ++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/doc/source/getting_started/10min.rst b/doc/source/getting_started/10min.rst index 3055a22129b91..30c70b167e595 100644 --- a/doc/source/getting_started/10min.rst +++ b/doc/source/getting_started/10min.rst @@ -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. + Object creation --------------- diff --git a/doc/source/getting_started/install.rst b/doc/source/getting_started/install.rst index b3fd443e662a9..b5fc77f04c5ad 100644 --- a/doc/source/getting_started/install.rst +++ b/doc/source/getting_started/install.rst @@ -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 +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.(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 +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. + +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: + sudo pip2 install pandas + +If you get Python 3.7.x, then try the following command to install pandas: + sudo pip3 install pandas Installing from source ~~~~~~~~~~~~~~~~~~~~~~ From 78e8790d0df6d7f529ae729872587139dd0ab97e Mon Sep 17 00:00:00 2001 From: Madhuri Palanivelu Date: Sat, 11 Jan 2020 18:59:22 -0800 Subject: [PATCH 2/7] Modified docs to include info about ImportErrors --- doc/source/getting_started/install.rst | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/doc/source/getting_started/install.rst b/doc/source/getting_started/install.rst index b5fc77f04c5ad..4f85a57faea67 100644 --- a/doc/source/getting_started/install.rst +++ b/doc/source/getting_started/install.rst @@ -165,11 +165,12 @@ to get the newest version of pandas, it's recommended to install using the ``pip 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: +obtain these directories with:: + import sys sys.path @@ -185,13 +186,16 @@ 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. -Another possible way of fixing the error is by first finding the version of your python installation with: +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: +If you get Python 2.7.x, then try the following command to install pandas:: + sudo pip2 install pandas -If you get Python 3.7.x, then try the following command to install pandas: +If you get Python 3.7.x, then try the following command to install pandas:: + sudo pip3 install pandas Installing from source From cf616ec8000c0d7e61aa050195cc3f2b7797b021 Mon Sep 17 00:00:00 2001 From: Madhuri Palanivelu Date: Mon, 13 Jan 2020 16:05:54 -0800 Subject: [PATCH 3/7] Modified docs after corrections --- doc/source/getting_started/install.rst | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/doc/source/getting_started/install.rst b/doc/source/getting_started/install.rst index 4f85a57faea67..13d8cd4be9867 100644 --- a/doc/source/getting_started/install.rst +++ b/doc/source/getting_started/install.rst @@ -167,7 +167,7 @@ methods described above. Handling ImportErrors ~~~~~~~~~~~~~~~~~~~~~~ -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 libraries. Python internally has a list of directories it searched through, to find packages. You can obtain these directories with:: @@ -176,28 +176,20 @@ obtain these directories with:: 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) +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 and the libraries can run slower while using pip to perform -installations. +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: https://dev.pandas.io/getting_started.html. +for pandas in this document: `installation instructions `. 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:: - - sudo pip2 install pandas - -If you get Python 3.7.x, then try the following command to install pandas:: - - sudo pip3 install pandas - Installing from source ~~~~~~~~~~~~~~~~~~~~~~ From e2667b30c463d632be89807563f4ef9ea2d788ba Mon Sep 17 00:00:00 2001 From: Madhuri Palanivelu Date: Sat, 18 Jan 2020 13:04:34 -0800 Subject: [PATCH 4/7] Modified docs after corrections --- doc/source/getting_started/10min.rst | 2 -- 1 file changed, 2 deletions(-) diff --git a/doc/source/getting_started/10min.rst b/doc/source/getting_started/10min.rst index 30c70b167e595..3055a22129b91 100644 --- a/doc/source/getting_started/10min.rst +++ b/doc/source/getting_started/10min.rst @@ -16,8 +16,6 @@ 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. - Object creation --------------- From 99e3fc1a30f48ddb79a2090a06a1d61ef52eecf3 Mon Sep 17 00:00:00 2001 From: Madhuri Palanivelu Date: Fri, 31 Jan 2020 17:46:07 -0800 Subject: [PATCH 5/7] Updated changes regarding virtual-env --- doc/source/getting_started/install.rst | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/doc/source/getting_started/install.rst b/doc/source/getting_started/install.rst index 13d8cd4be9867..6bd748cf09cdd 100644 --- a/doc/source/getting_started/install.rst +++ b/doc/source/getting_started/install.rst @@ -179,12 +179,8 @@ and you don't have pandas installed in the Python installation you're currently 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 `. +It is highly recommended to use ``conda``, for quick installation and for package and dependency updates. +You can find simple installation instructions for pandas in this document: `installation instructions `. Another possible way of fixing the error is by first finding the version of your python installation with:: From 3b830e0d47ab155ce9986cd1f470713833583145 Mon Sep 17 00:00:00 2001 From: Madhuri Palanivelu Date: Fri, 31 Jan 2020 17:48:31 -0800 Subject: [PATCH 6/7] Updated changes regarding virtual-env --- doc/source/getting_started/install.rst | 4 ---- 1 file changed, 4 deletions(-) diff --git a/doc/source/getting_started/install.rst b/doc/source/getting_started/install.rst index 6bd748cf09cdd..25ab2ce4ad1fa 100644 --- a/doc/source/getting_started/install.rst +++ b/doc/source/getting_started/install.rst @@ -182,10 +182,6 @@ using. If it's something like "/usr/bin/python", you're using the Python from th It is highly recommended to use ``conda``, for quick installation and for package and dependency updates. You can find simple installation instructions for pandas in this document: `installation instructions `. -Another possible way of fixing the error is by first finding the version of your python installation with:: - - python --version - Installing from source ~~~~~~~~~~~~~~~~~~~~~~ From 13188ffc7c136d59bbf4b195ae01a56e19505208 Mon Sep 17 00:00:00 2001 From: Madhuri Palanivelu Date: Fri, 31 Jan 2020 17:56:40 -0800 Subject: [PATCH 7/7] Updated changes regarding virtual-env --- doc/source/getting_started/install.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/source/getting_started/install.rst b/doc/source/getting_started/install.rst index 25ab2ce4ad1fa..2561bc198a2ff 100644 --- a/doc/source/getting_started/install.rst +++ b/doc/source/getting_started/install.rst @@ -168,7 +168,7 @@ 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 +libraries. Python internally has a list of directories it searches through, to find packages. You can obtain these directories with:: import sys @@ -176,7 +176,7 @@ obtain these directories with:: 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 +In Linux/Mac you can run ``which python`` on your terminal and it will tell you which Python installation you're using. If it's something like "/usr/bin/python", you're using the Python from the system, which is not recommended. It is highly recommended to use ``conda``, for quick installation and for package and dependency updates.