openshift/openshift-restclient-python

Installing openshift creates file local/requirements.txt/requirements.txt

wat-usmdon opened this issue · 6 comments

I'm having a problem installing some Python packages. The pip logging isn't very helpful, but I managed to track at least part of the problem down to something the openshift package does.

In my VS Code dev container I was first getting an error installing packages because the path ~/.local/requirements.txt was a directory containing a file requirements.txt. I added a step to create ~/.local/requirements.txt as a file and enabled logging, hoping that would give a stack trace, but it does not, and the pip log does not even report what package it was working on installing at the time the error occurred.

However, I did notice that the only references to requirements.txt in the log are from the openshift package:

2021-04-20T16:08:31,604   running install_data
2021-04-20T16:08:31,604   creating build/bdist.linux-x86_64/wheel/openshift-0.12.0.data
2021-04-20T16:08:31,604   creating build/bdist.linux-x86_64/wheel/openshift-0.12.0.data/data
2021-04-20T16:08:31,605   creating build/bdist.linux-x86_64/wheel/openshift-0.12.0.data/data/requirements.txt
2021-04-20T16:08:31,605   copying requirements.txt -> build/bdist.linux-x86_64/wheel/openshift-0.12.0.data/data/requirements.txt
2021-04-20T16:08:31,605   running install_egg_info
2021-04-20T16:08:31,608   Copying openshift.egg-info to build/bdist.linux-x86_64/wheel/openshift-0.12.0.egg-info
2021-04-20T16:08:31,609   running install_scripts
2021-04-20T16:08:31,639   creating build/bdist.linux-x86_64/wheel/openshift-0.12.0.dist-info/WHEEL
2021-04-20T16:08:31,639   creating '/tmp/pip-wheel-8qw1mzus/openshift-0.12.0-py3-none-any.whl' and adding 'build/bdist.linux-x86_64/wheel' to it
2021-04-20T16:08:31,640   adding 'openshift/__init__.py'
2021-04-20T16:08:31,640   adding 'openshift/dynamic/__init__.py'
2021-04-20T16:08:31,641   adding 'openshift/dynamic/apply.py'
2021-04-20T16:08:31,642   adding 'openshift/dynamic/client.py'
2021-04-20T16:08:31,643   adding 'openshift/dynamic/discovery.py'
2021-04-20T16:08:31,643   adding 'openshift/dynamic/exceptions.py'
2021-04-20T16:08:31,644   adding 'openshift/dynamic/resource.py'
2021-04-20T16:08:31,645   adding 'openshift/helper/__init__.py'
2021-04-20T16:08:31,645   adding 'openshift/helper/hashes.py'
2021-04-20T16:08:31,645   adding 'openshift-0.12.0.data/data/requirements.txt/requirements.txt'
2021-04-20T16:08:31,646   adding 'scripts/__init__.py'
2021-04-20T16:08:31,647   adding 'scripts/constants.py'
2021-04-20T16:08:31,647   adding 'openshift-0.12.0.dist-info/METADATA'
2021-04-20T16:08:31,648   adding 'openshift-0.12.0.dist-info/WHEEL'
2021-04-20T16:08:31,648   adding 'openshift-0.12.0.dist-info/entry_points.txt'
2021-04-20T16:08:31,648   adding 'openshift-0.12.0.dist-info/top_level.txt'
2021-04-20T16:08:31,649   adding 'openshift-0.12.0.dist-info/RECORD'
2021-04-20T16:08:31,649   removing build/bdist.linux-x86_64/wheel

I can reproduce the directory creation by doing the following in a clean ubuntu:focal docker container:

# apt-get update && apt-get install -y --no-install-recommends python3-pip
# pip3 install openshift
# cat /usr/local/requirements.txt/requirements.txt
jinja2
kubernetes ~= 12.0
python-string-utils
ruamel.yaml
six

Or in a clean centos:8 docker container:

# dnf install -y python3-pip
# pip3 install openshift
# cat /usr/local/requirements.txt/requirements.txt
jinja2
kubernetes ~= 12.0
python-string-utils
ruamel.yaml
six

Unfortunately, in either case the installation completes successfully so I still don't know what else is happening in my environment that requirements.txt must not be a directory but I do know the directory comes from installing openshift.

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale

Stale issues rot after 30d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle rotten
/remove-lifecycle stale

that is bizarre, I'll look into it. We shouldn't be outputting that requirements.txt at all

I think:

$ git diff
diff --git a/setup.py b/setup.py
index d2b794c..ee2330b 100644
--- a/setup.py
+++ b/setup.py
@@ -48,10 +48,6 @@ setup(
     keywords=["Swagger", "OpenAPI", "Kubernetes", "OpenShift"],
     install_requires=extract_requirements('requirements.txt'),
     packages=find_packages(include='openshift.*'),
-    include_package_data=True,
-    data_files=[
-        ('requirements.txt', ['requirements.txt'])
-    ],
     long_description='Python client for OpenShift http://openshift.redhat.com/',
     classifiers=[
         "Development Status :: %s" % DEVELOPMENT_STATUS,

shouldn't have any ill effect (although my Python packaging knowledge is limited, and I may be wrong), and prevents this from happening.

Rotten issues close after 30d of inactivity.

Reopen the issue by commenting /reopen.
Mark the issue as fresh by commenting /remove-lifecycle rotten.
Exclude this issue from closing again by commenting /lifecycle frozen.

/close

@openshift-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.

Reopen the issue by commenting /reopen.
Mark the issue as fresh by commenting /remove-lifecycle rotten.
Exclude this issue from closing again by commenting /lifecycle frozen.

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.