python 2.7 - Pip specifies an Error on Ubuntu 16.04. And, venv packages appear when environment is deactivated - Ask Ubuntu


this identical question, title incorrect. and, symptoms more odious explained in post.

from ubuntu 14.04 upgrade 16.04 -- pip shows packages installed whilst in active virtual environment when venv deactivated.

furthermore, when installing package pip throws error:

the directory '/home/user/.cache/pip/http' or parent directory not owned current user , cache has been disabled. please check permissions , owner of directory. if executing pip sudo, may want sudo's -h flag. directory '/home/user/.cache/pip' or parent directory not owned current user , caching wheels has been disabled. check permissions , owner of directory. if executing pip sudo, may want sudo's -h flag.   

i permissions error when doing pip install <package_name> can around pip install --user <package_name>. and, sudo work above -h option.

any insights or possible fix on error great! in advance!

ed

i found answer issue. occurs because virtualenv installed sudo , pip/.cache file owned user. there packages require access sudo. below info on issue , reference. have added idiots guide below explanation error.

  1. when globally installed packages on python path, , conflict installation requirements, ignored, , not uninstalled.
  2. when globally installed packages on python path, , satisfy installation requirements, pip nothing, , reports requirement satisfied (similar how global packages can satisfy requirements when installing packages in --system-site-packages virtualenv).
  3. pip not perform --user install in --no-site-packages virtualenv (i.e. default kind of virtualenv), due user site not being on python path. installation pointless.
  4. in --system-site-packages virtualenv, pip not install package conflicts package in virtualenv site-packages. --user installation lack sys.path precedence , pointless.

more info can read here https://pip.pypa.io/en/stable/user_guide/#user-installs.

my fix

  1. removed project packages in ~/user/.cache . installed 'wrongly' pip uninstall -r <path_to_project_requirements.txt> (n.b. prefix sudo when required).

  2. removed virtualenv sudo pip uninstall virtualenv

  3. install virtualenv using: pip --user install virtualenv. stop ownership issues. and, save having install globally sudo -- use virtualenv wrapper save of pain, i'm not...

  4. create project directory: mkdir <project> , go cd project.

  5. virtualenv venv create local environment folder install packages . venv/bin/activate

  6. continue installation of project requirements.


Comments

Popular posts from this blog

download - Firefox cannot save files (most of the time), how to solve? - Super User

windows - "-2146893807 NTE_NOT_FOUND" when repair certificate store - Super User