Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.6.0: pep517 based build fails with Invalid version: 'UNKNOWN' error message #76

Closed
kloczek opened this issue Dec 31, 2023 · 7 comments
Labels
invalid This doesn't seem right

Comments

@kloczek
Copy link

kloczek commented Dec 31, 2023

+ /usr/bin/python3 -sBm build -w --no-isolation
* Getting build dependencies for wheel...
warning: cannot determine version number
Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
    main()
  File "/usr/lib/python3.8/site-packages/pyproject_hooks/_in_process/_in_process.py", line 335, in main
    json_out['return_val'] = hook(**hook_input['kwargs'])
  File "/usr/lib/python3.8/site-packages/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
    return hook(config_settings)
  File "/usr/lib/python3.8/site-packages/setuptools/build_meta.py", line 325, in get_requires_for_build_wheel
    return self._get_build_requires(config_settings, requirements=['wheel'])
  File "/usr/lib/python3.8/site-packages/setuptools/build_meta.py", line 295, in _get_build_requires
    self.run_setup()
  File "/usr/lib/python3.8/site-packages/setuptools/build_meta.py", line 480, in run_setup
    super(_BuildMetaLegacyBackend, self).run_setup(setup_script=setup_script)
  File "/usr/lib/python3.8/site-packages/setuptools/build_meta.py", line 311, in run_setup
    exec(code, locals())
  File "<string>", line 124, in <module>
  File "/usr/lib/python3.8/site-packages/setuptools/__init__.py", line 103, in setup
    return distutils.core.setup(**attrs)
  File "/usr/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 147, in setup
    _setup_distribution = dist = klass(attrs)
  File "/usr/lib/python3.8/site-packages/setuptools/dist.py", line 314, in __init__
    self.metadata.version = self._normalize_version(self.metadata.version)
  File "/usr/lib/python3.8/site-packages/setuptools/dist.py", line 350, in _normalize_version
    normalized = str(Version(version))
  File "/usr/lib/python3.8/site-packages/setuptools/_vendor/packaging/version.py", line 198, in __init__
    raise InvalidVersion(f"Invalid version: '{version}'")
setuptools.extern.packaging.version.InvalidVersion: Invalid version: 'UNKNOWN'
@RKrahl
Copy link
Owner

RKrahl commented Jan 6, 2024

I have no idea what you were trying to do. I'd need more information in order to give a somewhat useful answer.

$ tar xfz pytest-dependency-0.6.0.tar.gz
$ cd pytest-dependency-0.6.0
$ python3.8 -sBm build -w --no-isolation
* Getting build dependencies for wheel...
running egg_info
creating src/pytest_dependency.egg-info
writing src/pytest_dependency.egg-info/PKG-INFO
writing dependency_links to src/pytest_dependency.egg-info/dependency_links.txt
writing entry points to src/pytest_dependency.egg-info/entry_points.txt
writing requirements to src/pytest_dependency.egg-info/requires.txt
writing top-level names to src/pytest_dependency.egg-info/top_level.txt
writing manifest file 'src/pytest_dependency.egg-info/SOURCES.txt'
adding license file 'LICENSE.txt' (matched pattern 'LICEN[CS]E*')
reading manifest file 'src/pytest_dependency.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'src/pytest_dependency.egg-info/SOURCES.txt'
* Building wheel...
running bdist_wheel
running build
running build_py
running meta
version: 0.6.0
creating build
creating build/lib
copying (with substitutions) src/pytest_dependency.py -> build/lib
installing to build/bdist.linux-x86_64/wheel
running install
running install_lib
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/wheel
copying build/lib/pytest_dependency.py -> build/bdist.linux-x86_64/wheel
running install_egg_info
running egg_info
writing src/pytest_dependency.egg-info/PKG-INFO
writing dependency_links to src/pytest_dependency.egg-info/dependency_links.txt
writing entry points to src/pytest_dependency.egg-info/entry_points.txt
writing requirements to src/pytest_dependency.egg-info/requires.txt
writing top-level names to src/pytest_dependency.egg-info/top_level.txt
adding license file 'LICENSE.txt' (matched pattern 'LICEN[CS]E*')
reading manifest file 'src/pytest_dependency.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'src/pytest_dependency.egg-info/SOURCES.txt'
Copying src/pytest_dependency.egg-info to build/bdist.linux-x86_64/wheel/pytest_dependency-0.6.0-py3.8.egg-info
running install_scripts
adding license file "LICENSE.txt" (matched pattern "LICEN[CS]E*")
creating build/bdist.linux-x86_64/wheel/pytest_dependency-0.6.0.dist-info/WHEEL
creating '/home/abuild/test/pytest-dependency-0.6.0/dist/tmp8lwczho7/pytest_dependency-0.6.0-py3-none-any.whl' and adding 'build/bdist.linux-x86_64/wheel' to it
adding 'pytest_dependency.py'
adding 'pytest_dependency-0.6.0.dist-info/LICENSE.txt'
adding 'pytest_dependency-0.6.0.dist-info/METADATA'
adding 'pytest_dependency-0.6.0.dist-info/WHEEL'
adding 'pytest_dependency-0.6.0.dist-info/entry_points.txt'
adding 'pytest_dependency-0.6.0.dist-info/top_level.txt'
adding 'pytest_dependency-0.6.0.dist-info/RECORD'
removing build/bdist.linux-x86_64/wheel
Successfully built pytest_dependency-0.6.0-py3-none-any.whl

Works for me.

In any case:

  1. Please check out the Installation instructions for pytest-dependency.
  2. whatever you want to do to install pytest-dependency, always start from the released source distribution.

@kloczek
Copy link
Author

kloczek commented Jan 7, 2024

Did you try to use autogenerated from git tag tar ball? 🤔

@RKrahl
Copy link
Owner

RKrahl commented Jan 7, 2024

I did exactly what I wrote above: I unpacked the source distribution changed into that directory and ran python3.8 -sBm build -w --no-isolation. (You need to have build and wheel installed for this command to work.)

You still didn't tell me what you were trying to do. I suspect that you didn't start from the source distribution, but from the cloned git repository. In that case, you'd need to additionally install git-props (and the git program of course).

@kloczek
Copy link
Author

kloczek commented Apr 8, 2024

I did exactly what I wrote above: I unpacked the source distribution changed into that directory and ran python3.8 -sBm build -w --no-isolation. (You need to have build and wheel installed for this command to work.)

Do you have git matadata in that tar ball?
Autogenerated from git tag tar ball has no .git/directory.

BTW: why not use for example setuptool-scm instead setuptools + set of custom reads from git metadata? 🤔
It would allow as well significantly shorten setup.py.

@kloczek
Copy link
Author

kloczek commented Apr 8, 2024

BTW:

import setuptools.command.build_py
import distutils.command.sdist
import distutils.file_util
from distutils import log

distutils is already deprecated.

@kloczek
Copy link
Author

kloczek commented Apr 8, 2024

Next thing

install_requires = ["setuptools", "pytest >= 3.7.0"],

Looks like setuptools can be removed from that list.

@RKrahl RKrahl added the invalid This doesn't seem right label Apr 8, 2024
@RKrahl
Copy link
Owner

RKrahl commented Apr 8, 2024

In my very first comment above, I pointed you to the Installation instructions for pytest-dependency. May I suggest you to actually read that piece of documentation?

Do you have git matadata in that tar ball? Autogenerated from git tag tar ball has no .git/directory.

That tar ball is the source distribution that is supposed to be the starting point for any attempt to install pytest-dependency. And yes, it contains the relevant metadata.

BTW: why not use for example setuptool-scm instead setuptools + set of custom reads from git metadata? 🤔

I use git-props instead of setuptool-scm. It is similar, but has some advantages over the latter.

It would allow as well significantly shorten setup.py.

Bullshit!

distutils is already deprecated.

It was deprecated in the standard library and has been removed from there in Python 3.12. But it is still included in setuptools, actually, it is the basis that setuptools builds upon.

Looks like setuptools can be removed from that list.

It is required for the manual installation from the source distribution.

I repeat myself: you still didn't tell me what you were trying to do. You didn't provided any reproducible error description. I thus close as invalid.

@RKrahl RKrahl closed this as not planned Won't fix, can't repro, duplicate, stale Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants