[Twisted-Python] Strange ImportError after switching from OS package to pip

On Tue, Jan 17, 2017 at 12:53 PM, Роман Мещеряков < romanmescheryakov@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):*
Seems likely related to http://twistedmatrix.com/pipermail/twisted-python/2017-January/031021.html Jean-Paul

On Jan 17, 2017, at 9:53 AM, Роман Мещеряков <romanmescheryakov@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
participants (3)
-
Glyph Lefkowitz
-
Jean-Paul Calderone
-
Роман Мещеряков