Fundamentals 4 min read

How to Fix pip Uninstall Errors for NumPy When Installing Pandas on macOS

When rebuilding a Plotly environment on macOS, pip fails to uninstall the system‑installed NumPy, causing pandas installation errors, and the solution involves manually removing NumPy’s egg‑info, using a reliable PyPI mirror, and selecting compatible library versions.

FunTester
FunTester
FunTester
How to Fix pip Uninstall Errors for NumPy When Installing Pandas on macOS

While re‑creating a Plotly environment on a Mac, the author encountered an error when trying to install pandas with pip because pip could not uninstall the existing numpy package:

Cannot uninstall 'numpy'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

The message indicates that NumPy was installed via distutils as part of the system Python, so pip cannot safely remove it.

To work around this, the author manually inspected the system library directory, located the NumPy egg‑info file, and moved it to a backup location:

/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python$ ls | grep numpy
numpy-1.8.0rc1-py2.7.egg-info
sudo mv numpy-1.8.0rc1-py2.7.egg-info /Users/fv/

After backing up the egg‑info, the author re‑installed NumPy and pandas using the Tsinghua University PyPI mirror (which is faster for users in China):

sudo pip install --index-url https://pypi.tuna.tsinghua.edu.cn/simple numpy
sudo pip install --index-url https://pypi.tuna.tsinghua.edu.cn/simple pandas

Additional tips highlighted:

Older NumPy versions (e.g., 2.4) are more stable on macOS; newer 3.+ releases have many bugs.

Always verify dependency versions; an outdated version can cause Plotly to report missing modules.

By manually handling the system‑installed NumPy and using a reliable mirror with compatible versions, the pandas installation succeeds and the Plotly environment can be restored.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

troubleshootingmacOSpandasNumPyplotlypip
FunTester
Written by

FunTester

10k followers, 1k articles | completely useless

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.