Jupyter python3 laptop cannot recognize pandas

I am using a Jupyter laptop with Python 3 selected. In the first line of the cell, I enter:

import pandas as pd 

The error I get from the notebook: ImportError: there is no module named "pandas". How can I install pandas on a Jupyter laptop? There are definitely pandas on the computer from which I released the Jupyter laptop.

I tried to do:

 !pip install pandas 

And he says it is already installed, but for Python 2.7 below. My script shows that this is a Python 3 script at the top.

When I do echo, $ PATH in Ubuntu shows that '/ home / user / anaconda2 / bin' is in the first entry. I think I need to change this to be anaconda3?

UPDATE: When I try to run a Python3 script through jupyter, the command line that launched Jupyter gives the error message “ImportError: there is no module named IPython.paths.” Then, there is a timeout for waiting for a response “kernel_info”. In addition, I tried removing the anaconda, but the same error still occurs. I tried to make so many quick fixes now that I'm not sure what the next step should make it work.

+22
source share
13 answers

Since your default python version is 2.x, if you have no emphasis on python 3.x, you can try it first with the scripts below.

 pip install --upgrade pip pip install jupyter 

then in jupyter laptop:

 !pip install pandas 

The laptop version will be 2.x. Otherwise, install pip3 using the following Linux commands.

 sudo apt-get install python3-setuptools sudo easy_install3 pip 

now you can add pandas to notepad !pip3 install pandas .

+16
source

If you are already using anaconda as a distribution, stop using pip in this context. Use conda instead and you will not have a headache. Command lines and procedures for setting up a new environment are pretty well described here .

Basically updating Python or having certain branches:

 conda update python conda install python=3.5 

Or using certain environments:

 conda create -n py35 python=3.5 anaconda 
+6
source

If pip3 is installed, you can run

 !pip3 install pandas 
+4
source
+3
source

simple step to solve the problem

( NOTE: remember that you have chosen Python 2 or Python 3).

for python 2+

 !pip install pandas 

or if you have a type of user permission error

 !pip install pandas --user 

for python 3+

 !pip3 install pandas 

or if you have a type of user permission error

 !pip3 install pandas --user 
+3
source

This is what I did on my system:

I installed both anaconda for python 2.7 and anaconda for python 3.5. Anaconda helps keep the environment separate.

In Ubuntu:

The directory structure looks like this: anaconda2 / bin / anaconda3 / bin /

Whenever I want to use python 2.7, I go to anaconda2 / bin / and create an environment or activate an existing environment, and also install or import all the necessary packages, as well as for python3.5 (go to anconda3 / bin / create or activate the desired environment). It helps me keep things aside.

Since you are using anaconda, you must first use "conda install", if this package is not found, then you can use pip installation.

On Windows:

If you installed both anaconda2 and anaconda3, it's pretty simple .. the shortcuts for the anaconda request are listed in C: \ Users \ your-username \

there will be two folders anconda2 and anaconda3, you can run the conda request for python2.7 from anaconda2 and python3.5 from anconda3

So, as soon as you run the anaconda tooltip, you can simply type “jupyter notebook” to open the jupyter notebook in your browser and import pandas (or any package).

You can check this link:

http://conda.pydata.org/docs/test-drive.html#managing-conda

+2
source

I am facing the same problem in jupyter laptop and I run the command below and solve my problem:

 !pip install pandas 
+1
source

For windows

The first step is to create a new conda environment. The conda environment is similar to virtualenv, which allows you to specify a specific version of Python and a set of libraries. Run the following commands from the terminal window:

 conda create -n name_of_my_env python 

This will create a minimal environment in which only Python will be installed. To put yourself in this environment, run:

 source activate name_of_my_env 

On Windows, the command looks like this:

 activate name_of_my_env 

The last necessary step is to install pandas. This can be done using the following command:

 conda install pandas 

To install a specific version for pandas:

 conda install pandas=0.20.3 

To install other packages, for example IPython:

 conda install ipython 

To install the full Anaconda distribution:

 conda install anaconda 

If you need packages available for pip but not conda, install pip and then use pip to install these packages:

 conda install pip pip install django 
+1
source

The Iuse 7 window is for work, and I had the same problems when I tried to import Pandas. So I tried installing packages in each environment:

Run cmd and enter the following code:

 activate py27 conda install pandas 

If the system asks you to install the following new packages, select Y for [yes]

And install pandas for every other environment if you installed Python27, Python 35 and Python 36, just like me.

Then the problem is resolved if you run jupyter notebook again and you can import pandas successfully.

You can also solve the same problem for packages like numpy, scipy, etc.

0
source

Perhaps this is a broken (pip) installation. After me worked:

sudo apt --fix-broken install

The following are:

sudo pip3 install pandas

Hope this helps.

0
source

I get an error

modulenotfounderror: no module named 'pandas'

in jupiter. I tried the command:

 !pip install pandas 

and it worked like a charm.

0
source

I also have this problem where Jupyter does not recognize pandas. I tried everything in this thread. It works fine in non-jupyter (as in the pycharm project), but jupyter doesn't seem to like poor pandas. What should I do?

Jupiter problem image

Image no problem in a regular Python project

0
source

My version for pandas was 0.20.3. I upgraded to 0.25 using conda update pandas . I checked in the command line interface (CLI) its pd.__version__ '0.25.1' .

Jupyter notepad displays "0.20.3".

Please restart your Jupyter laptop. note caches your pandas. or you can create a new notebook

0
source

Source: https://habr.com/ru/post/1012252/


All Articles