# Circleci/python Docker images disallow pip install due to directory ownership

**URL:** <https://discuss.circleci.com/t/circleci-python-docker-images-disallow-pip-install-due-to-directory-ownership/12504>\
**Category:** Programming Languages\
**Tags:** python, docker\
**Created:** [May 9, 2017, 3:30pm UTC](https://discuss.circleci.com/t/circleci-python-docker-images-disallow-pip-install-due-to-directory-ownership/12504 "2017-05-09T15:30:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![smallnamespace](https://avatars.discourse-cdn.com/v4/letter/s/a9a28c/32.png) [@smallnamespace](https://discuss.circleci.com/u/smallnamespace)\
**Post date:** [May 9, 2017, 3:30pm UTC](https://discuss.circleci.com/t/circleci-python-docker-images-disallow-pip-install-due-to-directory-ownership/12504/1 "2017-05-09T15:30:01Z")

</div>

From [Docker](https://hub.docker.com/r/circleci/python/) :

> Use a non-root user (namely circleci) by default. Many applications refuse to run as run (e.g. chrome) or their behavior differs when run as root (e.g. tar file ownership behavior)

That’s fine, but when you try to install anything using pip, you get `Permission Denied: /usr/local/lib/python3.6/site-packages`

The workarounds that work are:

1. using sudo pip install (not recommended by pip team)
2. sudo chowning or chmoding the directory first
3. use `pip install --user` – note that default `$PATH` does not include `~/.local/bin`, so any binaries installed by pip like `py.test` will fail unless you change `PATH` before using those commands
4. use a venv – same caveats apply as you must `source activate` your venv before any pip-installed commands

Recommend at least documenting this for anyone switching from docker’s base `python` to your `circleci/python` images.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/circleci/original/3X/5/1/511608acda8e85906e15909b57bd0a46c1dbe291.png) [@system](https://discuss.circleci.com/u/system)\
**Post date:** [June 18, 2018, 11:32am UTC](https://discuss.circleci.com/t/circleci-python-docker-images-disallow-pip-install-due-to-directory-ownership/12504/2 "2018-06-18T11:32:32Z")

</div>

Closed on June 18, 2018, 11:32am UTC


