Skip to content

pip package mismatch on intel Mac device due to the deprecation from pytorch and tensorflow officials #803

@myme5261314

Description

@myme5261314

Bug description

For intel CPU Mac device, the latest version supported by official is torch==2.2.2 and tensorflow==2.16.2.
The torch's issue is here https://discuss.pytorch.org/t/why-no-macosx-x86-64-build-after-torch-2-2-2-cp39-none-macosx-10-9-x86-64-whl/204546
I haven't found link for tensorflow but diagnositc the version through its wheel filename convention tag.
So, I locally adjust three places of the version string and finally installed all the requirements file in the project successfully.
But I'm not familiar with this project's CI test, so I haven't commited local changes but paste the diff patch below.

diff --git a/ch05/11_qwen3/qwen3-chat-interface/requirements-extra.txt b/ch05/11_qwen3/qwen3-chat-interface/requirements-extra.txt
index e30c39b..d0b7154 100644
--- a/ch05/11_qwen3/qwen3-chat-interface/requirements-extra.txt
+++ b/ch05/11_qwen3/qwen3-chat-interface/requirements-extra.txt
@@ -1,5 +1,5 @@
 chainlit>=1.2.0
 huggingface_hub>=0.34.4
-llms_from_scratch>=1.0.18  # to import code from this repo
+# llms_from_scratch>=1.0.18  # to import code from this repo
 safetensors>=0.6.2
 tokenizers>=0.21.1
\ No newline at end of file
diff --git a/pyproject.toml b/pyproject.toml
index 02cffbe..434c84d 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -9,11 +9,11 @@ description = "Implement a ChatGPT-like LLM in PyTorch from scratch, step by ste
 readme = "README.md"
 requires-python = ">=3.10,<3.13"
 dependencies = [
-    "torch>=2.3.0",
+    "torch>=2.2.2",
     "jupyterlab>=4.0",
     "tiktoken>=0.5.1",
     "matplotlib>=3.7.1",
-    "tensorflow>=2.18.0",
+    "tensorflow>=2.16.2",
     "tqdm>=4.66.1",
     "numpy>=1.26,<2.1",
     "pandas>=2.2.1",
diff --git a/requirements.txt b/requirements.txt
index 3940856..41b99ad 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,8 +1,8 @@
-torch >= 2.3.0             # all
+torch >= 2.2.2             # all
 jupyterlab >= 4.0          # all
 tiktoken >= 0.5.1          # ch02; ch04; ch05
 matplotlib >= 3.7.1        # ch04; ch06; ch07
-tensorflow >= 2.18.0       # ch05; ch06; ch07
+tensorflow >= 2.16.2       # ch05; ch06; ch07
 tqdm >= 4.66.1             # ch05; ch07
 numpy >= 1.26, < 2.1       # dependency of several other libraries like torch and pandas
 pandas >= 2.2.1            # ch06


What operating system are you using?

macOS

Where do you run your code?

Local (laptop, desktop)

Environment

[OK] Your Python version is 3.12.11
2025-09-03 15:12:36.617405: I tensorflow/core/platform/cpu_feature_guard.cc:210] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
AttributeError: 'MessageFactory' object has no attribute 'GetPrototype'
AttributeError: 'MessageFactory' object has no attribute 'GetPrototype'
AttributeError: 'MessageFactory' object has no attribute 'GetPrototype'
AttributeError: 'MessageFactory' object has no attribute 'GetPrototype'
AttributeError: 'MessageFactory' object has no attribute 'GetPrototype'
AttributeError: 'MessageFactory' object has no attribute 'GetPrototype'
Unable to revert mtime: /Library/Fonts
Matplotlib is building the font cache; this may take a moment.
[OK] torch 2.2.2
[OK] jupyterlab 4.4.6
[OK] tiktoken 0.11.0
[OK] matplotlib 3.10.6
[OK] tensorflow 2.16.2
[OK] tqdm 4.67.1
[OK] numpy 1.26.4
[OK] pandas 2.3.2
[OK] psutil 7.0.0

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions