lxml issue with Python 2.7 (Win7) install

269 views
Skip to first unread message

Liam OBrien

unread,
Dec 30, 2014, 1:28:11 PM12/30/14
to nikola-...@googlegroups.com
Hi,

I have installed the dependencies etc. required for the Windows install as per http://getnikola.com/handbook.html#installing-nikola.

When I try to run Nikola, I get:

C:\Users\Liam>nikola
Traceback (most recent call last):
  File "c:\Python27\Scripts\nikola-script.py", line 9, in <module>
    load_entry_point('Nikola==7.2.0', 'console_scripts', 'nikola')()
  File "C:\Python27\lib\site-packages\pkg_resources\__init__.py", line 474, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "C:\Python27\lib\site-packages\pkg_resources\__init__.py", line 2569, in load_entry_point
    return ep.load()
  File "C:\Python27\lib\site-packages\pkg_resources\__init__.py", line 2260, in load
    ['__name__'])
  File "C:\Python27\lib\site-packages\nikola\__init__.py", line 33, in <module>
    from .nikola import Nikola  # NOQA
  File "C:\Python27\lib\site-packages\nikola\nikola.py", line 61, in <module>
    import lxml.html
  File "C:\Python27\lib\site-packages\lxml\html\__init__.py", line 42, in <module>
    from lxml import etree
ImportError: DLL load failed: %1 is not a valid Win32 application.

I installed "lxml-3.4.1.win-amd64-py2.7.exe (md5)" as per https://pypi.python.org/pypi/lxml/3.4.1 as it appears the issue is with Win32 version of the lxml application.

In another post "Nikola on Win8 with Python3.4 : Yapsy error" it mentions the following:

set NIKOLA_DEBUG=1

Should the output be piped to a file? (if this is required?). I am new to Python and Nikola, so whatever help you can give is appreciated!

Thanks!
Liam.

Chris Warrick

unread,
Dec 30, 2014, 1:44:44 PM12/30/14
to Nikola—Discuss
> --
> You received this message because you are subscribed to the Google Groups
> "nikola-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to nikola-discus...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

This is not a yapsy error. This error is usually caused by a
mismatched Python version. You must use the same bit version of lxml
as your Python. Check the correct architecture for your Python
install in Programs and Features and use the appropriate .exe, first
removing the broken version.

If the .exe's provided on PyPI do not work for you, try the ones provided here:

http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml

You may also use a wheel with `pip` instaed of installing the .exe's.

--
Chris Warrick <https://chriswarrick.com/>
PGP: 5EAAEA16

Liam OBrien

unread,
Dec 30, 2014, 2:17:59 PM12/30/14
to nikola-...@googlegroups.com
Hi Chris,

Thanks for the prompt reply!
I gave the link to the Win8 post only in case a Debug output might be required. I expected that "lxml" might be the issue,which is why I included it in the Subject line.

When I run "python" at the command line, it gives a 32-bit message:

C:\Users\Liam>python
Python 2.7.9 (default, Dec 10 2014, 12:24:55) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

However, when I check in Programs and Features, it shows that Python 2.7.6 (64-bit) and Python 2.7.8 (64-bit) are installed, but there is no mention of Python 2.7.9 as given in the above output. It looks like I need to install the 32-bit version of lxml and Pillow as mentioned on the install page of the Handbook.I will remove the earlier 64-bit versions to avoid any further conflicts.

Thanks again for the help!

Regards,
Liam.

Chris Warrick

unread,
Dec 30, 2014, 2:20:27 PM12/30/14
to Nikola—Discuss
On Tue, Dec 30, 2014 at 8:17 PM, Liam OBrien <celtic...@gmail.com> wrote:
> Hi Chris,
>
> Thanks for the prompt reply!
> I gave the link to the Win8 post only in case a Debug output might be
> required. I expected that "lxml" might be the issue,which is why I included
> it in the Subject line.
>
> When I run "python" at the command line, it gives a 32-bit message:
>
> C:\Users\Liam>python
> Python 2.7.9 (default, Dec 10 2014, 12:24:55) [MSC v.1500 32 bit (Intel)] on
> win32
> Type "help", "copyright", "credits" or "license" for more information.
>>>>
>
> However, when I check in Programs and Features, it shows that Python 2.7.6
> (64-bit) and Python 2.7.8 (64-bit) are installed, but there is no mention of
> Python 2.7.9 as given in the above output. It looks like I need to install
> the 32-bit version of lxml and Pillow as mentioned on the install page of
> the Handbook.I will remove the earlier 64-bit versions to avoid any further
> conflicts.
>
> Thanks again for the help!
>
> Regards,
> Liam.

You may have some bad copies of Python in your system. If it’s
possible, get rid of both copies in Programs and Features, and make
sure the `python` command does not work — then install one copy of
Python 2.7.9 in your favorite bit flavor.

(WARNING: you most likely have other things installed, make sure to
move them over.)

Ramiro Morales

unread,
Dec 30, 2014, 3:19:17 PM12/30/14
to nikola-...@googlegroups.com

It seems you are using 32 bits Python and 64 bits (amd64) lxml.

Replace the latter with the correct one.

--

Liam OBrien

unread,
Dec 30, 2014, 7:09:53 PM12/30/14
to nikola-...@googlegroups.com
Hi Ramiro / Chris,

I uninstalled all the Python versions on my Win7 machine. One of the installs had been done with Chocolatey (https://chocolatey.org/packages/python2) and when this was clear, the updated install with Chocolatey worked fine.

I now have "Nikola" working correctly at the CMD prompt.

Thanks for the help!

Regards,
Liam.

Kay Hayen

unread,
Dec 31, 2014, 9:26:35 AM12/31/14
to nikola-...@googlegroups.com
Hello there,


I uninstalled all the Python versions on my Win7 machine. One of the installs had been done with Chocolatey (https://chocolatey.org/packages/python2) and when this was clear, the updated install with Chocolatey worked fine.

This looks pretty nice. I guess, having Nikola itself on there might be interesting. I will try and use it for myself too. If it lives up to the promise, that is. :)

Yours,
Kay

Chris Warrick

unread,
Dec 31, 2014, 10:03:15 AM12/31/14
to Nikola—Discuss
> --
> You received this message because you are subscribed to the Google Groups
> "nikola-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to nikola-discus...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Chocolatey is awesome (and I use it on my Windows machines), but IMO
Nikola should not be packaged there by itself. Chocolatey can do
`choco python Nikola`, but this seems to use easy_install and not pip.

Liam OBrien

unread,
Dec 31, 2014, 10:26:22 AM12/31/14
to nikola-...@googlegroups.com
Hi Kay,

Yes, Chocolatey is extremely useful. For some installs, it is a great time saver in working out dependencies. It is not always up-to-date with recent versions of some applications, however.

Thanks!
Liam.
Reply all
Reply to author
Forward
0 new messages