nose icon indicating copy to clipboard operation
nose copied to clipboard

Cannot install nose without superuser privileges

Open ngoldbaum opened this issue 7 years ago • 6 comments

Currently when I try to install nose with pip, I'm getting the following error:

$ pip install -U nose
Collecting nose
  Using cached nose-1.3.7-py2-none-any.whl
Installing collected packages: nose
Exception:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/usr/local/lib/python2.7/site-packages/pip/commands/install.py", line 317, in run
    prefix=options.prefix_path,
  File "/usr/local/lib/python2.7/site-packages/pip/req/req_set.py", line 742, in install
    **kwargs
  File "/usr/local/lib/python2.7/site-packages/pip/req/req_install.py", line 831, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "/usr/local/lib/python2.7/site-packages/pip/req/req_install.py", line 1032, in move_wheel_files
    isolated=self.isolated,
  File "/usr/local/lib/python2.7/site-packages/pip/wheel.py", line 378, in move_wheel_files
    clobber(source, dest, False, fixer=fixer, filter=filter)
  File "/usr/local/lib/python2.7/site-packages/pip/wheel.py", line 317, in clobber
    ensure_dir(destdir)
  File "/usr/local/lib/python2.7/site-packages/pip/utils/__init__.py", line 83, in ensure_dir
    os.makedirs(path)
  File "/usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 150, in makedirs
    makedirs(head, mode)
  File "/usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/usr/local/man'

I'm unsure why pip is trying to write to /usr/local here. After asking on pypi, someone suggested it was due to this line in nose's setup.py file: https://github.com/nose-devs/nose/blob/master/setup.py#L109

ngoldbaum avatar Sep 26 '16 15:09 ngoldbaum

FWIW, if I remove line 109 from nose's setup.py file, I'm able to successfully install.

ngoldbaum avatar Sep 26 '16 15:09 ngoldbaum

Just encountered this problem myself, while installing something depending on nose. Took a while to narrow the problem down and find this issue.

Creating /usr/local/man myself resolves the problem, and the installer doesn't even create a file there. Not sure what's going wrong here that produces this behavior.

sparr avatar Sep 13 '17 17:09 sparr

A fix for https://github.com/Homebrew/install/issues/109 will resolve this problem.

sparr avatar Sep 13 '17 18:09 sparr

https://github.com/Homebrew/install/issues/109 is closed and won't be addressed.

resolving this problem will require either convincing the nose devs to put their man page in /usr/local/share/man or convincing the homebrew-core python formula devs to modify the behavior of pip to recognize attempts to write to /usr/local/man should end up in /usr/local/share/man

sparr avatar Sep 13 '17 20:09 sparr

additional reports of this problem, all caused by nose:

https://github.com/jupyter-incubator/sparkmagic/issues/380 http://qiita.com/hshimo/items/392a981cd1ac8fcd268d http://wordpress.ideacompo.com/?p=7900

sparr avatar Sep 13 '17 20:09 sparr

I would suggest that nose not try to install the man page at all. If someone needs to package the man page for e.g. debian, they can do that manually.

ngoldbaum avatar Sep 13 '17 20:09 ngoldbaum