prefix-dev / rip

Solve and install Python packages quickly with rip (pip in Rust)

Home Page:https://prefix.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

rip collects and tries to build packages explicitly against the users requirements

notatallshaw opened this issue · comments

Environment: Linux Python 3.11

Command: cargo r -- apache-airflow[all]==2.8.1 apache-beam>=2.47

Error:

2024-01-25T19:59:26.200863Z ERROR rattler_installs_packages::index::package_database: Error from source distributions 'apache-beam-2.42.0.zip' skipped: 
 could not build wheel: <string>:28: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
Traceback (most recent call last):
  File "/tmp/.tmpo1wZW0/build_frontend.py", line 124, in <module>
    get_requires_for_build_wheel(backend, work_dir)
  File "/tmp/.tmpo1wZW0/build_frontend.py", line 58, in get_requires_for_build_wheel
    result = f()
             ^^^
  File "/tmp/.tmpo1wZW0/venv/lib/python3.11/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/.tmpo1wZW0/venv/lib/python3.11/site-packages/setuptools/build_meta.py", line 295, in _get_build_requires
    self.run_setup()
  File "/tmp/.tmpo1wZW0/venv/lib/python3.11/site-packages/setuptools/build_meta.py", line 480, in run_setup
    super(_BuildMetaLegacyBackend, self).run_setup(setup_script=setup_script)
  File "/tmp/.tmpo1wZW0/venv/lib/python3.11/site-packages/setuptools/build_meta.py", line 311, in run_setup
    exec(code, locals())
  File "<string>", line 99, in <module>
  File "/tmp/.tmpo1wZW0/venv/lib/python3.11/site-packages/pkg_resources/__init__.py", line 528, in get_distribution
    dist = get_provider(dist)
           ^^^^^^^^^^^^^^^^^^
  File "/tmp/.tmpo1wZW0/venv/lib/python3.11/site-packages/pkg_resources/__init__.py", line 400, in get_provider
    return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
                                            ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/.tmpo1wZW0/venv/lib/python3.11/site-packages/pkg_resources/__init__.py", line 968, in require
    needed = self.resolve(parse_requirements(requirements))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/.tmpo1wZW0/venv/lib/python3.11/site-packages/pkg_resources/__init__.py", line 829, in resolve
    dist = self._resolve_dist(
           ^^^^^^^^^^^^^^^^^^^
  File "/tmp/.tmpo1wZW0/venv/lib/python3.11/site-packages/pkg_resources/__init__.py", line 870, in _resolve_dist
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'pip' distribution was not found and is required by the application

thread 'main' panicked at 'assertion failed: self.decision_tracker.assigned_value(solvable_id) == Some(true)', /home/damian/.cargo/git/checkouts/resolvo-09a21884be70392c/7c1fa14/src/solver/mod.rs:219:29
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Expected Behavior: rip should not have even collected apache-beam 2.42.0 as the requirement explicitrly stated apache-beam>=2.47

If this was collected because it was an sdist build requirement (I don't think so? But it's hard to tell from the logs), then I think rip must provide a way to constrain build requirements.

That is interesting, because I agree it should not even consider these versions. Also, the assertion is a bug as well.

Oh for me its no longer an assertion on main, currently the output is:

 Error from source distributions 'apache-beam-2.42.0.zip' skipped:
 could not build wheel: <string>:28: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
Traceback (most recent call last):
  File "/var/folders/fg/9x0q93cj3ls9nktfdlc_09080000gn/T/.tmpGWNwSe/build_frontend.py", line 124, in <module>
    get_requires_for_build_wheel(backend, work_dir)
  File "/var/folders/fg/9x0q93cj3ls9nktfdlc_09080000gn/T/.tmpGWNwSe/build_frontend.py", line 58, in get_requires_for_build_wheel
    result = f()
             ^^^
  File "/private/var/folders/fg/9x0q93cj3ls9nktfdlc_09080000gn/T/.tmpGWNwSe/venv/lib/python3.11/site-packages/setuptools/build_meta.py", line 325, in get_requires_for_build_wheel
    return self._get_build_requires(config_settings, requirements=['wheel'])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/private/var/folders/fg/9x0q93cj3ls9nktfdlc_09080000gn/T/.tmpGWNwSe/venv/lib/python3.11/site-packages/setuptools/build_meta.py", line 295, in _get_build_requires
    self.run_setup()
  File "/private/var/folders/fg/9x0q93cj3ls9nktfdlc_09080000gn/T/.tmpGWNwSe/venv/lib/python3.11/site-packages/setuptools/build_meta.py", line 480, in run_setup
    super(_BuildMetaLegacyBackend, self).run_setup(setup_script=setup_script)
  File "/private/var/folders/fg/9x0q93cj3ls9nktfdlc_09080000gn/T/.tmpGWNwSe/venv/lib/python3.11/site-packages/setuptools/build_meta.py", line 311, in run_setup
    exec(code, locals())
  File "<string>", line 99, in <module>
  File "/private/var/folders/fg/9x0q93cj3ls9nktfdlc_09080000gn/T/.tmpGWNwSe/venv/lib/python3.11/site-packages/pkg_resources/__init__.py", line 528, in get_distribution
    dist = get_provider(dist)
           ^^^^^^^^^^^^^^^^^^
  File "/private/var/folders/fg/9x0q93cj3ls9nktfdlc_09080000gn/T/.tmpGWNwSe/venv/lib/python3.11/site-packages/pkg_resources/__init__.py", line 400, in get_provider
    return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
                                            ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/private/var/folders/fg/9x0q93cj3ls9nktfdlc_09080000gn/T/.tmpGWNwSe/venv/lib/python3.11/site-packages/pkg_resources/__init__.py", line 968, in require
    needed = self.resolve(parse_requirements(requirements))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/private/var/folders/fg/9x0q93cj3ls9nktfdlc_09080000gn/T/.tmpGWNwSe/venv/lib/python3.11/site-packages/pkg_resources/__init__.py", line 829, in resolve
    dist = self._resolve_dist(
           ^^^^^^^^^^^^^^^^^^^
  File "/private/var/folders/fg/9x0q93cj3ls9nktfdlc_09080000gn/T/.tmpGWNwSe/venv/lib/python3.11/site-packages/pkg_resources/__init__.py", line 870, in _resolve_dist
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'pip' distribution was not found and is required by the application

  × Could not solve for requested requirements
  ╰─▶ could not find metadata for any sdist or wheel for this package. No
      metadata could be extracted for the following available artifacts:
      	- apache-beam-2.42.0.zip
  help: Probably an error during processing of source distributions. Please
        check the error message above.

@notatallshaw could you give it another go to see if this matches your output?

@tdejager even with your output it tries a version of apache-beam that conflicts with the second spec though.

Yeah I know, I just want to know it the assertion is gone ;)

I'll have a look if I can create a reproducer in Resolvo.

This is a user error 🤦‍♂️ . The following installs fine:

cargo r -- "apache-airflow[all]==2.8.1" "apache-beam>=2.47"

The following:

cargo r -- apache-airflow[all]==2.8.1 apache-beam>=2.47

Attempts to install apache-airflow[all]==2.8.1 apache-beam and creates a file called "=2.47".

The fact that the latter fails to install is better covered by #174

Sorry for wasting your time. I think I missed this because the output wasn't captured into the new file (is logging on stderr or something?).

That is interesting, because I agree it should not even consider these versions. Also, the assertion is a bug as well.

Also, I retested on main and am no longer getting this assertion error.

Great! The funny thing was I thought: "Oh does that work without quotes" 🤦 😄