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.
- when globally installed packages on python path, , conflict installation requirements, ignored, , not uninstalled.
- 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).
- 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.
- 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
removed project packages in ~/user/.cache . installed 'wrongly'
pip uninstall -r <path_to_project_requirements.txt>
(n.b. prefix sudo when required).removed virtualenv
sudo pip uninstall virtualenv
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...create project directory:
mkdir <project>
, gocd project
.virtualenv venv
create local environment folder install packages. venv/bin/activate
continue installation of project requirements.
Comments
Post a Comment