[Twisted-Python] Strange ImportError after switching from OS package to pip
Glyph Lefkowitz
glyph at twistedmatrix.com
Tue Jan 17 16:48:01 MST 2017
> On Jan 17, 2017, at 9:53 AM, Роман Мещеряков <romanmescheryakov at yandex.ru> wrote:
>
> Hi everyone! The 14.0.2 version of Twisted is latest that is available for Raspbian as a package, so until today I used it. I run my Twisted application in the following way:
> twistd -ny master_player2.tac
> There were no problems with starting my application.
> Yesterday I started facing strange problem with unjellying which looked like a bug. So I decided to remove old package version of Twisted (installed using apt-get) and install latest version using pip (which was 16.6.0). The commands I issued were (typing by memory):
>
> sudo apt-get purge python-twisted
> sudo apt-get autoremove
> sudo pip install Twisted
I should point out here that you should not modify your operating system like this. If /usr/ is managed with 'apt', then let it do that; 'pip' and 'apt' can't manage the same files without stomping on each other. Better would be to create a virtualenv for your application and 'pip install Twisted[tls,http2]' in there.
In this specific case, on a raspberry pi which is purpose-built, you'll probably be fine, but `sudo pip install` is just a bad habit to get into.
> After issuing these commands, without rebooting, I tried running my program as usual:
> ...
> exceptions.ImportError: No module named shared
> Failed to load application: No module named shared
Try `PYTHONPATH=.` on the command line before `twistd`.
(Also, you might want to try `twist` instead, then you don't need the `-n` option...)
-glyph
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20170117/1d11dce0/attachment-0002.html>
More information about the Twisted-Python
mailing list