Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure to install pylint when prompted to do so (Permission Denied) #386

Closed
stewartadam opened this issue Dec 11, 2017 · 13 comments
Closed
Assignees
Labels
area-linting feature-request Request for new features or functionality
Milestone

Comments

@stewartadam
Copy link
Member

stewartadam commented Dec 11, 2017

Environment data

VS Code version: 1.181
Python Extension version: 0.8.0
Python Version: 2.7.10
OS and version: macOS 10.13.2

Actual behavior

Opening a .py file prompts to install pylint. Pylint installation fails.

Expected behavior

Pylint installation succeeds.

Steps to reproduce:

  • Open VS Code
  • Open a Python file
  • Click on prompt to install pyline

Logs

/usr/bin/python -m pip install pylint
TARS:~ stewartadam$ /usr/bin/python -m pip install pylint
Collecting pylint
  Using cached pylint-1.7.4-py2.py3-none-any.whl
Requirement already satisfied: six in ./Library/Python/2.7/lib/python/site-packages (from pylint)
Collecting isort>=4.2.5 (from pylint)
  Using cached isort-4.2.15-py2.py3-none-any.whl
Collecting singledispatch; python_version < "3.4" (from pylint)
  Using cached singledispatch-3.4.0.3-py2.py3-none-any.whl
Collecting mccabe (from pylint)
  Using cached mccabe-0.6.1-py2.py3-none-any.whl
Collecting configparser; python_version == "2.7" (frompylint)
Collecting backports.functools-lru-cache; python_version == "2.7" (from pylint)
  Using cached backports.functools_lru_cache-1.4-py2.py3-none-any.whl
Collecting astroid>=1.5.1 (from pylint)
  Using cached astroid-1.5.3-py2.py3-none-any.whl
Collecting wrapt (from astroid>=1.5.1->pylint)
Requirement already satisfied: enum34>=1.1.3; python_version < "3.4" in ./Library/Python/2.7/lib/python/site-packages (from astroid>=1.5.1->pylint)
Collecting lazy-object-proxy (from astroid>=1.5.1->pylint)
Installing collected packages: isort, singledispatch, mccabe, configparser, backports.functools-lru-cache, wrapt, lazy-object-proxy, astroid, pylint
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 342, in run
    prefix=options.prefix_path,
  File "/usr/local/lib/python2.7/site-packages/pip/req/req_set.py", line 784, in install
    **kwargs
  File "/usr/local/lib/python2.7/site-packages/pip/req/req_install.py", line 851, 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 1064, in move_wheel_files
    isolated=self.isolated,
  File "/usr/local/lib/python2.7/site-packages/pip/wheel.py", line 345, in move_wheel_files
    clobber(source, lib_dir, True)
  File "/usr/local/lib/python2.7/site-packages/pip/wheel.py", line 316, 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 "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/isort'
TARS:~ stewartadam$
@stewartadam
Copy link
Member Author

Note: I'm aware of other alternatives such as sudo or --user that can be used to install pylint, this issue is reported in that it should not fail for users by default.

@brettcannon brettcannon added awaiting 1-decision area-linting feature-request Request for new features or functionality labels Dec 11, 2017
@DonJayamanne
Copy link

I don't think sudo is a good option. If such an error appears, then IMHO its time for the user to start using a virtual environment. As for not displaying this error, I don't know its worth checking the user has permissions to install or not, if there's an error in pip install, then isn't that for the user to resolve.
I guess this all boils down to UX.

@MikhailArkhipov
Copy link

Users probably don't have install permissions by default or otherwise one app could silently install another. I'd expect this kind of hardening from OS similarly to what happens on devices.

Somewhat related microsoft/vscode#1614 and
https://github.com/jorangreef/sudo-prompt

@DonJayamanne
Copy link

@MikhailArkhipov sounds like a good solution. One hiccup we run the command in a terminal. Guess we'll have to change the way we install the packages.

@MikhailArkhipov
Copy link

OK, I can look into this

@MikhailArkhipov MikhailArkhipov self-assigned this Dec 15, 2017
@esutton
Copy link

esutton commented Dec 15, 2017

I think sudo-prompt would be a good solution.

macos

I see many development package installers on macOS using something similar.

I think Xcode 9.2 is using this or something similar to request "helper" support.

@brettcannon
Copy link
Member

I'm slowly starting to think we might want to offer to install a private copy of tools in the extension itself to avoid these kinds of issues.

@MikhailArkhipov
Copy link

MikhailArkhipov commented Dec 15, 2017

Here is what I coded up (need to sort out stdout/err outputs)

image

image

@brettcannon
Copy link
Member

I'm a little leery of supporting people installing into a sudo-protected Python installation as you almost never want to do that. We will need to discuss this a bit further before committing any code.

@DonJayamanne
Copy link

@MikhailArkhipov

#386 (comment)

With this approach, we might want to include the command thats being executed. The reason I've used the terminal is so users can see what's happening and tweek the command if need be.
E.g. I found that if they were behind a proxy, then we need to pass the proxy details to pip, who knows what we'd need in the future.

@MikhailArkhipov
Copy link

Generally addressed by 4372809. There is also #527 in works

@zzj0402
Copy link

zzj0402 commented May 10, 2018

--user doesn't help.

@microsoft microsoft locked as resolved and limited conversation to collaborators May 10, 2018
@brettcannon
Copy link
Member

@zzj0402 if python3 -m pip install --user pylint fails when run in a terminal then there is an issue with your system and not the extension itself.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-linting feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

6 participants