'Scrapy: No module named 'scrapy.contrib'
I've looked everywhere for a solution to this. I didn't used to have a problem calling "from scrapy.contrib..." but now it throws this error.
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'scrapy.contrib'
Posting here as a last resort. Any help here would be extremely welcome.
Solution 1:[1]
scrapy.contrib
has been deprecated for ages now.
It was removed in the 1.6 release of scrapy.
For more details, see https://docs.scrapy.org/en/latest/news.html#deprecation-removals
Solution 2:[2]
from scrapy.linkextractors.sgml import SgmlLinkExtractor
Solution 3:[3]
from scrapy.linkextractors import LinkExtractor
Solution 4:[4]
just remove contrib and write command as below from scrapy.linkextractors import LinkExtractor from scrapy.spiders import CrawlSpider, Rule
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | stranac |
Solution 2 | kamran kausar |
Solution 3 | Daniel Bonetti |
Solution 4 | Nizami Imamverdiyev |