msancheznet / pyion

Interface between ION and Python
https://pyion.readthedocs.io/en/latest/index.html
Apache License 2.0
11 stars 9 forks source link

Invalid version identifier on Python 3.9+ (PEP 440) #11

Closed pcrosemurgy closed 1 year ago

pcrosemurgy commented 1 year ago

Issue

On the v4.1.2 branch when compiling with:

ENV ION_HOME         /home/ptl/lib/ion-open-source-4.1.2
ENV PYION_HOME       /home/ptl/lib/pyion
ENV PYION_BP_VERSION BPv7
RUN python3 setup.py install

the following error aborts the installation process:

        ###################
        # Invalid version #
        ###################
        'pyion-4.1.2' is not valid according to PEP 440.
Full log ``` /usr/local/lib/python3.9/dist-packages/setuptools/_distutils/dist.py:265: UserWarning: Unknown distribution option: 'release' warnings.warn(msg) /usr/local/lib/python3.9/dist-packages/setuptools/dist.py:561: UserWarning: The version specified ('pyion-4.1.2') is an invalid version, this may not work as expected with newer versions of setuptools, pip, and PyPI. Please see PEP 440 for more details. warnings.warn( running install /usr/local/lib/python3.9/dist-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools. warnings.warn( /usr/local/lib/python3.9/dist-packages/setuptools/command/easy_install.py:144: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools. warnings.warn( running bdist_egg /usr/local/lib/python3.9/dist-packages/setuptools/_normalization.py:93: SetuptoolsDeprecationWarning: Invalid version: 'pyion-4.1.2'. !! ################### # Invalid version # ################### 'pyion-4.1.2' is not valid according to PEP 440. Please make sure specify a valid version for your package. Also note that future releases of setuptools may halt the build process if an invalid version is given. !! warnings.warn(cleandoc(msg), SetuptoolsDeprecationWarning) Traceback (most recent call last): File "/home/ptl/lib/pyion/setup.py", line 231, in setup( File "/usr/local/lib/python3.9/dist-packages/setuptools/__init__.py", line 108, in setup return distutils.core.setup(**attrs) File "/usr/local/lib/python3.9/dist-packages/setuptools/_distutils/core.py", line 185, in setup return run_commands(dist) File "/usr/local/lib/python3.9/dist-packages/setuptools/_distutils/core.py", line 201, in run_commands dist.run_commands() File "/usr/local/lib/python3.9/dist-packages/setuptools/_distutils/dist.py", line 969, in run_commands self.run_command(cmd) File "/usr/local/lib/python3.9/dist-packages/setuptools/dist.py", line 1221, in run_command super().run_command(command) File "/usr/local/lib/python3.9/dist-packages/setuptools/_distutils/dist.py", line 988, in run_command cmd_obj.run() File "/usr/local/lib/python3.9/dist-packages/setuptools/command/install.py", line 74, in run self.do_egg_install() File "/usr/local/lib/python3.9/dist-packages/setuptools/command/install.py", line 123, in do_egg_install self.run_command('bdist_egg') File "/usr/local/lib/python3.9/dist-packages/setuptools/_distutils/cmd.py", line 318, in run_command self.distribution.run_command(command) File "/usr/local/lib/python3.9/dist-packages/setuptools/dist.py", line 1221, in run_command super().run_command(command) File "/usr/local/lib/python3.9/dist-packages/setuptools/_distutils/dist.py", line 987, in run_command cmd_obj.ensure_finalized() File "/usr/local/lib/python3.9/dist-packages/setuptools/_distutils/cmd.py", line 111, in ensure_finalized self.finalize_options() File "/usr/local/lib/python3.9/dist-packages/setuptools/command/bdist_egg.py", line 92, in finalize_options ei_cmd = self.ei_cmd = self.get_finalized_command("egg_info") File "/usr/local/lib/python3.9/dist-packages/setuptools/_distutils/cmd.py", line 305, in get_finalized_command cmd_obj.ensure_finalized() File "/usr/local/lib/python3.9/dist-packages/setuptools/_distutils/cmd.py", line 111, in ensure_finalized self.finalize_options() File "/usr/local/lib/python3.9/dist-packages/setuptools/command/egg_info.py", line 220, in finalize_options parsed_version = packaging.version.Version(self.egg_version) File "/usr/local/lib/python3.9/dist-packages/setuptools/_vendor/packaging/version.py", line 197, in __init__ raise InvalidVersion(f"Invalid version: '{version}'") setuptools.extern.packaging.version.InvalidVersion: Invalid version: 'pyion-4.1.2' ```

Reproducing

The steps described in https://pyion.readthedocs.io/en/latest/index.html should likely fail on any Python 3.9+ version. Note that the stable Debian version (Bullseye) uses Python 3.9.

I ran this to double-check that the error reported above is warranted:

$ mkdir ~/.venv
$ python3 -m venv ~/.venv/dtn
$ .  ~/.venv/dtn/bin/activate
(dtn) $ python3 -m pip install pep440
Collecting pep440
  Downloading pep440-0.1.2-py3-none-any.whl (4.6 kB)
Installing collected packages: pep440
Successfully installed pep440-0.1.2
(dtn) $ python3
Python 3.11.2 (main, Feb 16 2023, 03:07:35) [Clang 14.0.0 (clang-1400.0.29.202)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from pep440 import is_canonical
>>> is_canonical('pyion-4.1.2')
False
>>> is_canonical('4.1.2')
True

Resolving

I would suggest testing pyion on Python 3.9+. In the meantime I can work around this issue by manually changing __version__ within my cloned repository to be PEP440-compliant (like "4.1.2").

msancheznet commented 1 year ago

Closed by pcrosemurgy's pull request