2
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -DNPY_NO_DEPRECATED_API=0 -Ipandas/_libs/src/ujson/python -Ipandas/_libs/src/ujson/lib -Ipandas/_libs/src/datetime -I/Users/jesse/Desktop/ssc/pythonProject3/venv/lib/python3.8/site-packages/numpy/core/include -I/Users/jesse/Desktop/ssc/pythonProject3/venv/include -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8 -c pandas/_libs/src/ujson/python/ujson.c -o build/temp.macosx-10.14.6-arm64-3.8/pandas/_libs/src/ujson/python/ujson.o -D_GNU_SOURCE -Wno-unused-function
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -DNPY_NO_DEPRECATED_API=0 -Ipandas/_libs/src/ujson/python -Ipandas/_libs/src/ujson/lib -Ipandas/_libs/src/datetime -I/Users/jesse/Desktop/ssc/pythonProject3/venv/lib/python3.8/site-packages/numpy/core/include -I/Users/jesse/Desktop/ssc/pythonProject3/venv/include -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8 -c pandas/_libs/src/ujson/python/objToJSON.c -o build/temp.macosx-10.14.6-arm64-3.8/pandas/_libs/src/ujson/python/objToJSON.o -D_GNU_SOURCE -Wno-unused-function
    pandas/_libs/src/ujson/python/objToJSON.c:181:12: error: use of undeclared identifier 'NUMPY_IMPORT_ARRAY_RETVAL'
        return NUMPY_IMPORT_ARRAY_RETVAL;
               ^
    1 error generated.
    error: command 'clang' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /Users/jesse/Desktop/ssc/pythonProject3/venv/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/ky/s4qqls154f9c4j5lfcfspbpm0000gn/T/pip-install-t5zlzk09/pandas_67e63708ec954c589e697c9f10e3730c/setup.py'"'"'; __file__='"'"'/private/var/folders/ky/s4qqls154f9c4j5lfcfspbpm0000gn/T/pip-install-t5zlzk09/pandas_67e63708ec954c589e697c9f10e3730c/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/ky/s4qqls154f9c4j5lfcfspbpm0000gn/T/pip-record-cnus0d48/install-record.txt --single-version-externally-managed --compile --install-headers /Users/jesse/Desktop/ssc/pythonProject3/venv/include/site/python3.8/pandas Check the logs for full command output.
(base) 

I want to download pandas on Mac mini using PyCharm.

What should I do?

j3lly_bEan
  • 21
  • 1
  • 1
  • 2

7 Answers7

10

This was answered on:

Trouble installing Pandas on new MacBook Air M1

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
caeneb
  • 109
  • 3
  • Doesn't work. I needed to install an extra lib (versioneer) and after installing pandas still can't be used cause of import error: `ModuleNotFoundError: No module named 'pandas._libs.pandas_parser'` – Dominux Apr 12 '23 at 13:06
1

You have to have numpy installed in your environment to build pandas from source for all versions of pandas that come without a pyproject.toml. Please install numpy first and try again.


If numpy is installed on your machine you may need to update the version using pip install numpy -U or an equivalent command executed via PyCharm GUI.

Konrad
  • 17,740
  • 16
  • 106
  • 167
  • 1
    This helped me. Uninstalling numpy followed by installing pandas (therby updating numpy) solved my issue – DFeng Oct 25 '22 at 22:12
1

While caeneb's trick worked like a charm, I found that upgrading your python to a later version and updating pip worked as well.

for me these where the commands that did the trick (I manage my python installation with pyenv)

pyenv install 3.9.9
pyenv global 3.9.9 # use this python version as the default
pip install pandas # just works

I guess that without pyenv you can simply run the following commands (untested)

brew install python@3.9.9
$(brew --prefix)/bin/python3.9 -m pip install pandas # makes sure to use the right pip
Pinna_be
  • 4,517
  • 2
  • 18
  • 34
  • Why does this work though? – jtlz2 Mar 15 '22 at 07:05
  • I am not 100% certain, but it might have something to do with latest releases of pandas only being available on newer python versions. ([increased minimum version for python](https://pandas.pydata.org/docs/whatsnew/v1.4.0.html#increased-minimum-version-for-python)). – Pinna_be Mar 15 '22 at 08:28
1

From manually reviewing the numpy git log, downgrading numpy using pip install numpy==1.18.5 and then

OPENBLAS="$(brew --prefix openblas)" MACOSX_DEPLOYMENT_TARGET=12.4 pip3 install pandas==0.25.3 --no-use-pep517

After installation of pandas, I was able to upgrade numpy again

SurenNihalani
  • 1,398
  • 2
  • 15
  • 28
0

I recommend you to use conda, so that you can install virtual environments, also with different python version and eventually with different R (and also node.js). Much simpler and programs are pre-compiled (and conda was created for such cases).

Else, are you sure you have xcode installed? Check on Apple store. Xcode is the "SDK" (developer toolkit) of Apple with the compiler: the clang: you doesn't have it, so the error. It gives you also other tools which are generally needed for pip. Note: you should also execute manually also one xcode command, to be able to accept the xcode condition (else you may have problem on scripts which uses xcode).

Giacomo Catenazzi
  • 8,519
  • 2
  • 24
  • 32
0

This works for me pip install git+git://github.com/pandas-dev/pandas.git

Dilip K
  • 31
  • 2
-3

$pip install pandas

For installing pip in Mac :

$curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

OR

  • Install python with homebrew:

    brew install python

  • Make sure of correct path:

    $which python

  • Now install pandas:

    $pip install pandas

Alok Tripathi
  • 874
  • 10
  • 9
  • this solution does not solve the problem in question due to the specific nature of M1 (Apple Silicon) which is ARM and not Intel architecture. – Jansen Simanullang Feb 16 '22 at 03:57