question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ImportError: No module named 'twisted.persisted'

See original GitHub issue

I haved install scrapy on Python 3.5.2, but when I exeute scrapy -v on command-line, it occurs:

>> scrapy -v
Traceback (most recent call last):
  File "/usr/bin/scrapy", line 7, in <module>
    from scrapy.cmdline import execute
  File "/usr/local/python3.5.2/lib/python3.5/site-packages/scrapy/__init__.py", line 27, in <module>
    from . import _monkeypatches
  File "/usr/local/python3.5.2/lib/python3.5/site-packages/scrapy/_monkeypatches.py", line 20, in <module>
    import twisted.persisted.styles  # NOQA
ImportError: No module named 'twisted.persisted'

So I enter ipython3 to ensure whether it’s installed porperly:

In [2]: import twisted
In [3]: twisted.version
Out[3]: Version('twisted', 15, 2, 1)

But when I import scrapy, the same as command-line:

In [4]: import scrapy
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-4-51c73a18167b> in <module>()
----> 1 import scrapy

/usr/local/python3.5.2/lib/python3.5/site-packages/scrapy/__init__.py in <module>()
     25 
     26 # Apply monkey patches to fix issues in external libraries
---> 27 from . import _monkeypatches
     28 del _monkeypatches
     29 

/usr/local/python3.5.2/lib/python3.5/site-packages/scrapy/_monkeypatches.py in <module>()
     18 # Undo what Twisted's perspective broker adds to pickle register
     19 # to prevent bugs like Twisted#7989 while serializing requests
---> 20 import twisted.persisted.styles  # NOQA
     21 # Remove only entries with twisted serializers for non-twisted types.
     22 for k, v in frozenset(copyreg.dispatch_table.items()):

ImportError: No module named 'twisted.persisted'

I’m so confused, I just want to run a spaider, So help me ! 🆘

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:2
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
keleincommented, Mar 1, 2017

@rolando Thanks a lot ! Conda is useful, my pip works again after installing conda. And it’s easy to install scrapy just by conda install scrapy. 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

ImportError: No module named twisted.persisted.styles
From IDLE, I tried to run a script with a newly installed scrapy 1.0.3. I'm using a script from a friend whom it...
Read more >
Python – ImportError: No module named twisted.persisted.styles ...
From IDLE, I tried to run a script with a newly installed scrapy 1.0.3. I'm using a script from a friend whom it...
Read more >
Scrapy error, "ImportError: No module named twisted"
I've been googling this and trying to solve for a few hours, but no dice yet. I've tried installing the twisted module and...
Read more >
解决import twisted.persisted.styles # NOQA ...
import twisted.persisted.styles # NOQA. ModuleNotFoundError: No module named 'twisted.persisted'. 通过排查:. [root@localhost Python3.6.3]# ...
Read more >
How to install Python-twisted
Done E: Unable to locate package python-twisted pi@rpitest64:~ ... Factory ImportError: No module named twisted.internet.protocol ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found