New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sigil fails to locate 'lxml module #249
Comments
Python 2.7 usage has been removed from Sigil 0.9.7. Do you by chance have more than one python 3 version installed. Please report the results of the following on the command line: invoke python 3.5 from command linepython3 at the python3 prompt type the followingimport lxml Does it succeed? KevinH Sent from my iPad
|
Also are you trying to run it from the build tree or after installing? KevinH Sent from my iPad
|
I running it after installing it. Best Regards, Ed Edward Hoffman From: Kevin Hendricks [mailto:notifications@github.com] Also are you trying to run it from the build tree or after installing? KevinH Sent from my iPad
— |
Thanks for your prompt answer! Ubuntu 16.04 lts installs both python2 and developer2@superquantan:~$ python3
Apparently, python3 cannot find lxml. But lxml is installed: developer2@superquantan:~$ cd /usr/lib/python3.5/dist-packages/lxml On Mon, Nov 7, 2016 at 5:12 PM, Kevin Hendricks notifications@github.com
|
Did you install lxml with "pip3 install lxml" or with "apt-get install python3-lxml?" With 16.04, I highly recommend using the Building_on_cutting_edge_Linux.md instructions instead of the older instructions. Everything necessary to build Sigil on 16.04 can be installed straight from the repositories with apt-get. I just did successful builds on 16.0.4 yesterday (Xenial and Kubuntu). |
both. On Mon, Nov 7, 2016 at 6:18 PM, Doug Massay notifications@github.com
|
AS I mentioned in the original email, I used the instructions. I also had On Mon, Nov 7, 2016 at 6:33 PM, Edward Hoffman ehoffman333@gmail.com
|
Installed at the same time? Or did you first try one ... uninstall and then try the other? If both the pip version and package version are installed simultaneously, that could be the problem right there. |
Actually, I'd remove the ones installed via "pip3 uninstall " and then verify they're all installed via apt-get instead. As I said, with a system as new as 16.04, you'll be better served following the newer instructions (Building_on_cutting_edge_Linux.md) instead of the other (Building_on Linux.md). Both documents are in the docs directory. |
This is not actually a Sigil bug at all but it would still help to figure out what causes it to prevent future reports. |
Kevin. I agree this is a python installation problem. I will work on it and provide a solution after which I'll provide documentation on the exact problem and the procedure to fix it. Thanks for your help! Best Regards, Sent from my iPhone
|
Kevin, This problem is a very simple problem with a simple solution. Problem: Python can't locate installed packages. The solution: The short version is the sys.path in python3 does not contain the directory to the dist-packages . Add the missing path to PYTHONPATH in .bashrc. The long version: Step 1: Locate the python3 path as follows: developer2@superquantan:~$ python3 Python 3.5.1 (default, Jun 12 2016, 20:40:17) [GCC 4.6.4] on linux Type "help", "copyright", "credits" or "license" for more information.
['', '/usr/local/lib/python35.zip', '/usr/local/lib/python3.5', '/usr/local/lib/python3.5/plat-linux', '/usr/local/lib/python3.5/lib-dynload', '/home/developer2/.local/lib/python3.5/site-packages', '/usr/local/lib/python3.5/site-packages'] Checking the paths for site-packages all the site-package folders are empty. Step 2: Locate the the installation path e.g. /usr/local/lib/python3.5/dist-packages and verify same by searching for lxml developer2@superquantan:~$ cd /usr/local/lib/python3.5/dist-packages developer2@superquantan:/usr/local/lib/python3.5/dist-packages$ ls -l|grep lxml drwxr-sr-x 7 root staff 4096 Nov 7 00:17 lxml drwxr-sr-x 2 root staff 4096 Nov 7 00:17 lxml-3.6.4.dist-info developer2@superquantan:/usr/local/lib/python3.5/dist-packages$ Step 3. Edit the .bashrc file in your home directory to add the location of the dist-packages to the PYTHONPATH as follows: export PYTHONPATH="/usr/local/lib/python3.5/dist-packages" Step 4: Verify the new path as follows: developer2@superquantan:~$ python3 Python 3.5.1 (default, Jun 12 2016, 20:40:17) [GCC 4.6.4] on linux Type "help", "copyright", "credits" or "license" for more information.
['', '/usr/local/lib/python3.5/dist-packages', '/usr/local/lib/python35.zip', '/usr/local/lib/python3.5', '/usr/local/lib/python3.5/plat-linux', '/usr/local/lib/python3.5/lib-dynload', '/home/developer2/.local/lib/python3.5/site-packages', '/usr/local/lib/python3.5/site-packages'] Step 5; Launch Sigil developer2@superquantan:~$ sigil Sigil launches without any errors. Kevin, Thanks for pointing me in the right direction. Regards, Ed From: Edward Hoffman [mailto:ehoffman333@gmail.com] Kevin. I agree this is a python installation problem. I will work on it and provide a solution after which I'll provide documentation on the exact problem and the procedure to fix it. Thanks for your help! Best Regards, Ed Sent from my iPhone On Nov 7, 2016, at 7:03 PM, Kevin Hendricks notifications@github.com wrote: This is not actually a Sigil bug at all but it would still help to figure out what causes it to prevent future reports. — |
is that a python 3.5 you compiled yourself? Why not using the one from the Ubuntu archive? (that doesn't have that "problem" >>> sys.path
['', '/usr/lib/python35.zip', '/usr/lib/python3.5', '/usr/lib/python3.5/plat-x86_64-linux-gnu', '/usr/lib/python3.5/lib-dynload', '/usr/local/lib/python3.5/dist-packages', '/usr/lib/python3/dist-packages']
>>> this is what I get from the thing in the archive. |
I missed that about building Python 3.5.4 yourself. That would explain it. Even if you got lxml properly installed in your custom Python, it's very likely that Sigil's configuration grabbed the system Python for embedding/building (or vice versa). You would have needed to add a few extra flags to the cmake command to tell it which specific python you wished to use. Those extra flags are documented in the Advanced section of the build instructions. You should definitely use the custom-built pip3 to install modules in your custom Python. Apt-get will install modules into the system Python. As mapreri said, it would have been much easier just to use the Ubuntu-supplied Python. That's what both sets of Sigil build instructions are assuming is being done. I'm going to close this issue a little later. Adding a custom-built Python to the mix is really beyond the scope of the standard build instructions for Linux. |
After installing python 3.5.4 on an updated Ubuntu 16.04 lts and installing all the addons specified in the Building_on_Linux.md and building and installing sigil from from source (git), I get the following errors. (Note: lxml is installed in both the native python 2.7.12 and python 3.5.4). I also tried building and executing in a virtual python3 environment and still get the following errors multiple times upon sigil launch:
Traceback (most recent call last):
File "C:/Program Files/Sigil/python3lib\xmlprocessor.py", line 6, in
from sigil_bs4.builder._lxml import LXMLTreeBuilderForXML
File "C:/Program Files/Sigil/plugin_launchers/python\sigil_bs4\builder_lxml.py", line 26, in
from lxml import etree
ImportError: No module named 'lxml'
Any help would be greatly appreciated.
The text was updated successfully, but these errors were encountered: