I got an error when pip install pandas on Mac, so I dealt with it

Work history

$ pip install pandas
Downloading/unpacking pandas
  Downloading pandas-0.15.2-cp27-none-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (6.7MB): 6.7MB downloaded
Downloading/unpacking numpy>=1.7.0 (from pandas)
  Downloading numpy-1.9.1-cp27-none-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (3.6MB): 3.6MB downloaded
Requirement already satisfied (use --upgrade to upgrade): python-dateutil in /usr/local/lib/python2.7/site-packages (from pandas)
Downloading/unpacking pytz>=2011k (from pandas)
  Downloading pytz-2014.10-py2.py3-none-any.whl (477kB): 477kB downloaded
Requirement already satisfied (use --upgrade to upgrade): six in /usr/local/lib/python2.7/site-packages (from python-dateutil->pandas)
Installing collected packages: pandas, numpy, pytz
Cleaning up...
Exception:
Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/commands/install.py", line 283, in run
    requirement_set.install(install_options, global_options, root=options.root_path)
  File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 1435, in install
    requirement.install(install_options, global_options, *args, **kwargs)
  File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 671, in install
    self.move_wheel_files(self.source_dir, root=root)
  File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 901, in move_wheel_files
    pycompile=self.pycompile,
  File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/wheel.py", line 215, in move_wheel_files
    clobber(source, lib_dir, True)
  File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/wheel.py", line 209, in clobber
    shutil.copy2(srcfile, destfile)
  File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 130, in copy2
    copyfile(src, dst)
  File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 83, in copyfile
    with open(dst, 'wb') as fdst:
IOError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/site-packages/numpy/__config__.pyc'

Storing debug log for failure in /Users/tmsanrinsha/.pip/pip.log

ʻIOError: [Errno 13] Permission denied:'/usr/local/lib/python2.7/site-packages/numpy/config.pyc'` I just noticed that it seems that the installation of numpy was bad.

However, I didn't understand it during the work, so I thought it would work if I executed the script of fonnesbeck / ScipySuperpack @ GitHub.

$ curl 'https://raw.githubusercontent.com/fonnesbeck/ScipySuperpack/master/install_superpack.sh' | sh

I noticed this now, but there is a wording stty: stdin isn't a terminal in the middle, and the selection after that

Would you like to use Python 2.7 or Python 3.4? (2/3)

Can't select with

Invalid selection. Quitting.

And failed. So as written on the site

$ curl -o install_superpack.sh https://raw.githubusercontent.com/fonnesbeck/ScipySuperpack/master/install_superpack.sh
$ sh install_superpack.sh

Seems to need to. However, when I tried it now, there are various things, so it may be better to stop this.

So, I wondered if numpy was bad, and when I did pip install numpy, I got the same error as pip install pandas, so I thought pip was suspicious.

$ pip install -U pip

After

$ pip install -U numpy

Then the error changed,

Traceback (most recent call last):
  File "/usr/local/bin/pip", line 5, in <module>
    from pkg_resources import load_entry_point
  File "build/bdist.macosx-10.10-x86_64/egg/pkg_resources.py", line 2951, in <module>
  File "build/bdist.macosx-10.10-x86_64/egg/pkg_resources.py", line 563, in _build_master
  File "build/bdist.macosx-10.10-x86_64/egg/pkg_resources.py", line 576, in _build_from_requirements
  File "build/bdist.macosx-10.10-x86_64/egg/pkg_resources.py", line 755, in resolve
pkg_resources.DistributionNotFound: pip==1.5.6

It became. As you'll see later, this is an error caused by updating pip.

I wonder if python is bad

$ brew uninstall python
$ brew install python --build-fromsource

I did, but it didn't change.

$ brew uninstall numpy
$ brew install numpy

Then

Warning: It looks like the deprecated gfortran formula is installed.
This causes build problems with numpy. gfortran is now provided by
the gcc formula. Please run:
    brew rm gfortran
    brew install gcc

I got this message,

$ brew rm gfortran
$ brew install gcc
$ brew install numpy

Then

Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink lib/python2.7/site-packages/numpy/__config__.py
Target /usr/local/lib/python2.7/site-packages/numpy/__config__.py
already exists. You may want to remove it:
  rm '/usr/local/lib/python2.7/site-packages/numpy/__config__.py'

To force the link and overwrite all conflicting files:
  brew link --overwrite numpy

To list all files that would be deleted:
  brew link --overwrite --dry-run numpy

Possible conflicting files are:
/usr/local/lib/python2.7/site-packages/numpy/__config__.py
/usr/local/lib/python2.7/site-packages/numpy/__init__.py

I got the error. This seems to be the cause of the error that appeared in pip install pandas.

$ brew link --overwrite numpy

And solve it.

After that, I found an article about pip error Python --What to do if pip issues DistributionError in Homebrew --Qiita, so it is written there. like

$ rm /usr/local/bin/pip /usr/local/bin/pip2 /usr/local/bin/pip2.7
$ python -m pip install --upgrade --force-reinstall pip

Then I solved it and was able to pip install pandas.

Summary

After all, the error I got with the first pip install pandas is

IOError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/site-packages/numpy/__config__.pyc'

There is a problem with numpy. To solve this, uninstall and install numpy. However, I got an error, so follow it.

$ brew uninstall numpy
$ brew rm gfortran
$ brew install gcc
$ brew install numpy
$ brew link --overwrite numpy

Also, the error that came out because I updated pip on the way

$ rm /usr/local/bin/pip /usr/local/bin/pip2 /usr/local/bin/pip2.7
$ python -m pip install --upgrade --force-reinstall pip

It will be solved by.

Recommended Posts

I got an error when pip install pandas on Mac, so I dealt with it
I got an error when pip install tweepy on macOS Sierra, so I dealt with it
I got an SSL related error with pip install, so I solved it
I get an error when trying to install maec 4.0.1.0 with pip
I got an error when saving with OpenCV
I got a UnicodeDecodeError when pip install on ubuntu
A memorandum when an error occurs with pip install
I got an error when using Tensorboard with Pytorch
When I installed python on macOS and used it, I got an error when I put an https connection
# Solution when pip install gives an error when using Anaconda on Windows 10
When I get an error with Pylint in Atom on Windows
I get an error with import pandas.
When I get an error with PyInstaller
I got an SSL Error when I installed Anaconda in a new environment, so I solved it (Windows10, Anaconda3-2019.10)
I got an error when trying to install Xgboost and its solution
I can't install Dask with pip on Ubuntu
Eliminates SSL error when PIP Install on Windows.
I got stuck trying to install various things with Mac El captain pip, so make a note
Workaround if you get an error when trying to install PySide with pip
I got an error when I put opencv in python3 with Raspberry Pi [Remedy]
Error with pip install
Install selenium on Mac and try it with python
For those who are in trouble with an error when pip install xg boost
When moss with pip install
Install pandas 0.14 on python3.4 [on Mac]
I cried with `pip install --upgrade pip` with Bad md5 hash for package, but it got better
I got an error when I tried to process luigi in parallel on windows, but the solution
Dealing with PermissionError [Error 1] for pip install -U pip on macOS Sierra
Error and solution when installing python3 with homebrew on mac (catalina 10.15)
I got an error when I ran composer global require laravel / installer
I got stuck so I reviewed it
Install lp_solve on Mac OS X and call it with python.
Proxy error when running "pip install"
I got an error when I ran meteor add accounts-password and got hooked
SSL certificate related with pip install? Error
Solution for pip install error [Python] [Mac]
I want to pip install with PythonAnywhere
scipy stumbles with pip install on python 2.7.8
Error, warning when using TensorFlow on Mac
I can't install the package with pip.
I tried to publish my own module so that I can pip install it
I got an error when trying to run Hello World in Go language
Error when installing a module with Python pip
Install pip and pandas with Ubuntu or VScode
I get an error with all yum commands
Rollback processing when an error occurs with fabric
[Personal memo] pip install fails, so solve it
I get an error when installing scipy on t2.micro because I don't have enough memory
When I try to import pandas on macOS I get the error No module named'_bz2'
When I try to install mysqlclient with Django, I get error: command'gcc' failed with exit status 1.
I couldn't install numpy using poetry on macOS Big Sur, so I forcibly avoided it
I get an error when I try to raise Python to 3 series using pyenv on Catalina
After changing the account name on Mac, pip and ipython became unusable, so I reinstalled the whole python and it was cured
I got an error that Python couldn't read settings.ini
I like Python's comprehension, so I compared it with map
I get an error when I put opencv in pyautoGUI
I get an error when trying meinheld + WebSocket + mongodb
Install PyQt5 with homebrew on Mac OS X Marvericks (10.9.2)
I want to AWS Lambda with Python on Mac!
When architecture not supported comes out with pip (Mac)
psql: I ran into an error with an invalid option --'''.