Python_version>“3.7” can't be parsed when installing tensorflow-gpu

I am as new as it gets to coding so please keep this in mind. My problem is as follows:

~/backend/services/facenet$ pip install tensorflow-gpu
Collecting tensorflow-gpu
  Using cached tensorflow-gpu-2.12.0.tar.gz (2.6 kB)
  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
  ╰─> [58 lines of output]
      Traceback (most recent call last):
        File "/tmp/pip-build-env-6hj9_0lr/overlay/lib/python3.12/site-packages/setuptools/_vendor/packaging/requirements.py", line 36, in __init__
          parsed = _parse_requirement(requirement_string)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-6hj9_0lr/overlay/lib/python3.12/site-packages/setuptools/_vendor/packaging/_parser.py", line 62, in parse_requirement
          return _parse_requirement(Tokenizer(source, rules=DEFAULT_RULES))
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-6hj9_0lr/overlay/lib/python3.12/site-packages/setuptools/_vendor/packaging/_parser.py", line 80, in _parse_requirement
          url, specifier, marker = _parse_requirement_details(tokenizer)
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-6hj9_0lr/overlay/lib/python3.12/site-packages/setuptools/_vendor/packaging/_parser.py", line 124, in _parse_requirement_details
          marker = _parse_requirement_marker(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-6hj9_0lr/overlay/lib/python3.12/site-packages/setuptools/_vendor/packaging/_parser.py", line 145, in _parse_requirement_marker
          tokenizer.raise_syntax_error(
        File "/tmp/pip-build-env-6hj9_0lr/overlay/lib/python3.12/site-packages/setuptools/_vendor/packaging/_tokenizer.py", line 167, in raise_syntax_error
          raise ParserSyntaxError(
      packaging._tokenizer.ParserSyntaxError: Expected end or semicolon (after name and no valid version specifier)
          python_version>"3.7"
                        ^
      
      The above exception was the direct cause of the following exception:
      
      Traceback (most recent call last):
        File "/home/carbon12ai/backend/services/facenet/venv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/home/carbon12ai/backend/services/facenet/venv/lib/python3.12/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/carbon12ai/backend/services/facenet/venv/lib/python3.12/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-6hj9_0lr/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 334, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=[])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-6hj9_0lr/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 304, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-6hj9_0lr/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 522, in run_setup
          super().run_setup(setup_script=setup_script)
        File "/tmp/pip-build-env-6hj9_0lr/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 320, in run_setup
          exec(code, locals())
        File "<string>", line 40, in <module>
        File "/tmp/pip-build-env-6hj9_0lr/overlay/lib/python3.12/site-packages/setuptools/__init__.py", line 116, in setup
          _install_setup_requires(attrs)
        File "/tmp/pip-build-env-6hj9_0lr/overlay/lib/python3.12/site-packages/setuptools/__init__.py", line 87, in _install_setup_requires
          dist.parse_config_files(ignore_option_errors=True)
        File "/tmp/pip-build-env-6hj9_0lr/overlay/lib/python3.12/site-packages/setuptools/dist.py", line 654, in parse_config_files
          self._finalize_requires()
        File "/tmp/pip-build-env-6hj9_0lr/overlay/lib/python3.12/site-packages/setuptools/dist.py", line 380, in _finalize_requires
          self._normalize_requires()
        File "/tmp/pip-build-env-6hj9_0lr/overlay/lib/python3.12/site-packages/setuptools/dist.py", line 398, in _normalize_requires
          self.install_requires = list_(map(str, _reqs.parse(install_requires)))
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-6hj9_0lr/overlay/lib/python3.12/site-packages/setuptools/_vendor/packaging/requirements.py", line 38, in __init__
          raise InvalidRequirement(str(e)) from e
      packaging.requirements.InvalidRequirement: Expected end or semicolon (after name and no valid version specifier)
          python_version>"3.7"
                        ^
      [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.

Thank you

Welcome to the forum. Also, thank you for figuring out how to quote code properly.

Well that might make it a bit hard to explain. When you install something with pip, it comes with a list of all the other things that have to be installed to make it work, and the version of Python it works with. Often this list isin a file called requirements.txt, but I think it can have other forms (like JSON).

Each dependency brings its own list of further dependants, and so on, until some sort of complete list is built. Then it gets the things you dont already have from PyPI.

The installation has choked on this description (somewhere, maybe in the description that came with a sub-dependency).

Superficially, this bit of text it couldn’t parse looks valid. But I also notice it happened in setuptools/_vendor/packaging/... which is a sign one of the packages brought its own modified version of the parser. :frowning:

This would be hard to untangle. It isn’t your fault, and if you can narrow it down to the particular package, maybe you have a bug to report. Long tunnel ahead, though.

However, there is hope of a simpler solution. :slight_smile: When I look up tensorflow-gpu at PyPI, I find it tells me not to use it. If you install just plain tensorflow, this might be enough.

1 Like

I think the issue can be answered by tensorflow-gpu’s PyPI page:

This is in setuptools, which vendors its dependencies, this is nothing to worry about.

1 Like

Ha! Didn’t read far enough. :face_with_open_eyes_and_hand_over_mouth:

I reproduce the error exactly, locally. If the owners simply wanted to tell us not to use the package, it’s a very indirect way to do it. (I’m no expert in packaging as you can tell.) Is there really no feature for expressing deprecation?

Hey Jeff,

Thank you. Installing Tensorflow, not Tensorflow GPU is the solution.

Hi James,

Thank you. Installing Tensorflow, not Tensorflow GPU is the solution.

Given that it was a few years ago, it’s possible that something changed since their deprecation that leads to this error, and it’s not worth trying to fix it since the whole thing is deprecated.

There’s no way to mark a package as deprecated on PyPI, but there is (as of this week!) a way to archive them: Adding a mechanism to deprecate a published project - #17 by miketheman

1 Like

Does:

app.config[‘DEEP_FACE_LAB_MODEL_PATH’] = ‘models/deepfacelab_model.pth’ # Path to DeepFaceLab model

indicate I need to provide the path or is this unnecessary?