Posting warning message
T Berger
brgrt2 at gmail.com
Tue Jun 12 09:49:22 EDT 2018
On Tuesday, June 12, 2018 at 3:28:29 AM UTC-4, Cameron Simpson wrote:
> On 11Jun2018 22:51, Tamara Berger <brgrt2 at gmail.com> wrote:
> >On Monday, June 11, 2018 at 7:24:58 PM UTC-4, Gregory Ewing wrote:
> >> Tamara Berger wrote:
> >> > I typed these 2 lines in the terminal:
> >> > 192:~ TamaraB$ sudo python3
> >> >>>>python3 -m pip install pytest
> >>
> >> You need to enter this *single* line in the Terminal:
> >> sudo python3 -m pip install pytest
> >>
> >> > What does the "-m" stand for in the line of code?
> >> It's a cmmand-line option to the python interpreter
> >> telling it to execute a module.
> >
> >Thanks, Greg. But I got a permission error. Here is my command at the prompt and the terminal's response.
> >
> >192:~ TamaraB$ sudo python3 -m pip install pytest
> >Password:
> >The directory '/Users/TamaraB/Library/Caches/pip/http' or its parent directory
> >is not owned by the current user and the cache has been disabled. Please check
> >the permissions and owner of that directory. If executing pip with sudo, you
> >may want sudo's -H flag.
>
> sudo leaves the $HOME environment variable unchanged, at least on my Mac. So it
> is using your personal cache directory. And rejecting it becuse it is
> (correctly) owned by you.
>
> >The directory '/Users/TamaraB/Library/Caches/pip' or its parent directory is
> >not owned by the current user and caching wheels has been disabled. check the
> >permissions and owner of that directory. If executing pip with sudo, you may
> >want sudo's -H flag.
>
> Have a look at the sudo command's manual page, by running the command:
>
> man sudo
>
> In that we can read this:
>
> -H The -H (HOME) option option sets the HOME environment
> variable to the home directory of the target user (root by
> default) as specified by the password database. The
> default handling of the HOME environment variable depends
> on sudoers(5) settings. By default, sudo will set HOME if
> env_reset or always_set_home are set, or if set_home is
> set and the -s option is specified on the command line.
>
> So the message is a reasonable suggestion, and it is suggesting that you run
> this command:
>
> sudo -H python3 -m pip install pytest
>
> Regarding the other messages:
>
> >Requirement already satisfied: pytest in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
> >Requirement already satisfied: setuptools in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from pytest)
> >Requirement already satisfied: pluggy<0.7,>=0.5 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from pytest)
> >Requirement already satisfied: atomicwrites>=1.0 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from pytest)
> >Requirement already satisfied: more-itertools>=4.0.0 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from pytest)
> >Requirement already satisfied: six>=1.10.0 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from pytest)
> >Requirement already satisfied: py>=1.5.0 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from pytest)
> >Requirement already satisfied: attrs>=17.4.0 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from pytest)
>
> This is all fine - it is just saying that various prerequisites are already
> there.
>
> >You are using pip version 9.0.1, however version 10.0.1 is available.
> >You should consider upgrading via the 'pip install --upgrade pip' command.
>
> This is just a suggestion to upgrade pip. Since you're running pip from
> Python's "pip" builtin module this effectively suggests upgrading your Python 3
> install. Not important or urgent.
>
> >So I'm stuck again. I thought "sudo" was supposed to take care of permissions.
> >Do you have a suggestion?
>
> Sudo isn't magic, and treating it like magic is very common, which is one
> reason I discourage unthinking use of it.
>
> Sudo exists to let your run specific commands as root, the system superuser.
> (It also has modes to run as other users, but root is the default and also the
> most dangerous.)
>
> When you use sudo you have almost unlimited power to change things. This is
> handy for installation activities, and also handy for doing unbound damage to
> the OS install.
>
> I still recommend that you avoid sudo here and use pip's --user option,
> installing the packages in your personal Python tree. It will work just as well
> for almost every purpose and avoid risk to your machine's OS.
>
> Cheers,
> Cameron Simpson <cs at cskk.id.au>
Thanks a lot, Cameron. I was going to try the --user option this morning, if no one had responded to my post.
More information about the Python-list
mailing list