Fix Common Scrapy Installation Errors on Windows: lxml, Visual C++, Twisted Workarounds

This tutorial walks through installing Scrapy on Windows, resolving frequent errors like missing lxml by using unofficial Windows binaries, fixing Microsoft Visual C++ 14.0 requirement via Build Tools, and a workaround for unsupported Twisted wheels by renaming .whl to .zip and extracting.

Python Crawling & Data Mining
Python Crawling & Data Mining
Python Crawling & Data Mining
Fix Common Scrapy Installation Errors on Windows: lxml, Visual C++, Twisted Workarounds

Installing Scrapy on Windows: Common Issues and Fixes

Scrapy is a popular Python web crawling framework. While installing via pip install scrapy often fails on Windows due to missing dependencies.

Issue 1: Missing lxml Dependency

Running pip install scrapy may fail with an error indicating missing libxml2. The solution is to install the lxml binary from the unofficial Windows Python package repository (https://www.lfd.uci.edu/~gohlke/pythonlibs/).

Steps:

Visit the repository and search for "lxml".

Download the wheel matching your Python version and architecture (e.g., lxml-4.2.1-cp34-cp34m-win_amd64.whl for Python 3.4 64-bit).

Install it via pip install lxml-4.2.1-cp34-cp34m-win_amd64.whl.

Then run pip install scrapy again.

Error when installing Scrapy without lxml
Error when installing Scrapy without lxml
Unofficial Windows Python package repository
Unofficial Windows Python package repository
Searching for lxml on the repository
Searching for lxml on the repository
Selecting correct lxml wheel for Python 3.4 64-bit
Selecting correct lxml wheel for Python 3.4 64-bit
Installing lxml wheel via pip
Installing lxml wheel via pip
Successful Scrapy installation after lxml
Successful Scrapy installation after lxml
Verifying Scrapy installation with pip list
Verifying Scrapy installation with pip list

Issue 2: Microsoft Visual C++ 14.0 Required

Another common error:

distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.0 is required

. This occurs because the system lacks the Visual C++ Build Tools.

Solution: Download and install the Visual C++ Build Tools from http://landinghub.visualstudio.com/visual-cpp-build-tools. The package is large but can be removed after Scrapy installs successfully.

Visual C++ 14.0 error message
Visual C++ 14.0 error message
Visual C++ Build Tools download page
Visual C++ Build Tools download page

Issue 3: Twisted Wheel Not Supported on This Platform

Error:

Twisted-18.7.0-cp34-cp34m-win_amd64.whl is not a supported wheel on this platform

. Even if the wheel matches your Python version and architecture, pip may reject it.

Workaround: Rename the .whl file to .zip, extract its contents into the virtual environment's site-packages directory, then verify with pip list.

Place the downloaded wheel in the virtual environment's site-packages folder.

Rename Twisted-18.7.0-cp34-cp34m-win_amd64.whl to Twisted-18.7.0-cp34-cp34m-win_amd64.zip.

Extract all files to the same folder.

Run pip list to confirm Twisted appears.

Twisted wheel not supported error
Twisted wheel not supported error
Extracting Twisted wheel after renaming to zip
Extracting Twisted wheel after renaming to zip
pip list showing Twisted installed after extraction
pip list showing Twisted installed after extraction

After resolving these issues, Scrapy and other packages like Pandas install smoothly. The article notes that environments vary, so other problems may arise.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

PythonWindowsweb scrapingScrapypipTwistedlxmlVisual C++
Python Crawling & Data Mining
Written by

Python Crawling & Data Mining

Life's short, I code in Python. This channel shares Python web crawling, data mining, analysis, processing, visualization, automated testing, DevOps, big data, AI, cloud computing, machine learning tools, resources, news, technical articles, tutorial videos and learning materials. Join us!

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.