Windows7下Anaconda环境构建线性回归模型时Python崩溃(APPCRASH)
Environment
- Windows 7 (OS Version: 6.1.7600.2.0.0.256.48)
- Anaconda 3.5 with Python 3.6.4
- Jupyter Notebook
Issue
When trying to build a Linear Regression model using training data in Jupyter Notebook, Python crashes immediately with an APPCRASH error. The full problem signature details are:
Problem Event Name: APPCRASH
Application Name: python.exe
Application Version: 3.6.4150.1013
Application Timestamp: 5a5e439a
Fault Module Name: mkl_core.dll
Fault Module Version: 2018.0.1.1
Fault Module Timestamp: 59d8a332
Exception Code: c000001d
Exception Offset: 0000000001a009a3
Locale ID: 1033
Additional Information 1: 7071
Additional Information 2: 70718f336ba4ddabacde4b6b7fbe73e3
Additional Information 3: de32
Additional Information 4: de328b4df988a86fd2d750fb0942dbd1
Troubleshooting Steps Already Tried (No Success)
- Uninstalled and reinstalled Anaconda completely
- Ran the following update commands:
conda update conda conda update ipython ipython-notebook ipython-qtconsole
I suspect this issue is related to Windows 7, but I'm unsure how to fix it. Any help would be greatly appreciated.
Solutions to Try
Since the crash is tied to mkl_core.dll—part of Intel's Math Kernel Library (MKL) that powers NumPy, SciPy, and scikit-learn—here are targeted fixes tailored to your Windows 7 environment:
Downgrade MKL to a Windows 7-compatible version
The 2018.0.1 MKL version you're running might have compatibility quirks with Windows 7. Let's roll back to an older, stable release that's known to work well on the OS:conda install mkl=2017.0.3Once the install finishes, restart Jupyter Notebook entirely and test your Linear Regression code again.
Swap MKL for OpenBLAS
If MKL keeps causing headaches, switch to OpenBLAS—an open-source alternative that's often more reliable on older Windows systems. Run this command to replace your MKL-backed packages with OpenBLAS versions from conda-forge:conda install numpy scipy scikit-learn -c conda-forge --override-channelsThis will overwrite your current NumPy/SciPy installs with builds that don't depend on MKL.
Disable MKL multi-threading
MKL's default multi-threading can sometimes trigger crashes on older hardware or OS versions. Try limiting it to a single thread before launching Jupyter:- Open a Command Prompt, run:
set MKL_NUM_THREADS=1 - Launch Jupyter Notebook from that same prompt:
jupyter notebook
Test your model training again—this often resolves race condition-related crashes in MKL.
- Open a Command Prompt, run:
Update Windows 7 fully
Missing system updates are a common culprit for library compatibility issues. Make sure your Windows 7 has the latest Service Pack (SP1) and all subsequent security/feature updates installed. This can fix low-level system bugs that MKL might be hitting.Quick sanity check on your data/code
While the crash looks system-related, it's worth ruling out malformed data triggering the MKL error. Add these quick checks to your notebook before training:import numpy as np # Check for NaN/inf values in training data print("Training features have NaNs:", np.isnan(X_train).any()) print("Training features have Infs:", np.isinf(X_train).any()) print("Training labels have NaNs:", np.isnan(y_train).any()) print("Training labels have Infs:", np.isinf(y_train).any())If any of these return
True, clean your data before proceeding.
内容的提问来源于stack exchange,提问作者sagarpavan

