pulp / oci_env

9 stars 33 forks source link

Use pip3 for `install_client.sh` and `functest_requirements.txt` #130

Closed jerabekjiri closed 10 months ago

jerabekjiri commented 11 months ago

[noissue]

Python packages get installed in different repositories. pip installs repositories to Python 3.8 repository, while pip3 installs to Python 3.11.

When running oci-env generate-client -i or oci-env test -i -p pulp_ansible functional, requirements and packages are installed in different repositories and don't see each other.

[root@457fa361fd99 /]# pip list | grep pulp
pulp-ansible-client 0.19.0.dev0 /src/pulp-openapi-generator/pulp_ansible-client
pulp-cli            0.20.2
pulp-cli-deb        0.0.4
pulp-glue           0.20.2
pulpcore-client     3.30.0.dev0 /src/pulp-openapi-generator/pulpcore-client
[root@457fa361fd99 /]# pip3 list | grep pulp
pulp-ansible                             0.19.0.dev0 /src/pulp_ansible
pulp-container                           2.16.0
pulp-glue                                0.20.3
pulpcore                                 3.30.0.dev0 /src/pulpcore

Adding pip3 ensures that it gets installed for Python 3.11.

The pip command defaults to Python 3.8, while pip3 defaults to Python 3.11.

[root@457fa361fd99 /]# pip --version
pip 23.1.2 from /usr/local/lib/python3.8/site-packages/pip (python 3.8)
[root@457fa361fd99 /]# pip3 --version
pip 22.3.1 from /usr/lib/python3.11/site-packages/pip (python 3.11)

(we could do pip3.11, but this could break for older versions, since they don't have python 3.11)

jerabekjiri commented 11 months ago

https://github.com/ansible/galaxy_ng/blob/c2a7ab2a999cb9b64aca555fa6d98d7370ef56aa/profiles/base/init.sh#L19

This base profile fails because pip can't find pulp-container, as the package is installed in the pip3 repository.

jctanner commented 10 months ago

I have found on the galaxy_ng side where we do switch_python 3.11 that using pip3 or pip3.11 directly doesn't abide by the python versioned site-packages directory you might expect it to. For example, pip3 install or pip3.11 install will end up in python3.8's site-packages. However, /usr/bin/python3.11 -m pip ... will do the right thing. In all of the galaxy side profile scripts, i've changed them to use the python command instead of directly using pip. We should try to figure out how to make that happen for this script in oci-env also, but I suppose we can let this one in for now.

jerabekjiri commented 10 months ago

@jctanner, I can switch to /usr/bin/python3.11 -m pip instead of using the pip3 command directly for this PR. I don't think it would be a problem in this case?