Install error: ImportError: No module named ldtp
richelbilderbeek opened this issue ยท 12 comments
As can be seen from a Travis CI build log, importing ldtp
fails:
python minimal.py
gives:
Traceback (most recent call last):
File "minimal.py", line 3, in <module>
from ldtp import *
ImportError: No module named ldtp
First line in minimal.py
is from ldtp import *
(it is a script suggested by @nagappan at #35).
This is the compete reproduction of it (from the .travis.yml script):
# Install prerequisites
sudo apt-get install python-twisted-web
sudo apt-get install python-wnck
# Build LDTP
python setup.py build
sudo python setup.py install
# Build and run examples
cd examples
python minimal.py
It guess someone with some Python knowledge can easily see what went wrong.
This means ldtp is not installed in path, check /usr/local/lib/python folder (I think)
Does this mean that setup.py does not install LDTP correctly? As these are the lines that should install LDTP:
# Build LDTP
python setup.py build
sudo python setup.py install
Are you sure that when it runs "python", are you sure it is the same instance of python that ldtp is installed to ?
Try using the full path to the python interpreter, since the first one in the path may not be the same one.
You can output see python is being called by adding this somewhere in your travis script
echo `which python`
You could also try adding this to minimal.py:
import sys
print(sys.executable)
Thanks for your help!
I've added your suggestions and obtained a new build log.
Note that the two different ways to find out which is the Python executable give different results:
Way | Result |
---|---|
which python |
/opt/pyenv/shims/python |
print(sys.executable) |
/usr/bin/python |
Still, the error is now:
$ python minimal.py
/usr/bin/python
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/ldtpd/__init__.py", line 38, in <module>
from xmlrpc_daemon import XMLRPCLdtpd
File "/usr/local/lib/python2.7/dist-packages/ldtpd/xmlrpc_daemon.py", line 25, in <module>
import core
File "/usr/local/lib/python2.7/dist-packages/ldtpd/core.py", line 24, in <module>
from pyatspi import findDescendant, Registry
ImportError: No module named pyatspi
I hope one day your team will get the minimal example working on Travis, as it would be helpful to users (like me) trying out a package ๐
If you have more suggestions, I'll be happy to help!
It looks like you may have yet another python installed in /usr/local.
I would specify the full path to python and pip when you use them to avoid ambiguity.
Without doing this you might get different copies especially when using sudo.
I've used usr/local/python
instead of just python
. From the build log, I now get:
/usr/bin/python
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/ldtpd/__init__.py", line 38, in <module>
from xmlrpc_daemon import XMLRPCLdtpd
File "/usr/local/lib/python2.7/dist-packages/ldtpd/xmlrpc_daemon.py", line 25, in <module>
import core
File "/usr/local/lib/python2.7/dist-packages/ldtpd/core.py", line 24, in <module>
from pyatspi import findDescendant, Registry
ImportError: No module named pyatspi
I assume that stops even getting to importing ldtp...
OK, so you're going to need to make pyatspi is installed and accessible from the python in /usr/local
Yes, I understand.
I give up. If I cannot get such a simple example running working on Travis, I will abandon ldtp until someone does succeed. I hope this Issue log helps him/her to do so.
Closing the Issue...
Yeah - I found it very hard to get it working, it seems like the it's a very old library and built as such.
I also gave up as I was only playing with it on a whim.
Like other libraries that came out before virtualenv existed it doesn't work well with it (or at all without a lot of effort), the code style looks very like C translated into python.
The best thing that could happen is to make a new library with the same license, and pythonic code style, using ldtp for reference to build it.
Well, I found it easy to get ldtp to work locally (kudos to the ldtp maintainers). I just fail to get it to run on Travis. Due to that, I cannot use it in my continuous integration test suites.
@stuaxo: thanks for the help ๐
The things I mentioned are mostly down do the age of the package, its good it's still available and there aren't many things that can do a similar job.