Sudo apt get install python twisted web

ImportError: No module named twisted.internet

I installed python 2.7.5 which is working fine. I then install scrapy (which, I think, uses twisted internally). My scrapy spider is also working fine. I installed twisted:

from twisted.internet import protocol, reactor class Echo(protocol.Protocol): def dataReceived(self, data): self.transport.write(data) class EchoFactory(protocol.Factory): def buildProtocol(self, addr): return Echo() reactor.listenTCP(1234, EchoFactory()) reactor.run() 
$ python twistedTester.py Traceback (most recent call last): File "twistedTester.py", line 1, in from twisted.internet import protocol, reactor ImportError: No module named twisted.internet 

Can anyone help me with how I can debug why my twisted package is not being picked up by Python installation?

Try running which python — what does it tell you? What about which python2.7 ? How about python -c «import twisted; print(twisted)» ? Do you perhaps have a file called twisted.py somewhere on sys.path ?

7 Answers 7

The same works with w3lib and lxml.

On some *nix systems this might give you a permission error. If that happens, try:

sudo -H pip install twisted 

This worked for me, also, note, on mac os X it may say «error 1:permission denied» unless sudo is used. «sudo pip install twisted»

Читайте также:  Javascript on page loaded event

I figured out why this error was happening. For some reason, using apt-get to install a python package was not installing it right.

So, I had to download a tar ball and install the package from them.

I downloaded Twisted tar from here.

I did a tar xjf Twisted-13.1.0.tar.bz2 — this created a directory called Twisted-13.1.0

next, cd Twisted-13.1.0 Finally, python setup.py install

This gave me an error. Twisted required another package called zope.interface. So, I downloaded tar ball for zope.interface from here. Then, ran this command tar xzf zope.interface-3.6.1.tar.gz That created a folder called zope.interface-3.6.1. So, cd into zope.interface-3.6.1 and run python setup.py install

Note: Depending on your user’s rights, you may want to do these commands in sudo mode. Just add the keyword sudo before every command.

Источник

python-twisted-web on Debian 10 (Buster)

Please follow the steps below to install python-twisted-web package:

2. Uninstall / Remove python-twisted-web package

Learn how to uninstall python-twisted-web package:

3. Details of python-twisted-web package

Package: python-twisted-web
Source: twisted
Version: 18.9.0-3
Installed-Size: 206
Maintainer: Debian Python Modules Team

Architecture: all
Depends: python-twisted-core (>= 18.9.0-3)
Description: twisted dummy package for HTTP protocol implementation
Description-md5: 9b210d0df1fd6c51daac7eacd8ca3bb0
Multi-Arch: foreign
Homepage: https://twistedmatrix.com/
Tag: devel::lang:python, devel::library, implemented-in::python,
role::devel-lib, role::shared-lib, web::appserver, web::server
Section: python
Priority: optional
Filename: pool/main/t/twisted/python-twisted-web_18.9.0-3_all.deb
Size: 83480
MD5sum: 7c658c48ce263044274e3c03164b146c
SHA256: 90e9e56e34205c70796717c132f8fa71ff05aa8abdd44cde634cfedd003cd235

4. References on Debian 10 (Buster)

breeze-icon-theme-rcc (4:5.54.0-1)

firefox-esr-l10n-oc (91.13.0esr-1~deb10u1)

node-babel-eslint (7.2.3-2)

xapps-common (1.2.2-1)

libghc-iwlib-dev (0.1.0-3+b2)

libxcb-screensaver0-dev (1.13.1-2)

libgsf-bin (1.14.45-1)

python3-factory-boy (2.11.1-2)

lolcat (42.0.99-1)

libwpd-tools (0.10.3-1)

aggregate (1.6-7+b1)

python-reno-doc (2.9.2-1)

isolinux (3:6.04~git20190206.bf6db5b4+dfsg1-1)

r-cran-ddalpha (1.3.8-1)

dovecot-imapd (1:2.3.4.1-5+deb10u6)

linux-libc-dev-mipsn32r6el-cross (4.19.16-1cross2)

5. The same packages on other Linux Distributions

python-twisted-web (17.9.0-2ubuntu0.3) Ubuntu 18.04 LTS (Bionic Beaver)

python-twisted-web (16.0.0-1ubuntu0.4) Ubuntu 16.04 LTS (Xenial Xerus)

Источник

Install python-twisted-web on Ubuntu: sudo apt-get install python-twisted-web

Learn how to install python-twisted-web with the command sudo apt-get install python-twisted-web on Ubuntus.

Quick installation of python-twisted-web:

Step 2: Install: python-twisted-web

Ater updaing the OS run following command to install the packae:

sudo apt-get install python-twisted-web

How to install python-twisted-web on Ubuntu 12.04 LTS?

Install python-twisted-web on Ubuntu: sudo apt-get install python-twisted-web

First of all update your system with the command:

Above command will download the package lists for Ubuntu 12.04 LTS on your system. This will update the list of newest versions of packages and its dependencies on your system.

After downloading the latest package list with the help of above you can run the installation process.

If python-twisted-web is not installed on your compter then the command ‘dpkg -L python-twisted-web’ will give followin error.

After system update use the following command to install python-twisted-web:

sudo apt-get install python-twisted-web

Above command will confirm before installing the package on your Ubuntu 12.04 LTS Operating System. If you are not already logged in as su, installer will ask you the root password. After completion of the installation you can use the package on your system.

How to uninstall/remove python-twisted-web from Ubuntu 12.04 LTS?

Now we will see the commands for uninstalling the python-twisted-web from Ubuntu 12.04 LTS. For uninstalling this package you can easily use the apt command and remove the package from Linux Operating System.

To remove the python-twisted-web following command is used:

sudo apt-get remove python-twisted-web

Following command is used to remove the python-twisted-web package along with its dependencies:

sudo apt-get remove --auto-remove python-twisted-web

This will remove python-twisted-web and all its dependent packages which is no longer needed in the system.

Completely removing python-twisted-web with all configuration files:

Following command should be used with care as it deletes all the configuration files and data:

sudo apt-get purge python-twisted-web

or you can use following command also:

sudo apt-get purge --auto-remove python-twisted-web

Above command will remove all the configuration files and data associated with python-twisted-web package. You can can’t recover the delete data, so, use this command with care.

Copyright © DevManuals.net 2016

Источник

python-twisted-web on Ubuntu 16.04 LTS (Xenial Xerus)

Learn how to install python-twisted-web package:

2. Uninstall / Remove python-twisted-web package

This guide covers the steps necessary to uninstall python-twisted-web package:

3. Details of python-twisted-web package

Package: python-twisted-web
Architecture: all
Version: 16.0.0-1ubuntu0.4
Priority: optional
Section: python
Source: twisted
Origin: Ubuntu
Maintainer: Ubuntu Developers
Original-Maintainer: Matthias Klose
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 696
Depends: python-twisted-core (>= 16.0.0-1ubuntu0.4)
Filename: pool/main/t/twisted/python-twisted-web_16.0.0-1ubuntu0.4_all.deb
Size: 75030
MD5sum: ad5f9077c26fce908226aa4d1a76b38d
SHA1: 2098df141275c0a6898a2d0a2b6950c87484c17b
SHA256: 5fb7cd46983d1cdaba9bd5ee3c5eb795649cbc75ed76615af69cd3e2f03e34e6
SHA512: 3d2374dafb561b4b833309e4c0ca878f2e5488b13842f6ac1e26565890297f296b4cdab8557c7a4ba61439b280ce05f3a682e1deca4709e63fe90373360c9d4e
Description-en: twisted dummy package for HTTP protocol implementation
All the code has been moved to python-twisted-core, this package
contains only documentation and is going to be removed.
See https://twistedmatrix.com/trac/ticket/7964.
Description-md5: 9b210d0df1fd6c51daac7eacd8ca3bb0
Task: ubuntukylin-desktop
Supported: 5y

Package: python-twisted-web
Priority: optional
Section: python
Installed-Size: 696
Maintainer: Ubuntu Developers
Original-Maintainer: Matthias Klose
Architecture: all
Source: twisted
Version: 16.0.0-1
Depends: python-twisted-core (>= 16.0.0-1)
Filename: pool/main/t/twisted/python-twisted-web_16.0.0-1_all.deb
Size: 75084
MD5sum: 119c976dddb23e281016258928258203
SHA1: 4a616242336ad60045b5bdb08c9bd0d86afea1e2
SHA256: d43ce935a3a060998b2efbd7a23a974c72900201ba2bfeb8e0046fee1443d753
Description-en: twisted dummy package for HTTP protocol implementation
All the code has been moved to python-twisted-core, this package
contains only documentation and is going to be removed.
See https://twistedmatrix.com/trac/ticket/7964.
Description-md5: 9b210d0df1fd6c51daac7eacd8ca3bb0
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Origin: Ubuntu
Supported: 5y
Task: ubuntukylin-desktop

4. References on Ubuntu 16.04 LTS (Xenial Xerus)

python-twext (0.1.b2.dev15059-1)

python-twill (0.9-3)

python-twisted-bin-dbg (16.0.0-1ubuntu0.4)

python-twisted-conch (1:16.0.0-1ubuntu0.4)

python-twisted-core (16.0.0-1ubuntu0.4)

python-twisted-mail (16.0.0-1ubuntu0.4)

python-twisted-names (16.0.0-1ubuntu0.4)

python-twisted-news (16.0.0-1ubuntu0.4)

python-twisted-runner (16.0.0-1ubuntu0.4)

python-twisted-runner-dbg (16.0.0-1ubuntu0.4)

python-twitter-doc (1.1+git20131227-2)

python-txaio-doc (1.0.0-3)

python-txlibravatar (1.1-11)

python-txlongpoll (0.3.1+bzr86-0ubuntu3)

python-txtftp (0.1~bzr42-0ubuntu2)

python-txtorcon (0.14.2-1)

5. The same packages on other Linux Distributions

python-twisted-web (17.9.0-2ubuntu0.3) Ubuntu 18.04 LTS (Bionic Beaver)

python-twisted-web (18.9.0-3) Debian 10 (Buster)

Источник

Оцените статью