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

Can't install version 2.2.0 #517

Closed
kirill-ratkin opened this issue Nov 22, 2023 · 9 comments
Closed

Can't install version 2.2.0 #517

kirill-ratkin opened this issue Nov 22, 2023 · 9 comments
Labels
defect Suspected defect such as a bug or regression

Comments

@kirill-ratkin
Copy link

kirill-ratkin commented Nov 22, 2023

Observed behavior

Steps:

  • python3.8 -m venv .venv
  • source .venv/bin/activate
  • pip install wheel
  • python -m pip install --upgrade pip
  • pip install nats-py==2.2.0

Error returns:

Collecting nats-py==2.2.0
  Downloading nats-py-2.2.0.tar.gz (61 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 61.5/61.5 kB 1.1 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [49 lines of output]
      /tmp/pip-build-env-ltcqiskm/overlay/lib/python3.8/site-packages/setuptools/config/_apply_pyprojecttoml.py:75: _MissingDynamic: `optional-dependencies` defined outside of `pyproject.toml` is ignored.
      !!

              ********************************************************************************
              The following seems to be defined outside of `pyproject.toml`:

              `optional-dependencies = {'nkeys': ['nkeys']}`

              According to the spec (see the link below), however, setuptools CANNOT
              consider this value unless `optional-dependencies` is listed as `dynamic`.

              https://packaging.python.org/en/latest/specifications/declaring-project-metadata/

              To prevent this problem, you can list `optional-dependencies` under `dynamic` or alternatively
              remove the `[project]` table from your file and rely entirely on other means of
              configuration.
              ********************************************************************************

      !!
        _handle_missing_dynamic(dist, project_table)
      Traceback (most recent call last):
        File "/home/rukira/.temp/issues/3007/.venv/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/home/rukira/.temp/issues/3007/.venv/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/home/rukira/.temp/issues/3007/.venv/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
        File "/tmp/pip-build-env-ltcqiskm/overlay/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 "/tmp/pip-build-env-ltcqiskm/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 295, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-ltcqiskm/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 311, in run_setup
          exec(code, locals())
        File "<string>", line 5, in <module>
        File "/tmp/pip-build-env-ltcqiskm/overlay/lib/python3.8/site-packages/setuptools/__init__.py", line 103, in setup
          return distutils.core.setup(**attrs)
        File "/tmp/pip-build-env-ltcqiskm/overlay/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 159, in setup
          dist.parse_config_files()
        File "/tmp/pip-build-env-ltcqiskm/overlay/lib/python3.8/site-packages/setuptools/dist.py", line 627, in parse_config_files
          pyprojecttoml.apply_configuration(self, filename, ignore_option_errors)
        File "/tmp/pip-build-env-ltcqiskm/overlay/lib/python3.8/site-packages/setuptools/config/pyprojecttoml.py", line 67, in apply_configuration
          return _apply(dist, config, filepath)
        File "/tmp/pip-build-env-ltcqiskm/overlay/lib/python3.8/site-packages/setuptools/config/_apply_pyprojecttoml.py", line 56, in apply
          _apply_project_table(dist, config, root_dir)
        File "/tmp/pip-build-env-ltcqiskm/overlay/lib/python3.8/site-packages/setuptools/config/_apply_pyprojecttoml.py", line 82, in _apply_project_table
          corresp(dist, value, root_dir)
        File "/tmp/pip-build-env-ltcqiskm/overlay/lib/python3.8/site-packages/setuptools/config/_apply_pyprojecttoml.py", line 223, in _optional_dependencies
          dist.extras_require = {**existing, **val}
      TypeError: 'list' object is not a mapping
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

Expected behavior

nats-py installed into virtual environment.

Server and client version

nats-server: v2.3.0
Python 3.8.14
Linux build 5.14.0-333.el9.x86_64
CentOS Stream release 9

Host environment

No response

Steps to reproduce

No response

@kirill-ratkin kirill-ratkin added the defect Suspected defect such as a bug or regression label Nov 22, 2023
@kirill-ratkin
Copy link
Author

No issue for 2.6.0 version

$ pip install nats-py==2.6.0
Collecting nats-py==2.6.0
  Downloading nats-py-2.6.0.tar.gz (94 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 94.6/94.6 kB 2.2 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: nats-py
  Building wheel for nats-py (pyproject.toml) ... done
  Created wheel for nats-py: filename=nats_py-2.6.0-py3-none-any.whl size=73015 sha256=3cdf8313c9dbf086a323855dad6d5b83555373c375a0b6985c628835b0e364fe
  Stored in directory: /tmp/pip-ephem-wheel-cache-vub47_ft/wheels/cc/5f/dc/81eee782c67805e979d7e1cac761f81acebc73608ba46ba0a0
Successfully built nats-py
Installing collected packages: nats-py
Successfully installed nats-py-2.6.0

@kirill-ratkin
Copy link
Author

It's easy to fix just comment extras_require:

$ cat setup.py
from setuptools import setup

# Metadata goes in pyproject.toml.
# These are here for GitHub's dependency graph.
setup(
    name="nats-py",
#    extras_require={
#        'nkeys': ['nkeys']
#    }
)

Then command

pip wheel .

builds whl file and it works.

But I feel this fix is not correct.

@jlmorton
Copy link

I believe this is happening as a result of setuptools 69.0.0 release. Nats-py is pulling this in at build time, because pyproject.toml defines:

[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"

I think the metadata that's breaking was fixed in 93d9d8a, which fixed it for versions 2.4.0...HEAD. But currently, building is breaking for all versions <2.4.0.

@wallyqs
Copy link
Member

wallyqs commented Nov 23, 2023

How can I help @kirill-ratkin? Do you need a backport release of the package fixes for v2.2.X or can adopt the latest nats.py version with the fixes?

@jlmorton
Copy link

jlmorton commented Nov 23, 2023

How can I help @kirill-ratkin? Do you need a backport release of the package fixes for v2.2.X or can adopt the latest nats.py version with the fixes?

@wallyqs

For my case, I was able to fork nats.py, update the pyproject.toml to explicitly specify setuptools 68.0.0 in pyproject.toml, re-tag and push, and then update my dependencies to reference that on our release branch. (For our main branch, we just updated to nats.py 2.6.0).

I'm not sure how it can be fixed for all users without releasing a backport fix for every release < 2.4.0.

@kirill-ratkin
Copy link
Author

Hi, thank you very much for help.

Now I see three possible options:

  • create request to panini microframework asking guys to move to nats-py==2.6.0 (I faced this issue installing panini which I use in my service)
  • ask you to make backport the fix
  • ask guys who develop setuptools why backward compatibility seems to be broken.

Or to do workaround way, just to fork nats-py==2.2.0.

I think better way is to go step by step.
I'll ask panini team and ... will see what next.

@kirill-ratkin
Copy link
Author

I'm asking panini team to upgrade nats-py version to 2.6.0 (lwinterface/panini#282)
If they agree - my particular issue is solved.

@jlmorton
Copy link

@kirill-ratkin Here's one more option that might work for you.

As I understand it, the issue is that pip is creating an isolated build env to build the wheel. When it does that, it pulls in the setuptools defined in nats-py build-system config in pyproject.toml. However, this behavior can be overridden with --no-build-isolation.

pip install setuptools==68.0.0
pip install wheel==0.41.3
pip install --no-cache-dir --no-build-isolation panini

With this, pip will build the wheel using the dependencies in your virtualenv, with the version of setuptools pinned in that venv.

This seems to work for me both to build nats-py==2.2.0 and panini standalone.

@kirill-ratkin
Copy link
Author

Definitely it works!
James, thank yo so much.

I think the issue can be closed because there is workaround for everyone who still use version 2.2.0 as me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect Suspected defect such as a bug or regression
Projects
None yet
Development

No branches or pull requests

3 participants