I am new to Python. I installed Scrapy on ubuntu linux. When I run Scrapy shell
I get this error
File "/home/user/.local/lib/python3.10/site-packages/scrapy/downloadermiddlewares/retry.py", line 25, in <module>
from twisted.web.client import ResponseFailed
File "/home/user/.local/lib/python3.10/site-packages/twisted/web/client.py", line 24, in <module>
from twisted.internet.endpoints import HostnameEndpoint, wrapClientTLS
File "/home/user/.local/lib/python3.10/site-packages/twisted/internet/endpoints.py", line 63, in <module>
from twisted.python.systemd import ListenFDs
File "/home/user/.local/lib/python3.10/site-packages/twisted/python/systemd.py", line 18, in <module>
from attrs import Factory, define
ModuleNotFoundError: No module named 'attrs'
I also already ran the commands
python3.10 -m pip install attrs
pip install attrs
with the result
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: attrs in /usr/lib/python3/dist-packages (21.2.0)
2
Answers
few days ago i was also facing same issue while trying to run my scraper spider on linux server then i figured it out by running my scrapy spider inside an virtual environment. Hopefully it will also work for you.:)
For me what worked was to uninstall scrapy and attrs (
pip uninstall scrapy attrs
) and reinstalling scrapy. I didn’t have to re-install attrs because scrapy ships with it’s own version of attrs.