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

Unable to parse https+git urls #8

Closed
glensc opened this issue Aug 4, 2022 · 8 comments
Closed

Unable to parse https+git urls #8

glensc opened this issue Aug 4, 2022 · 8 comments

Comments

@glensc
Copy link
Contributor

glensc commented Aug 4, 2022

requirements file:

error:

➜ plextraktsync self-update --pr 984
Updating PlexTraktSync to the pull request #984 version using pipx
  WARNING: Did not find branch or tag 'refs/pull/984/head', assuming revision or ref.
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [40 lines of output]
      /private/var/folders/f1/qj3m1q9507d2_7rnqwfgzyrm0000gp/T/pip-build-env-7_89su2o/overlay/lib/python3.10/site-packages/setuptools/config/setupcfg.py:463: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.
        warnings.warn(msg, warning_class)
      Traceback (most recent call last):
        File "/private/var/folders/f1/qj3m1q9507d2_7rnqwfgzyrm0000gp/T/pip-build-env-7_89su2o/overlay/lib/python3.10/site-packages/pkg_resources/_vendor/packaging/requirements.py", line 102, in __init__
          req = REQUIREMENT.parseString(requirement_string)
        File "/private/var/folders/f1/qj3m1q9507d2_7rnqwfgzyrm0000gp/T/pip-build-env-7_89su2o/overlay/lib/python3.10/site-packages/pkg_resources/_vendor/pyparsing/core.py", line 1143, in parse_string
          raise exc.with_traceback(None)
      pkg_resources._vendor.pyparsing.exceptions.ParseException: Expected string_end, found '+'  (at char 3), (line:1, col:4)

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
        File "/Users/glen/.local/pipx/shared/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
          main()
        File "/Users/glen/.local/pipx/shared/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/glen/.local/pipx/shared/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/f1/qj3m1q9507d2_7rnqwfgzyrm0000gp/T/pip-build-env-7_89su2o/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 177, in get_requires_for_build_wheel
          return self._get_build_requires(
        File "/private/var/folders/f1/qj3m1q9507d2_7rnqwfgzyrm0000gp/T/pip-build-env-7_89su2o/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 159, in _get_build_requires
          self.run_setup()
        File "/private/var/folders/f1/qj3m1q9507d2_7rnqwfgzyrm0000gp/T/pip-build-env-7_89su2o/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 174, in run_setup
          exec(code, locals())
        File "<string>", line 1, in <module>
        File "/private/var/folders/f1/qj3m1q9507d2_7rnqwfgzyrm0000gp/T/pip-build-env-7_89su2o/overlay/lib/python3.10/site-packages/setuptools/__init__.py", line 87, in setup
          return distutils.core.setup(**attrs)
        File "/private/var/folders/f1/qj3m1q9507d2_7rnqwfgzyrm0000gp/T/pip-build-env-7_89su2o/overlay/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 159, in setup
          dist.parse_config_files()
        File "/private/var/folders/f1/qj3m1q9507d2_7rnqwfgzyrm0000gp/T/pip-build-env-7_89su2o/overlay/lib/python3.10/site-packages/declarative_requirements/integration.py", line 105, in wrapper
          dist._finalize_requires()
        File "/private/var/folders/f1/qj3m1q9507d2_7rnqwfgzyrm0000gp/T/pip-build-env-7_89su2o/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 577, in _finalize_requires
          self._move_install_requirements_markers()
        File "/private/var/folders/f1/qj3m1q9507d2_7rnqwfgzyrm0000gp/T/pip-build-env-7_89su2o/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 617, in _move_install_requirements_markers
          inst_reqs = list(_reqs.parse(spec_inst_reqs))
        File "/private/var/folders/f1/qj3m1q9507d2_7rnqwfgzyrm0000gp/T/pip-build-env-7_89su2o/overlay/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3102, in __init__
          super(Requirement, self).__init__(requirement_string)
        File "/private/var/folders/f1/qj3m1q9507d2_7rnqwfgzyrm0000gp/T/pip-build-env-7_89su2o/overlay/lib/python3.10/site-packages/pkg_resources/_vendor/packaging/requirements.py", line 104, in __init__
          raise InvalidRequirement(
      pkg_resources.extern.packaging.requirements.InvalidRequirement: Parse error at "'+https:/'": Expected string_end
      [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.
Cannot determine package name from spec 'git+https://github.com/Taxel/PlexTraktSync@refs/pull/984/head'. Check package spec
for errors.
@s0undt3ch
Copy link
Owner

The error thrown by pkg_resources should be indicative.

pkg_resources._vendor.pyparsing.exceptions.ParseException: Expected string_end, found '+'  (at char 3), (line:1, col:4)

Setuptools doesn't handle these types of requirements, and this package is not meant to work around that.

See https://setuptools.pypa.io/en/latest/userguide/dependency_management.html?highlight=install_requires#declaring-required-dependency for additional information.

@glensc
Copy link
Contributor Author

glensc commented Aug 5, 2022

I don't see any git, http, https examples there, so the only way to install is to publish all packages in dependencies to PyPI? i.e can install only via pypi?

what I'm trying to do is to install application with pipx, and even a pull request (which works):

but it broke when one package was replaced with git+https:// scheme:

@s0undt3ch
Copy link
Owner

I don't see any git, http, https examples there,

Precisely :)
It doesn't support it.

You might get away if you use a URL to a zip or tarball, for example, https://github.com/glensc/python-trakt/archive/refs/tags/3.4.0.zip

@glensc
Copy link
Contributor Author

glensc commented Oct 23, 2022

Getting weird hash mismatch error:

ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE.

➜ pipenv --clear
Clearing caches...

➜ pipenv install "https://github.com/glensc/python-trakt/archive/refs/tags/3.4.0.zip#egg=trakt"
Installing https://github.com/glensc/python-trakt/archive/refs/tags/3.4.0.zip#egg=trakt...
Adding trakt to Pipfile's [packages]...
✔ Installation Succeeded
Installing dependencies from Pipfile.lock (77c318)...
  🐍   ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 1/1 — 
00:00:00

An error occurred while installing https://github.com/glensc/python-trakt/archive/refs/tags/3.4.0.zip#egg=trakt --hash=sha256:a5f54258102c747ff50f3ffecc8ed52f20706938f620da4dd016d47ee4fd75ae --hash=sha256:1efd909378a09dd0abc3f056e12b2c18cad20cc699bfd211d1807414ba77d90d! Will try again.
Installing initially failed dependencies...
[pipenv.exceptions.InstallError]: Collecting trakt00
[pipenv.exceptions.InstallError]:   Using cached https://github.com/glensc/python-trakt/archive/refs/tags/3.4.0.zip (107 kB)
[pipenv.exceptions.InstallError]: ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the package versions, please update the hashes. Otherwise, examine the package contents carefully; someone may have tampered with them.
[pipenv.exceptions.InstallError]:     trakt from https://github.com/glensc/python-trakt/archive/refs/tags/3.4.0.zip#egg=trakt (from -r /var/folders/dy/njc5pldd1hs0ym8p7nzqcn7w0000gn/T/pipenv-hqupd3up-requirements/pipenv-45v9f_bc-requirement.txt (line 1)):
[pipenv.exceptions.InstallError]:         Expected sha256 1efd909378a09dd0abc3f056e12b2c18cad20cc699bfd211d1807414ba77d90d
[pipenv.exceptions.InstallError]:         Expected     or a5f54258102c747ff50f3ffecc8ed52f20706938f620da4dd016d47ee4fd75ae
[pipenv.exceptions.InstallError]:              Got        4a540c64fcd520daadf9b03bd933122a1dbcbcb5091c610f291c00720287b140
ERROR: Couldn't install package: trakt
 Package installation failed...
  ☤  ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 0/1 — 00:00:01

EDIT: Seems pipenv got confused with previous Pipenv.lock entry, fixed by removing package with same name first (pipenv uninstall trakt).

The resulting commit:

@glensc
Copy link
Contributor Author

glensc commented Oct 23, 2022

The .zip url also ends up with failing to install from a github repo:

pkg_resources.extern.packaging.requirements.InvalidRequirement: Parse error at "'://githu'": Expected string_end

➜ plextraktsync self-update --pr 984
Updating PlexTraktSync to the pull request #984 version using pipx
pipx install --suffix=@984 --force git+https://github.com/Taxel/PlexTraktSync@refs/pull/984/head
  WARNING: Did not find branch or tag 'refs/pull/984/head', assuming revision or ref.
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [40 lines of output]
      /private/var/folders/dy/njc5pldd1hs0ym8p7nzqcn7w0000gn/T/pip-build-env-z9jnk72g/overlay/lib/python3.10/site-packages/setuptools/config/setupcfg.py:508: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.
        warnings.warn(msg, warning_class)
      Traceback (most recent call last):
        File "/private/var/folders/dy/njc5pldd1hs0ym8p7nzqcn7w0000gn/T/pip-build-env-z9jnk72g/overlay/lib/python3.10/site-packages/pkg_resources/_vendor/packaging/requirements.py", line 102, in __init__
          req = REQUIREMENT.parseString(requirement_string)
        File "/private/var/folders/dy/njc5pldd1hs0ym8p7nzqcn7w0000gn/T/pip-build-env-z9jnk72g/overlay/lib/python3.10/site-packages/pkg_resources/_vendor/pyparsing/core.py", line 1141, in parse_string
          raise exc.with_traceback(None)
      pkg_resources._vendor.pyparsing.exceptions.ParseException: Expected string_end, found ':'  (at char 5), (line:1, col:6)

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
        File "/Users/glen/.local/pipx/shared/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 351, in <module>
          main()
        File "/Users/glen/.local/pipx/shared/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 333, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/Users/glen/.local/pipx/shared/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
        File "/private/var/folders/dy/njc5pldd1hs0ym8p7nzqcn7w0000gn/T/pip-build-env-z9jnk72g/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/dy/njc5pldd1hs0ym8p7nzqcn7w0000gn/T/pip-build-env-z9jnk72g/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 320, in _get_build_requires
          self.run_setup()
        File "/private/var/folders/dy/njc5pldd1hs0ym8p7nzqcn7w0000gn/T/pip-build-env-z9jnk72g/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 335, in run_setup
          exec(code, locals())
        File "<string>", line 1, in <module>
        File "/private/var/folders/dy/njc5pldd1hs0ym8p7nzqcn7w0000gn/T/pip-build-env-z9jnk72g/overlay/lib/python3.10/site-packages/setuptools/__init__.py", line 87, in setup
          return distutils.core.setup(**attrs)
        File "/private/var/folders/dy/njc5pldd1hs0ym8p7nzqcn7w0000gn/T/pip-build-env-z9jnk72g/overlay/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 159, in setup
          dist.parse_config_files()
        File "/private/var/folders/dy/njc5pldd1hs0ym8p7nzqcn7w0000gn/T/pip-build-env-z9jnk72g/overlay/lib/python3.10/site-packages/declarative_requirements/integration.py", line 105, in wrapper
          dist._finalize_requires()
        File "/private/var/folders/dy/njc5pldd1hs0ym8p7nzqcn7w0000gn/T/pip-build-env-z9jnk72g/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 577, in _finalize_requires
          self._move_install_requirements_markers()
        File "/private/var/folders/dy/njc5pldd1hs0ym8p7nzqcn7w0000gn/T/pip-build-env-z9jnk72g/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 617, in _move_install_requirements_markers
          inst_reqs = list(_reqs.parse(spec_inst_reqs))
        File "/private/var/folders/dy/njc5pldd1hs0ym8p7nzqcn7w0000gn/T/pip-build-env-z9jnk72g/overlay/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3102, in __init__
          super(Requirement, self).__init__(requirement_string)
        File "/private/var/folders/dy/njc5pldd1hs0ym8p7nzqcn7w0000gn/T/pip-build-env-z9jnk72g/overlay/lib/python3.10/site-packages/pkg_resources/_vendor/packaging/requirements.py", line 104, in __init__
          raise InvalidRequirement(
      pkg_resources.extern.packaging.requirements.InvalidRequirement: Parse error at "'://githu'": Expected string_end
      [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.
Cannot determine package name from spec 'git+https://github.com/Taxel/PlexTraktSync@refs/pull/984/head'. Check
package spec for errors.

the requirements file it saw:

@glensc
Copy link
Contributor Author

glensc commented Oct 23, 2022

Ok, the trick seems to be needing to add "trakt@" manually to requirements.txt:

not sure why I could not read that out the first place from the documentation.

sorry to spam here, just wanted to have all related discussion in same place.

@s0undt3ch
Copy link
Owner

Glad you worked that out 😀

@glensc
Copy link
Contributor Author

glensc commented Oct 23, 2022

Dah. Still encountered some error, this time with PyPI publishing step:

WARNING  Error during upload. Retry with the --verbose option for more details. 
ERROR    HTTPError: 400 Bad Request from https://upload.pypi.org/legacy/        
         Invalid value for requires_dist. Error: Can't have direct dependency:  
         'trakt @                                                               
         https://github.com/glensc/python-trakt/archive/refs/tags/3.4.2.zip#egg=
         trakt'                           

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants