Home > Software design >  Python3 error No module named 'attrs' when running Scrapy in Ubuntu terminal
Python3 error No module named 'attrs' when running Scrapy in Ubuntu terminal

Time:01-31

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)

CodePudding user response:

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.:)

  • Related