I cannot install tensorflow-gpu in WSL
Question regarding CUDA / parallel computing platform.
I notice something interesting.
-
when I run “ollama run Qwen2” in PowerShell, the response is super fast because the main usage is GPU / RTX3060. I monitored the “performance” in Task manager, and i saw the GPU usage is bumped up to 99% for a short period of time when the LLM is responding to my questions.
-
Then I was trying to be creative, so I use WSL (in D:/) then “sudo snap install ollama” then “ollama run qwen2”. By doing so, I can still run the model, but it is primarily using CPU computing power. The CPU’s usage would go up to 99% in this case. I use Ryzen7 3700X 8-core. The speed of response was comparatively much slower than GPU.
Why is that? Can I run WSL and still using GPU for computing, when running LLM (instead of using CPU)? Following this question, I have consult GPT4o, and have met all prerequisites listed below:
Prerequisites
• Windows 11.
• WSL 2 installed.
• NVIDIA GPU with the latest drivers installed.
• NVIDIA CUDA Toolkit installed.
However, this line did not work:
pip install tensorflow-gpu
“pattang56892@PTWin11P02:/mnt/d/02_projects_llm/15_omicron_cuda/01_TensorRT-main$ pip install tensorflow-gpu
Defaulting to user installation because normal site-packages is not writeable
Collecting tensorflow-gpu
Using cached tensorflow-gpu-2.12.0.tar.gz (2.6 kB)
Preparing metadata (setup.py) … error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [39 lines of output]
Traceback (most recent call last):
File “/home/pattang56892/.local/lib/python3.10/site-packages/setuptools/_vendor/packaging/requirements.py”, line 35, in init
parsed = _parse_requirement(requirement_string)
File “/home/pattang56892/.local/lib/python3.10/site-packages/setuptools/_vendor/packaging/_parser.py”, line 64, in parse_requirement
return _parse_requirement(Tokenizer(source, rules=DEFAULT_RULES))
File “/home/pattang56892/.local/lib/python3.10/site-packages/setuptools/_vendor/packaging/_parser.py”, line 82, in _parse_requirement
url, specifier, marker = _parse_requirement_details(tokenizer)
File “/home/pattang56892/.local/lib/python3.10/site-packages/setuptools/_vendor/packaging/_parser.py”, line 126, in _parse_requirement_details
marker = _parse_requirement_marker(
File “/home/pattang56892/.local/lib/python3.10/site-packages/setuptools/_vendor/packaging/_parser.py”, line 147, in _parse_requirement_marker
tokenizer.raise_syntax_error(
File “/home/pattang56892/.local/lib/python3.10/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)
python_version>“3.7”
^
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/tmp/pip-install-99a_4ojz/tensorflow-gpu_3c7458e101cc44328c94822168a30e3e/setup.py", line 40, in <module>
setuptools.setup()
File "/home/pattang56892/.local/lib/python3.10/site-packages/setuptools/__init__.py", line 102, in setup
_install_setup_requires(attrs)
File "/home/pattang56892/.local/lib/python3.10/site-packages/setuptools/__init__.py", line 73, in _install_setup_requires
dist.parse_config_files(ignore_option_errors=True)
File "/home/pattang56892/.local/lib/python3.10/site-packages/setuptools/dist.py", line 634, in parse_config_files
self._finalize_requires()
File "/home/pattang56892/.local/lib/python3.10/site-packages/setuptools/dist.py", line 368, in _finalize_requires
self._normalize_requires()
File "/home/pattang56892/.local/lib/python3.10/site-packages/setuptools/dist.py", line 383, in _normalize_requires
self.install_requires = list(map(str, _reqs.parse(install_requires)))
File "/home/pattang56892/.local/lib/python3.10/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)
python_version>"3.7"
^
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
pattang56892@PTWin11P02:/mnt/d/02_projects_llm/15_omicron_cuda/01_TensorRT-main$”
So, I cannot achieve parallel computing due to this issue.
Can you help?