Python Forum
Unix problem when installing pytest
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unix problem when installing pytest
#1
I am self-teaching, using "Head First Python", 2nd Edition, covering Python 3. I'm currently using Python 3.5. I'm not sure if this is a Python question, a Unix question, or a Mac OS question.

I am the owner/system administrator of the laptop from which I am working. Also I added the root user with a separate password, using Directory Utility under Users and Groups in Mac System Preferences. Then I restarted my machine.

On page 190, the following UNIX command is given for installing pytest using pip, from within the Unix shell/console:

sudo python3 -m pip install pytest


I typed in the command exactly as above. When I got the request for the password, first I typed in the root password. The console responded with:

Password:
Sorry, try again.

Then I typed my personal system admin password, and got this message:

Password:
"The directory '/Users/claudecrider/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.
The directory '/Users/claudecrider/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.
Collecting pytest
Could not fetch URL https://pypi.python.org/simple/pytest/: There was a problem confirming the ssl certificate: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:719) - skipping
Could not find a version that satisfies the requirement pytest (from versions: )
No matching distribution found for pytest"

So looks like the first part is saying the directory is not owned by me, so cache has been disabled. But then it tries to take the requested action anyway, and fails for a different reason. I'm only trying to solve the first part. I am not concerned right now with the 'ssl certificate' problem.

I was just wondering if anyone has any ideas about the problem with the directory ownership.

Any ideas at all would be much appreciated. Thanks!
Reply
#2
What happens with sudo -H ?
Reply
#3
Sorry, the title is misleading. It should be "Unix problem when installing pytest"

I'm a newbie and don't know how to edit the title directly.

I tried -H several ways:

1. I tried replacing the -m in the original command with -H.
Response: 'Unknown option: -H'

2. I tried same as 1, with lower case h.
Response: a long list of "Options and arguments (and corresponding environment variables):"

3. I tried just "sudo -H", and "sudo -h".
Response: another slightly different long list

Looks like I'm going to have to spend some time learning Unix before I can make much progress with Python.

But thanks for trying!
Reply
#4
You could try
Output:
sudo -H python3 -m pip install pytest
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020