Home > Back-end >  Pandas not found despite installation - Mac M1
Pandas not found despite installation - Mac M1

Time:12-29

I have a new MacBook Pro M1 with mini-forge, arch i386 and am trying to run Pandas without success.

As an example, I have a python script with "import pandas as pd" (line 1) which returns error because it can not find Pandas.

File "test.py", line 1, in import pandas as pd ModuleNotFoundError: No module named 'pandas'

I have tried to run (and installed) Pandas both in and outside of en environment installed Pandas both in and outside of an environment but none is recognised and returns the error.

I have installed Pandas - Thats not the problem here.
Do you have any idea of possible solutions for such problem?

CodePudding user response:

You need to install numpy first in your environment, this worked for me:

python3 -m pip install virtualenv
virtualenv -p python3.8 venv
source venv/bin/activate
pip install --upgrade pip
pip install numpy cython
git clone https://github.com/pandas-dev/pandas.git
cd pandas
python3 setup.py install

As seen here: how to install pandas on m1 Mac

CodePudding user response:

How did you install pandas? As I also have M1 Macbook, it is no matter.

Maybe you can check if directory which you installed pandas is in sys.path directories.

CodePudding user response:

The simplest approach for installing pandas is to install it as part of the Anaconda distribution

conda create - n name_of_my_env
source activate name_of_my_env
activate name_of_my_env
conda install pandas
conda install pandas = 0.20 .3

As seen here

  • Related