anntzer / mplcursors

Interactive data selection cursors for Matplotlib.
https://mplcursors.readthedocs.io
zlib License
114 stars 20 forks source link

Error installing with poetry #55

Closed josmithua closed 2 years ago

josmithua commented 2 years ago

I get an error when trying to install mplcursors with poetry v1.2.1. Can anyone try to reproduce?

Python version: 3.10.6 Poetry version: 1.2.1

Here's my pyproject.toml file:

[tool.poetry]
name = "test"
version = "0.1.0"
description = ""
authors = ["Joshua <redacted>"]
readme = "README.md"

[tool.poetry.dependencies]
python = "^3.10"
matplotlib = "^3.6.0"
numpy = "^1.23.3"
mplcursors = "^0.5.1"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

Here's the terminal log:

❯ poetry add mplcursors
Using version ^0.5.1 for mplcursors

Updating dependencies
Resolving dependencies... (0.2s)

Package operations: 1 install, 0 updates, 0 removals

  • Installing mplcursors (0.5.1): Failed

  CalledProcessError

  Command '['/Users/joshua/bp/agilik-app/.venv/bin/python', '-m', 'pip', 'install', '--use-pep517', '--disable-pip-version-check', '--prefix', '/Users/joshua/bp/agilik-app/.venv', '--no-deps', '/Users/joshua/Library/Caches/pypoetry/artifacts/3e/7f/e0/768ee11328be8de8463e8559fc6cd4b64fdc4b063c37530d70c9c426a9/mplcursors-0.5.1.tar.gz']' returned non-zero exit status 1.

  at /opt/homebrew/Cellar/python@3.10/3.10.6_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/subprocess.py:524 in run
       520│             # We don't call process.wait() as .__exit__ does that for us.
       521│             raise
       522│         retcode = process.poll()
       523│         if check and retcode:
    →  524│             raise CalledProcessError(retcode, process.args,
       525│                                      output=stdout, stderr=stderr)
       526│     return CompletedProcess(process.args, retcode, stdout, stderr)
       527│ 
       528│ 

The following error occurred when trying to handle this error:

  EnvCommandError

  Command ['/Users/joshua/bp/agilik-app/.venv/bin/python', '-m', 'pip', 'install', '--use-pep517', '--disable-pip-version-check', '--prefix', '/Users/joshua/bp/agilik-app/.venv', '--no-deps', '/Users/joshua/Library/Caches/pypoetry/artifacts/3e/7f/e0/768ee11328be8de8463e8559fc6cd4b64fdc4b063c37530d70c9c426a9/mplcursors-0.5.1.tar.gz'] errored with the following return code 1, and output: 
  Processing /Users/joshua/Library/Caches/pypoetry/artifacts/3e/7f/e0/768ee11328be8de8463e8559fc6cd4b64fdc4b063c37530d70c9c426a9/mplcursors-0.5.1.tar.gz
    Installing build dependencies: started
    Installing build dependencies: finished with status 'done'
    Getting requirements to build wheel: started
    Getting requirements to build wheel: finished with status 'error'
    error: subprocess-exited-with-error

    × Getting requirements to build wheel did not run successfully.
    │ exit code: 1
    ╰─> [25 lines of output]
        Traceback (most recent call last):
          File "/Users/joshua/bp/agilik-app/.venv/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
            main()
          File "/Users/joshua/bp/agilik-app/.venv/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
            json_out['return_val'] = hook(**hook_input['kwargs'])
          File "/Users/joshua/bp/agilik-app/.venv/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 130, in get_requires_for_build_wheel
            return hook(config_settings)
          File "/private/var/folders/_q/1_x51wcx0nxb765zswhnp7lh0000gn/T/pip-build-env-q9_ycjdj/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 338, in get_requires_for_build_wheel
            return self._get_build_requires(config_settings, requirements=['wheel'])
          File "/private/var/folders/_q/1_x51wcx0nxb765zswhnp7lh0000gn/T/pip-build-env-q9_ycjdj/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 320, in _get_build_requires
            self.run_setup()
          File "/private/var/folders/_q/1_x51wcx0nxb765zswhnp7lh0000gn/T/pip-build-env-q9_ycjdj/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 482, in run_setup
            super(_BuildMetaLegacyBackend,
          File "/private/var/folders/_q/1_x51wcx0nxb765zswhnp7lh0000gn/T/pip-build-env-q9_ycjdj/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 335, in run_setup
            exec(code, locals())
          File "<string>", line 11, in <module>
          File "/private/var/folders/_q/1_x51wcx0nxb765zswhnp7lh0000gn/T/pip-req-build-jfslvj21/setupext.py", line 26, in register_pth_hook
            source = inspect.getsource(func)
          File "/opt/homebrew/Cellar/python@3.10/3.10.6_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/inspect.py", line 1147, in getsource
            lines, lnum = getsourcelines(object)
          File "/opt/homebrew/Cellar/python@3.10/3.10.6_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/inspect.py", line 1129, in getsourcelines
            lines, lnum = findsource(object)
          File "/opt/homebrew/Cellar/python@3.10/3.10.6_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/inspect.py", line 958, in findsource
            raise OSError('could not get source code')
        OSError: could not get source code
        [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.

  at ~/Library/Application Support/pypoetry/venv/lib/python3.10/site-packages/poetry/utils/env.py:1476 in _run
      1472│                 output = subprocess.check_output(
      1473│                     command, stderr=subprocess.STDOUT, env=env, **kwargs
      1474│                 )
      1475│         except CalledProcessError as e:
    → 1476│             raise EnvCommandError(e, input=input_)
      1477│ 
      1478│         return decode(output)
      1479│ 
      1480│     def execute(self, bin: str, *args: str, **kwargs: Any) -> int:

The following error occurred when trying to handle this error:

  PoetryException

  Failed to install /Users/joshua/Library/Caches/pypoetry/artifacts/3e/7f/e0/768ee11328be8de8463e8559fc6cd4b64fdc4b063c37530d70c9c426a9/mplcursors-0.5.1.tar.gz

  at ~/Library/Application Support/pypoetry/venv/lib/python3.10/site-packages/poetry/utils/pip.py:51 in pip_install
       47│ 
       48│     try:
       49│         return environment.run_pip(*args)
       50│     except EnvCommandError as e:
    →  51│         raise PoetryException(f"Failed to install {path.as_posix()}") from e
       52│ 
anntzer commented 2 years ago

I can repro without poetry with just pip wheel -wdist --no-deps --use-pep517 .. I pushed a fix to master; can you test that (without me making a release yet)?

josmithua commented 2 years ago

Thanks for the quick response, it works!

❯ poetry add git+https://github.com/anntzer/mplcursors.git#main

Updating dependencies
Resolving dependencies... (0.1s)

Writing lock file

Package operations: 1 install, 0 updates, 0 removals

  • Installing mplcursors (0.5.1.post11+g16db651 16db651)
josmithua commented 2 years ago

I actually am running into this on Windows as well. Will you be releasing the fix soon? Thanks.

anntzer commented 2 years ago

Done.