Properly install packages?

I seem to keep getting this error when I install packages:

WARNING: The directory '/home/sarah/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting decision-tree-id3
  Downloading decision-tree-id3-0.1.2.tar.gz (12 kB)
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-3b3ihc4f/decision-tree-id3/setup.py'"'"'; __file__='"'"'/tmp/pip-install-3b3ihc4f/decision-tree-id3/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-3b3ihc4f/decision-tree-id3/pip-egg-info
         cwd: /tmp/pip-install-3b3ihc4f/decision-tree-id3/
    Complete output (1 lines):
    scipy is required during installation
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Does anyone else get them? And how do I fix it?

I’m needing decision_tree, naive_bayes, duck_duck_go, and a source of random output.

1 Like

First, what do you get when you type:

echo $PATH

It may be that some required files are not in your path. It is generally not a good idea to run pip with sudo. See: package management - Is `sudo pip install` still a broken practice? - Ask Ubuntu

Second, it also seems to be a permissions issue. You can try:

sudo chown -R $USERNAME /Users/$USERNAME/Library/Caches/pip

See: The directory 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. · Issue #988 · pypa/virtualenv · GitHub