aircraft
aircraft

Reputation: 26924

Use the `pip install tornado` on Mac get error:Permission denied: '/Library/Python/2.7/site-packages/singledispatch.py

Use the pip install tornado on Mac get error:

aircraftdeMacBook-Pro:~ ldl$ pip install tornado
Collecting tornado
  Downloading tornado-4.5.1.tar.gz (483kB)
    100% |████████████████████████████████| 491kB 565kB/s 
Collecting singledispatch (from tornado)
  Downloading singledispatch-3.4.0.3-py2.py3-none-any.whl
Collecting certifi (from tornado)
  Downloading certifi-2017.4.17-py2.py3-none-any.whl (375kB)
    100% |████████████████████████████████| 378kB 565kB/s 
Collecting backports_abc>=0.4 (from tornado)
  Downloading backports_abc-0.5-py2.py3-none-any.whl
Requirement already satisfied: six in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from singledispatch->tornado)
Installing collected packages: singledispatch, certifi, backports-abc, tornado
Exception:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip-9.0.1-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.1-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.1-py2.7.egg/pip/req/req_set.py", line 784, in install
    **kwargs
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 851, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 1064, in move_wheel_files
    isolated=self.isolated,
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/wheel.py", line 345, in move_wheel_files
    clobber(source, lib_dir, True)
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/wheel.py", line 323, in clobber
    shutil.copyfile(srcfile, destfile)
  File "/System/Library/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: '/Library/Python/2.7/site-packages/singledispatch.py'

Upvotes: 0

Views: 825

Answers (3)

dynamo
dynamo

Reputation: 126

  1. Try pip install tornado.
  2. If any permission errors are coming in terminal then try sudo pip install tornado.

Upvotes: 0

notorious.no
notorious.no

Reputation: 5107

In general, when instructions say:

To install package123 run pip install package123

99% of the time, it's assuming that the package is being installed in a Python virtual environment (via virtualenv or venv). With that being said, you should install Tornado in a virtual environment and avoid sudo pip install tornado. Nothing bad will happen if you do use sudo other than pollution of your system packages with 3rd party modules.

Upvotes: 1

aircraft
aircraft

Reputation: 26924

After struggle, I use sudo pip install tornado solved it.

Collecting tornado
  Downloading tornado-4.5.1.tar.gz (483kB)
    100% |████████████████████████████████| 491kB 557kB/s 
Collecting singledispatch (from tornado)
  Downloading singledispatch-3.4.0.3-py2.py3-none-any.whl
Collecting certifi (from tornado)
  Downloading certifi-2017.4.17-py2.py3-none-any.whl (375kB)
    100% |████████████████████████████████| 378kB 641kB/s 
Collecting backports_abc>=0.4 (from tornado)
  Downloading backports_abc-0.5-py2.py3-none-any.whl
Requirement already satisfied: six in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from singledispatch->tornado)
Installing collected packages: singledispatch, certifi, backports-abc, tornado
  Running setup.py install for tornado ... done
Successfully installed backports-abc-0.5 certifi-2017.4.17 singledispatch-3.4.0.3 tornado-4.5.1

Upvotes: 1

Related Questions