[14:30:02] <Siecje> This is my Dockerfile. https://dpaste.de/Wm51 If I don't pin the pip version I get an error on the next pip command. "TypeError: 'module' object is not callable" https://github.com/pypa/pip/issues/7223
[14:42:22] <mgedmin> Siecje: upgrading a system-provided pip with sudo pip install -U pip is known to cause problems
[14:45:07] <mgedmin> although this is not precisely the problem you're seeing here
[14:45:24] <mgedmin> Siecje: actually _your_ problem is caused by ~/.local/bin not being in $PATH
[14:46:09] <mgedmin> Siecje: you get the pip wrapper script from the systemwide pip 19.1.1, but it gets to import modules from ~/.local/python3.6/site-packages/pip
[14:46:43] <mgedmin> Siecje: things would Just Work if you did python -m pip install ... instead of using the wrapper script, or if you fixed your path
[14:47:13] <mgedmin> (also, it's ~/.local/lib/python3.6/site-packages/pip/, I made a slight mistake earlier)
[14:48:18] <mgedmin> also, hm, I can't reproduce your problem?
[14:49:03] <mgedmin> docker run -ti --rm python:3.6.8 bash, then pip install --user pip==19.2.3 setuptools wheel, and then pip --version works
[14:53:30] <Siecje> mgedmin: Yes but don't specify a version.
[14:54:49] <Siecje> Also I'm not running as root. And I'm running --upgrade
[14:55:02] <Siecje> Even with root I can reproduce.
[14:55:28] <Siecje> docker run -ti --rm python:3.6.8 /bin/bash and then pip install --user pip setuptools wheel --upgrade; pip --version
[14:55:43] <Siecje> I thought you only need a venv when you need multiple Python environments. I only need one.
[16:03:51] <mgedmin> maybe you have an older python:3.6.8 image? I pulled it fresh from dockerhub
[16:04:27] <mgedmin> and the reason things work for me is that ~/.local/bin/pip and /usr/local/bin/pip have the same imports, because the pip in the docker image is close enough in version to the one you're upgrading to
[16:04:58] <mgedmin> I thought you got that typeerror with that thing you pasted
[16:05:06] <mgedmin> I missed the "if I don't pin the pip version" detail!
[16:06:16] <mgedmin> yeah, if I try to reproduce without the pin, then things break the same way, and both of my suggested workarounds work
[16:47:47] <Siecje> mgedmin: Why does pip use something that is not on the $PATH? Can pip give a nicer message about adding ~/.local/bin to $PATH?
[17:23:33] <pradyunsg> Siecje: what version of pip are you on?
[17:24:40] <Siecje> pip 19.1.1 from /usr/local/lib/python3.6/site-packages/pip (python 3.6)
[17:26:34] <pradyunsg> A warning when pip installs a script outside of PATH has been a part of pip since 10.0.0 -- https://github.com/pradyunsg/pip/commit/fc7ca264892767454b166d0fc001a6ca95bde22e
[17:27:29] <Siecje> pradyunsg: I'm trying to update pip. https://dpaste.de/i1eu
[17:29:17] <Siecje> I'm just wondering what the proper way to update pip. It seems my issue is caused by --user.
[20:30:53] <Siecje> mgedmin: Adding ~/.local/bin/ to the $PATH does not help. https://dpaste.de/zXq4
[20:33:29] <Siecje> Should I just do `python3 -m pip install pip --upgrade` and then `python -m pip install -r requirements.txt`?
[20:44:07] <toad_polo> Heh, wow, my answer to a question that name checks me as some sort of authority (rightly or wrongly) was downvoted already! https://stackoverflow.com/a/58756491/467366
[20:52:50] <dude-x> toad_polo i don't think many people know about pep517.build
[20:53:05] <dude-x> heck i'm suprrised you can do this and i kind of follow the news
[20:53:21] <toad_polo> Yes, well that's the point of answering questions.
[20:58:14] <Siecje> With that I get ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/local/bin/easy_install'
[21:03:47] <toad_polo> Siecje: Are you using the system python for this?
[21:04:16] <toad_polo> The best advice you'll get is that the system python is the system's python. I would not try to use it or install packages for it other than using your system package manager.
[21:04:27] <toad_polo> Best to use pyenv or a virtual environment and not worry about what the system is doing.
[21:04:38] <Siecje> Even if I only need one Python environment?
[21:05:08] <toad_polo> Trying to "upgrade your system pip" is where madness lies. I wouldn't even bother installing `pip` for your system python.
[21:06:36] <toad_polo> For people who don't take my advice.
[21:08:29] <toad_polo> `--user` is basically equivalent to a default-activated virtual environment with `--system-site-packages` enabled.
[21:10:31] <toad_polo> Stuff like that is notoriously buggy and depends on too many different interacting parts for anyone to really help you fix it. If you want to save yourself aggravation: 1. never use setup.py install and 2. use pyenv or virtualenvwrapper or any of a number of other projects that basically give you your own Python separate from the one the system installs.
[21:11:21] <toad_polo> I personally use pyenv because I often have to test my software on many different versions of Python, so I end up doing an optimized install of the latest version as my "daily driver" (and I install only virtualenv into that version, and activate venvs as needed), and non-optimized versions of a bunch of other versions.
[21:12:22] <toad_polo> But that's just me. Other people have other workflows, they use conda or xonsh or something. I think there are tools that will create ad-hoc virtualenvs for each directory you're in.
[21:14:52] <Siecje> toad_polo: This is for a Docker image that will be deployed.