0

I'm trying to set up the environment to do some Python on a new laptop. I did brew install python3 first, then went to make sure I had pip installed with pip --version. The terminal said I didn't, so I did brew install pip.

Then I went to install pipenv with pip install pipenv. I got this error message:

Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/9t/pk6bmgc968d_fys24blkrgc40000gn/T/pip-build-o6M3Ve/pipenv/.

Searching that, I saw people saying that pip's setup tools needed to be updated with pip install --upgrade setuptools. When I tried that I got a really long error, which I'll post below. I'm in way over my head with this one and don't know where to start. Any and all help is appreciated.

Exception:

Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip-9.0.3-py2.7.egg/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip-9.0.3-py2.7.egg/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/Library/Python/2.7/site-packages/pip-9.0.3-py2.7.egg/pip/req/req_set.py", line 778, in install
    requirement.uninstall(auto_confirm=True)
  File "/Library/Python/2.7/site-packages/pip-9.0.3-py2.7.egg/pip/req/req_install.py", line 754, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "/Library/Python/2.7/site-packages/pip-9.0.3-py2.7.egg/pip/req/req_uninstall.py", line 115, in remove
    renames(path, new_path)
  File "/Library/Python/2.7/site-packages/pip-9.0.3-py2.7.egg/pip/utils/__init__.py", line 267, in renames
    shutil.move(old, new)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 299, in move
    copytree(src, real_dst, symlinks=True)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 208, in copytree
    raise Error, errors

Error:

[('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc', '/var/folders/9t/pk6bmgc968d_fys24blkrgc40000gn/T/pip-Rp7V_U-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc', "[Errno 1] Operation not permitted: '/var/folders/9t/pk6bmgc968d_fys24blkrgc40000gn/T/pip-Rp7V_U-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.py', '/var/folders/9t/pk6bmgc968d_fys24blkrgc40000gn/T/pip-Rp7V_U-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.py', "[Errno 1] Operation not permitted: '/var/folders/9t/pk6bmgc968d_fys24blkrgc40000gn/T/pip-Rp7V_U-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py', '/var/folders/9t/pk6bmgc968d_fys24blkrgc40000gn/T/pip-Rp7V_U-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py', "[Errno 1] Operation not permitted: '/var/folders/9t/pk6bmgc968d_fys24blkrgc40000gn/T/pip-Rp7V_U-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.pyc', '/var/folders/9t/pk6bmgc968d_fys24blkrgc40000gn/T/pip-Rp7V_U-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.pyc', "[Errno 1] Operation not permitted: '/var/folders/9t/pk6bmgc968d_fys24blkrgc40000gn/T/pip-Rp7V_U-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib', '/var/folders/9t/pk6bmgc968d_fys24blkrgc40000gn/T/pip-Rp7V_U-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib', "[Errno 1] Operation not permitted: '/var/folders/9t/pk6bmgc968d_fys24blkrgc40000gn/T/pip-Rp7V_U-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib'")]
user3483203
  • 50,081
  • 9
  • 65
  • 94
bkula
  • 541
  • 3
  • 10
  • 22
  • after you install python3 by brew, you should use `pip3` or make soft link to `pip`,(no need to install `pip` by brew) can reference to my another answer here: https://stackoverflow.com/questions/40832533/pip-or-pip3-to-install-packages-for-python-3/40832702#40832702 – CSJ Mar 26 '18 at 22:32
  • @CSJ Do I need to get rid of `pip`? – bkula Mar 26 '18 at 22:34
  • yes, remove it as below answer mentioned too – CSJ Mar 26 '18 at 22:37

1 Answers1

1

You have installed Python version 3 but the pip that belongs to Python version 2. First of all, uninstall the pip that you have installed. Now you should install pip3, e.g. using brew install pip3. However, pip3 should have been installed along with Python 3, so first make sure that pip3 really is not already installed.

jmd_dk
  • 12,125
  • 9
  • 63
  • 94