PMXBOT Log file Viewer

Help | Karma | Search:

#pypa logs for Thursday the 2nd of January, 2020

(Back to #pypa overview) (Back to channel listing) (Animate logs)
[21:48:18] <punkrokk> Hello. So I'm updating some stuff to py3, and I'm having a challenge with pip
[21:48:44] <punkrokk> This script is failing with py3: https://github.com/StackStorm/st2/blob/master/scripts/fixate-requirements.py
[21:49:12] <punkrokk> with this error: Failed to import parse_requirements from pip: No module named 'pip._internal'
[21:49:30] <punkrokk> I'm searched high and low and I can't figure out what is causing this. ANy ideas of things to try or look at>
[22:04:57] <nedbat> punkrokk: what version of pip are you using?
[22:05:13] <punkrokk> 19.1.1
[22:15:41] <nedbat> punkrokk: none of these worked for you? https://www.google.com/search?q=pip._internal
[22:28:53] <punkrokk> Correct. None so far.
[22:29:50] <punkrokk> What I think is happening is possbily the CentOS python3 yum package is installing pip and then I'm using `get-pip.py` and maybe they are conflicting?
[22:37:50] <punkrokk> So maybe my python os.path is different than my get-pip installed path?
[22:40:04] <punkrokk> `sys.path` not `os.path`
[22:51:01] <ngoldbaum> you probably don’t want to be using an internal API like thay
[23:05:40] <stoboRlivE> punkrokk: have tried it from inside a venv?
[23:16:58] <toad_polo> punkrokk: Why are you using `get-pip`?
[23:17:49] <punkrokk> It’s what the build pipeline I’ve inherited uses.
[23:18:01] <toad_polo> And you can't change it?
[23:18:34] <toad_polo> `pip` already comes with Python in Python 3.
[23:18:50] <punkrokk> So, Upon thinking about this - it’s a pretty involved pipeline, this error is during rpm build.
[23:19:36] <punkrokk> I could just remove the get-pip line and see if it works. But how do I get a specific version of pip then?
[23:20:04] <toad_polo> `pip install "pip==$VERSION_NUMBER"`
[23:20:15] <toad_polo> Or maybe `pip install -U "pip==$VERSION_NUMBER"`
[23:20:32] <toad_polo> `get-pip` is just for bootstrapping `pip` if you don't already have a version of `pip` somewhere.
[23:21:22] <stoboRlivE> use conan? only slightly being a smartass
[23:21:49] <toad_polo> If you can get `pip` from the standard library or from a system package, you can use it to install any version of `pip` you want.
[23:23:52] <punkrokk> Ok. What is the best practice?
[23:24:04] <toad_polo> For what?
[23:24:13] <punkrokk> I am familiar with upgrading it and pinning it.
[23:25:20] <toad_polo> I think the preferred best practice is to keep it up-to-date. It has no public API so not making library calls is also an important part of that.
[23:25:30] <punkrokk> So - I’m the case of EL8/CentOS 8 specifically - yum install py3 then python 3 -m install pip==19.1.1
[23:25:46] <punkrokk> If that’s the version I wanted?
[23:26:09] <toad_polo> Yeah. It's a bit context-dependent though.
[23:26:31] <toad_polo> LIke if this is in a temporary chroot or a docker container doing builds for you, then yeah definitely do that.
[23:27:00] <punkrokk> toad_polo: I see that calling the library isn’t recommended. But haven’t had time to research alternatives
[23:27:29] <toad_polo> If you are setting the *system* `pip` to some specific value, then I would just not do that.
[23:27:55] <toad_polo> In the sense that I usually go with the motto "the system Python is the *system*'s python".
[23:28:04] <punkrokk> This is all for use in virtual environments and rpmbuilds
[23:28:18] <punkrokk> Which have virtualenvs
[23:28:36] <toad_polo> Yeah, if it's in virtual environments or other ephemeral build locations then best practice is exactly what you said.
[23:29:23] <punkrokk> What if it’s permanent.
[23:29:34] <toad_polo> Here's a relatively recent thread about adding an API to pip, FYI: https://discuss.python.org/t/can-we-finally-add-a-minimal-api-to-pip/2833/11
[23:29:38] <punkrokk> Or as a source for prod vents
[23:29:45] <punkrokk> Venvs
[23:30:06] <toad_polo> punkrokk: venvs it's always fine because you're expected to manipulate them with `pip` to construct them.
[23:30:25] <toad_polo> The main issue is if you have to do `sudo pip install` or something of that nature, because `pip` and the system package manager will step on one anothers' toes.
[23:31:19] <toad_polo> So anything you need to deploy should deploy with the system package manager or into a venv or a custom install of Python (like with `pyenv`: https://github.com/pyenv/pyenv)
[23:31:55] <toad_polo> For my computers I usually use `pyenv` to set up a Python environment and then use virtualenvs on top of that, and I leave the system python for things managed by the system's package manager.
[23:32:20] <punkrokk> Yea I do something similar with pycharm and viscose
[23:32:25] <punkrokk> Vscode
[23:33:13] <toad_polo> OK, I gotta run. Sounds like you're on a good track. Good luck!
[23:34:04] <punkrokk> Thanks much
[23:34:13] <punkrokk> Really appreciate it