python importerror no module named zope.interface twisted - python

I am new in python.I installed "scrapy" but it giving error "importerror no module named zope.interface twisted".Please help me.
Thanks in advance..........

Scrapy requires a few additional libraries, namely Twisted and libxml2 (and optionally pyopenssl and simplejson). The installation instructions describes how to install these libraries.

I had the same error after following the steps scrapy suggested, mainly using pip install Scrapy. In order to install some Scrapy dependencies you will need root permision, and my mistake was creating a virtualenv for my scrapy project. Maybe you will run into the same error after following the scrapy setup steps and using virtualenv. Just dont use virtualenv.

Related

ImportError: No module named 'scrapy'

I am fairly new to Python using 3.6 on Windows.
I have installed Scrapy using Anaconda:
> C:\Users\user.name>conda install scrapy Fetching package metadata
> ............. Solving package specifications: .
>
> # All requested packages already installed.
> # packages in environment at C:\Users\user.name\AppData\Local\Continuum\Anaconda3:
> # scrapy 1.3.3 py36_0
However, when I try to import it n the Python IDE I get:
ImportError: No module named 'scrapy'
I also tried with pip which confirmed that all requirements are satisfied. I have searched for an answer and think this may be because I have installed it for one interpreter/environment and am trying to use it in another.
Although, I am not sure if this is correct, or how to tackle it. This is the first time I have used Anaconda (previously I'd just been using PyCharm and pip) so I'm going to spend some time today getting to grips with it, but would appreciate if anyone was able to point me in the right direction!
Try to create a new virtual environment in conda and install scrapy there, and don't forget to activate your environment.
In PyCharm you can specify what environment you want to use for a project in Settings/YourProject/Project Interpreter.

ImportError : cannot import name '_win32stdio'

I am working with Scrapy framework to scrap out data from website, but getting the following error in command prompt:
ImportError: cannot import name '_win32stdio'
Traceback is attached as a screenshot.
Kindly revert if require directory structure of my program's directory.
Scrapy can work with Python 3 on windows if you make some minor adjustments:
Copy the _win32stdio and _pollingfile to the appropriate directory under site-packages. Namely, twisted-dir\internet. Download these from https://github.com/twisted/twisted/tree/trunk/twisted/internet
pip install pypiwin32
Granted, this is based on my personal experience. Because the repository will certainly change in the future, readers should beware the age of this answer.
Update: the twisted-win package is no longer required because the appropriate files are now included in the twisted package.
I have gone through the same. I have resolved by updating the twisted package
pip install --upgrade twisted
or
pip uninstall twisted and pip install twisted
get whl of twisted (from below link) according to your os and py version and you are good to go!
https://www.lfd.uci.edu/~gohlke/pythonlibs/#twisted

lxml runs in interpreter but not through apache/mod_wsgi

I have a django app that requires Python (3.4) lxml package. I had a fair amount of trouble building the c shared libraries libxslt and libxml2 that lxml depends on in my red hat server environment. However, pip install lxml now completes successfully and I can import and use lxml in the command line interpreter.
When I restart apache, importing lxml within my django app causes the error:
ImportError: /usr/local/lib/python3.4/site-packages/lxml/etree.cpython-34m.so: undefined symbol: exsltMathXpathCtxtRegister
I have checked that my LD_LIBRARY_PATH is set the same in both environments (/usr/lib).
I notice that when I reinstall lxml through pip, pip tells me that it is building against libxml2/libxslt found at /usr/lib64. I have removed all libxml2.so and libxslt.so files found at /usr/lib64/ and been confounded to find that pip continues to tell me that it is building against lib64, that the install completes successfully, and that lxml still works correctly at command line but not through apache.
pip also says that the detected version of libxslt that it's using in the install is 1.1.23. However, I've used strace to see that when I import using the interpreter, the library that is loaded is /usr/lib/libxslt.so.1.1.28. I don't know of any tool or technique to find out what library is being loaded through apache..
Does anyone have any theories as to what is going on or how to debug the issue? Thanks in advance!
Fixed by removing libexslt.so files from usr/lib64/.

Scrapy Install / Version Error

Just installed Scrapy and Looking for Installing Portia UI for Scrapy on Python 2.7.6 (32 bit) Windows 7 (64 bit) with connectivity to IPv4 DNS Internet Service.
Getting following output error when version check is done.
C\> scrapy version
:0: UserWarning: You do not have a working installation of the service_identity
module: 'No module named service_identity'. Please install it from <https://pyp
i.python.org/pypi/service_identity> and make sure all of its dependencies are sa
tisfied. Without the service_identity module and a recent enough pyOpenSSL to s
upport it, Twisted can perform only rudimentary TLS client hostname verification
. Many valid certificate/hostname mappings may be rejected.
Scrapy 0.22.2
The project can be created but Scrapy seems non responsive to the Spiders as well.
The Scrapy installation is with all Win32 versions of in the order described on the Scrapy Site http://doc.scrapy.org/en/latest/intro/install.html and wherever required pip install or easy_install.
How shall I go about clearing the problem?
This should help:
pip install service_identity

Where to get Python ANTLR package to use StringTemplate?

I'd like to do some code generation, and StringTemplate looks like a pretty good tool for the job. I easy_installed stringtemplate3 from PyPi, but when I try to import it I get:
ImportError: No module named antlr
I am confused by this because I thought that ANTLR depended on StringTemplate (as the website says), not the other way around. In any case, I cannot find the correct package to fix this. Installing antlr_python_runtime did not help.
Any hints?
You need to have the python-antlr package installed to use stringtemplate3. Example of installing on Ubuntu:
% sudo aptitude install python-antlr
% virtualenv ~/virt
% . ~/virt/bin/activate
(virt)~% easy_install stringtemplate3
(virt)~% python -c 'import stringtemplate3'
FWIW this package is named py26-antlr3 on Macports (not sure which platform / package manager you're using).
I was facing the same issue and packaged the antlr python library: you can pip install git+git://github.com/kynan/antlr.git#egg=antlr to install it.

Categories