Get error when try to install my django-polls package

Hi, I am new for Python, and started my first projects,
I followed this tutorial to install the development version of django on windows 11 with python Python 3.11.5:

pip fails with the following error:

Processing c:\learning\python\django-polls\dist\django-polls-0.1.tar.gz
  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
  ╰─> [56 lines of output]
      Traceback (most recent call last):
        File "C:\Users\larry\AppData\Local\Temp\pip-build-env-j_b5l2ed\overlay\Lib\site-packages\setuptools\_vendor\packaging\requirements.py", line 35, in __init__
          parsed = _parse_requirement(requirement_string)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\larry\AppData\Local\Temp\pip-build-env-j_b5l2ed\overlay\Lib\site-packages\setuptools\_vendor\packaging\_parser.py", line 64, in parse_requirement
          return _parse_requirement(Tokenizer(source, rules=DEFAULT_RULES))
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\larry\AppData\Local\Temp\pip-build-env-j_b5l2ed\overlay\Lib\site-packages\setuptools\_vendor\packaging\_parser.py", line 82, in _parse_requirement
          url, specifier, marker = _parse_requirement_details(tokenizer)
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\larry\AppData\Local\Temp\pip-build-env-j_b5l2ed\overlay\Lib\site-packages\setuptools\_vendor\packaging\_parser.py", line 126, in _parse_requirement_details        
          marker = _parse_requirement_marker(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\larry\AppData\Local\Temp\pip-build-env-j_b5l2ed\overlay\Lib\site-packages\setuptools\_vendor\packaging\_parser.py", line 147, in _parse_requirement_marker
          tokenizer.raise_syntax_error(
        File "C:\Users\larry\AppData\Local\Temp\pip-build-env-j_b5l2ed\overlay\Lib\site-packages\setuptools\_vendor\packaging\_tokenizer.py", line 165, in raise_syntax_error
          raise ParserSyntaxError(
      setuptools.extern.packaging._tokenizer.ParserSyntaxError: Expected end or semicolon (after name and no valid version specifier)
          Django >= X.Y
                 ^

      The above exception was the direct cause of the following exception:

      Traceback (most recent call last):
        File "C:\Users\larry\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
          main()
        File "C:\Users\larry\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\larry\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel 
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\larry\AppData\Local\Temp\pip-build-env-j_b5l2ed\overlay\Lib\site-packages\setuptools\build_meta.py", line 355, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\larry\AppData\Local\Temp\pip-build-env-j_b5l2ed\overlay\Lib\site-packages\setuptools\build_meta.py", line 325, in _get_build_requires
          self.run_setup()
        File "C:\Users\larry\AppData\Local\Temp\pip-build-env-j_b5l2ed\overlay\Lib\site-packages\setuptools\build_meta.py", line 341, in run_setup
          exec(code, locals())
        File "<string>", line 3, in <module>
        File "C:\Users\larry\AppData\Local\Temp\pip-build-env-j_b5l2ed\overlay\Lib\site-packages\setuptools\dist.py", line 655, in parse_config_files
          self._finalize_requires()
        File "C:\Users\larry\AppData\Local\Temp\pip-build-env-j_b5l2ed\overlay\Lib\site-packages\setuptools\dist.py", line 390, in _finalize_requires
          self._normalize_requires()
        File "C:\Users\larry\AppData\Local\Temp\pip-build-env-j_b5l2ed\overlay\Lib\site-packages\setuptools\dist.py", line 405, in _normalize_requires
          self.install_requires = list(map(str, _reqs.parse(install_requires)))
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\larry\AppData\Local\Temp\pip-build-env-j_b5l2ed\overlay\Lib\site-packages\setuptools\_vendor\packaging\requirements.py", line 37, in __init__
          raise InvalidRequirement(str(e)) from e
      setuptools.extern.packaging.requirements.InvalidRequirement: Expected end or semicolon (after name and no valid version specifier)
          Django >= X.Y
                 ^
      [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.
1 Like

Please provide more information about your problem. Which step were you on? What does your code look like?

Otherwise you’re limiting yourself to help only from people who are extremely familiar with that tutorial.

Side note: When posting code, templates, error messages, or other preformatted text, surround the text between lines of three backtick - `. This means you’ll have a line of ```, then your code (etc), then another line of ```. This forces the forums software to keep that text properly formatted. (I’ve taken the liberty of adding this to your original post.)

Please post the complete contents of your config.cfg file, enclosed between lines of ``` as described above.

My initial guess is that you did not replace the X.Y in the text of that file with the actual version number of Django that is required for your package, as described by the comment in the tutorial.

1 Like

Thank you @KenWhitesell.

I followed the same tutorial as mentioned above, and made the mistake you mentioned.

Changing that setting solved the issue.

It would have been nice, if the tutorial mentioned the required change (besides the comment in the code snippet).