简体   繁体   中英

Numpy/ Pandas/ Matplotlib taking too long to install

I've decided to install of MacOs Big Sur and now I do have to reinstall all the packages again... But I'm facing some problems.

I don't have much experience using terminal, but it is taking too long to install some data science libraries. For example, to install numpy it took some minutes, and right now, it's been 15 minutes since I've started to try to install the pandas lib

pip3 install pandas
Defaulting to user installation because normal site-packages is not writeable
Collecting pandas   Using cached pandas-1.1.4.tar.gz (5.2 MB)
Installing build dependencies ... -
Getting requirements to build wheel ... done
Preparing wheel metadata ... done
Requirement already satisfied: numpy>=1.15.4 in ./Library/Python/3.8/lib/python/site-packages (from pandas) (1.19.4)
Collecting pytz>=2017.2
Downloading pytz-2020.4-py2.py3-none-any.whl (509 kB)
 |████████████████████████████████| 509 kB 1.2 MB/s 
Requirement already satisfied: python-dateutil>=2.7.3 in ./Library/Python/3.8/lib/python/site-packages (from pandas) (2.8.1)
Requirement already satisfied: six>=1.5 in /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages (from python-dateutil>=2.7.3->pandas) (1.15.0)
Building wheels for collected packages: pandas
Building wheel for pandas (PEP 517) ... \

I've been stuck at this screen for ages. 15 minutes, minimum. I can hear the fans of the computer working at full speed, also the laptop is getting warm. Why is it taking so long? Since it's only a small lib... I don't remember taking this amount of time when I installed it previously on another MacOs versions... Am I doing something wrong? Thank you.

Looks like Pip can not find an appropriate Pandas wheel for your platform (macOS 11.0, Python 3.8). The closest available match is for macOS 10.x. Instead, Pip needs to build the wheel (compile and link the library) before installing.

I can't say for sure without testing, but I suspect the platform tag changed on Big Sur from macosx_10_9_x86_64 to something like macosx_11_0... .

Until numpy/pandas maintainers release binary wheels for your platform, one option is to build them yourself.

Seems the homebrew Python doesn't suffer from this problem, so you might want to give this a try .

Main issue seems to be Big Sur trying to protect this python3 installation it ships with. python@3.8 as is on the OS will throw these problems such as

Defaulting to user installation because normal site-packages is not writeable

I'd recommend installing another version of python3.8 with

brew install python@3.8

and writing a symlink to use that in the future.

ln -s -f /usr/local/opt/python@3.8... /usr/bin/python3

从 Python 官方网站安装python-3.7.3后,我能够安装 numpy,看起来在 3.7.3 的环境中安装 numpy 没有任何问题。

UPDATE: (As of Oct 20, 2021) Python 3.10, released on Oct 4, 2021 is not compatible with MacOS11. Errors in build process from scratch warn that "some code will never be executed." I suspect incompatibility between xcode and clang calls. TBH, save yourself the heartbreak and go for the Anaconda/miniconda distros.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM