Enter the chapter number
ch 2
Enter the page number
No response
What is the cell's number in the notebook
13
Enter the environment you are using to run the notebook
Jupyter on MacOS
Describe your issue
Hi Aurélien,
Congratulations on the new edition! I just started working through Chapter 2 and ran into a cross-platform SSL issue with the data download that I thought you might find useful to know about.
Issue
The original urllib.request.urlretrieve() approach can hit SSL certificate verification errors on macOS (and potentially corporate networks), causing the notebook to fail for some users.
Original Code
def load_housing_data():
tarball_path = Path() / "datasets" / "housing" / "housing.tgz"
if not tarball_path.is_file():
Path("datasets/housing").mkdir(parents=True, exist_ok=True)
url = "https://github.com/ageron/data/raw/main/housing.tgz"
urllib.request.urlretrieve(url, tarball_path)
# ... rest of function
Suggested Improvement
def load_housing_data():
tarball_path = DATA_DIR / "housing.tgz"
if not tarball_path.is_file():
DATA_DIR.mkdir(parents=True, exist_ok=True)
url = "https://github.com/ageron/data/raw/main/housing.tgz"
# Use requests library for clean, cross-platform downloads
response = requests.get(url)
response.raise_for_status() # Raises an exception for bad status codes
with open(tarball_path, 'wb') as f:
f.write(response.content)
# ... rest of function
Benefits
- Works consistently across Windows, macOS, and Linux
- Better error handling with clear messages
- No SSL certificate workarounds needed
requests is already a common dependency in ML workflows
Thanks for the excellent book! Looking forward to applying these techniques!
Best regards,
John
Enter what you expected to happen
No response
If you found a workaround, describe it here
No response
Enter the chapter number
ch 2
Enter the page number
No response
What is the cell's number in the notebook
13
Enter the environment you are using to run the notebook
Jupyter on MacOS
Describe your issue
Hi Aurélien,
Congratulations on the new edition! I just started working through Chapter 2 and ran into a cross-platform SSL issue with the data download that I thought you might find useful to know about.
Issue
The original
urllib.request.urlretrieve()approach can hit SSL certificate verification errors on macOS (and potentially corporate networks), causing the notebook to fail for some users.Original Code
Suggested Improvement
Benefits
requestsis already a common dependency in ML workflowsThanks for the excellent book! Looking forward to applying these techniques!
Best regards,
John
Enter what you expected to happen
No response
If you found a workaround, describe it here
No response