Error using pelican-quickstart "No module named html_parser"
Asked Answered
B

5

15

I decided to give pelican a try, but when I run pelican-quickstart, I get the following dialog:

$ pelican-quickstart
Traceback (most recent call last):
  File "/usr/local/bin/pelican-quickstart", line 9, in <module>
    load_entry_point('pelican==3.4.0', 'console_scripts', 'pelican-quickstart')()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 357, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2394, in load_entry_point
return ep.load()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2108, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  File "/Library/Python/2.7/site-packages/pelican-3.4.0-py2.7.egg/pelican/__init__.py", line 20, in <module>
from pelican.generators import (ArticlesGenerator, PagesGenerator,
  File "/Library/Python/2.7/site-packages/pelican-3.4.0-py2.7.egg/pelican/generators.py", line 23, in <module>
from pelican.readers import Readers
  File "/Library/Python/2.7/site-packages/pelican-3.4.0-py2.7.egg/pelican/readers.py", line 24, in <module>
from six.moves.html_parser import HTMLParser
ImportError: No module named html_parser `

There was a similar error message in this post, and since I'm running Python 2.7.6 on OS X 10.10 (Yosemite), there may be a similar issue.

What's the best way to address this?

Beyer answered 22/10, 2014 at 13:29 Comment(1)
The answer in the post you linked says that the error occurs when you "[run] the Python 3 version of the code under Python 2."Actual
G
-3

You may need to install six.

if you're using pip, try

pip install six

and then restart pelican-quickstart

Gotten answered 22/10, 2014 at 13:42 Comment(10)
what is your pip freeze output ? You can try to run a python console and then type import sixGotten
$ pip freeze Jinja2==2.7.3 Markdown==2.5.1 MarkupSafe==0.23 Pygments==2.0rc1 Twisted==13.2.0 Unidecode==0.04.16 altgraph==0.10.2 argparse==1.2.1 bdist-mpkg==0.5.0 blinker==1.3 bonjour-py==0.3 docutils==0.12 feedgenerator==1.7 macholib==1.5.1 matplotlib==1.3.1 modulegraph==0.10.4 numpy==1.8.0rc1 pelican==3.4.0 py2app==0.7.3Beyer
pyOpenSSL==0.13.1 pyobjc-core==2.5.1 pyobjc-framework-Accounts==2.5.1 pyobjc-framework-AddressBook==2.5.1 pyobjc-framework-AppleScriptKit==2.5.1 pyobjc-framework-AppleScriptObjC==2.5.1 pyobjc-framework-Automator==2.5.1 pyobjc-framework-CFNetwork==2.5.1 pyobjc-framework-Cocoa==2.5.1 pyobjc-framework-Collaboration==2.5.1 pyobjc-framework-CoreData==2.5.1 pyobjc-framework-CoreLocation==2.5.1 pyobjc-framework-CoreText==2.5.1 pyobjc-framework-DictionaryServices==2.5.1 pyobjc-framework-EventKit==2.5.1 pyobjc-framework-ExceptionHandling==2.5.1 pyobjc-framework-FSEvents==2.5.1Beyer
pyobjc-framework-InputMethodKit==2.5.1 pyobjc-framework-InstallerPlugins==2.5.1 pyobjc-framework-InstantMessage==2.5.1 pyobjc-framework-LatentSemanticMapping==2.5.1 pyobjc-framework-LaunchServices==2.5.1 pyobjc-framework-Message==2.5.1 pyobjc-framework-OpenDirectory==2.5.1 pyobjc-framework-PreferencePanes==2.5.1 pyobjc-framework-PubSub==2.5.1 pyobjc-framework-QTKit==2.5.1 pyobjc-framework-Quartz==2.5.1 pyobjc-framework-ScreenSaver==2.5.1 pyobjc-framework-ScriptingBridge==2.5.1 pyobjc-framework-SearchKit==2.5.1 pyobjc-framework-ServiceManagement==2.5.1 pyobjc-framework-Social==2.5.1Beyer
pyobjc-framework-SyncServices==2.5.1 pyobjc-framework-SystemConfiguration==2.5.1 pyobjc-framework-WebKit==2.5.1 pyparsing==2.0.1 python-dateutil==1.5 pytz==2013.7 scipy==0.13.0b1 six==1.8.0 stevedore==1.0.0 virtualenv==1.11.6 virtualenv-clone==0.2.5 virtualenvwrapper==4.3.1 wsgiref==0.1.2 xattr==0.6.4 zope.interface==4.1.1Beyer
So six is installed. Are you in a virtual env ? If not, you should try to work in a virtual env. It is strange you have so much libraries installed.Gotten
Have you try to run a python console and then type import six?Gotten
I am not in an virtual env - still a Python novice. Running import six in the Python console seems to work, but still can't figure out how to resolve my original issue. Thanks for your help (and patience) with this!Beyer
Using virtualenv is pretty simple. blog.dbrgn.ch/2012/9/18/virtualenv-quickstartGotten
this is not six-related problemMcphail
M
10

Reinstall Pelican doesn't help me, so I made a little fix in pelican

Modifications were made in following file

/Library/Python/2.7/site-packages/pelican/readers.py

at line 24 place

from six.moves import html_parser

instead of

from six.moves.html_parser import HTMLParser

and at line 299

    class _HTMLParser(html_parser.HTMLParser):

instead of

    class _HTMLParser(HTMLParser):

Modification actual for pelican 3.6.0, but seems to applicable for other version if search for this lines in readers.py file. This is just quick workaround, hope this problem will be solved at pelican's side.

Mcphail answered 28/7, 2015 at 8:38 Comment(0)
R
5

This error seems to come from Python 2.7.6 on OSX. When I install python via Homebrew and reinstall this module I got rid of this error.

$ pip uninstall pelican
$ brew install python
$ which python # should show /usr/local/bin/python
$ python -V # should show Python 2.7.8
$ pip install pelican
Roo answered 4/11, 2014 at 14:34 Comment(1)
I have a repro with 2.7.10.Instil
E
4

I think that you've probably encountered with version conflict problem in module six.

Try sudo pip install virtualenv to create an isolate python environment.

start

  1. create your pelican path mkdir /path/to/pelican
  2. go to /path/to/pelican and create an isolate python environment with virtualenv venv
  3. activate virtualenv source venv/bin/activate
  4. install pelican under the venv(without sudo!) pip install pelican markdown

done

and now you are free to any problem mentioned above. all the dependencies in the venv are isolated from the global environment.

To quit the venv, type deactivate

Ellen answered 18/2, 2016 at 4:13 Comment(0)
A
0

I was running into the same error message.

six was also already installed, but an old version (1.4.1)

pip install six --upgrade

Installed six 1.10.0, which made pelican-quickstart finally work :)

Ahmedahmedabad answered 11/2, 2017 at 22:6 Comment(0)
G
-3

You may need to install six.

if you're using pip, try

pip install six

and then restart pelican-quickstart

Gotten answered 22/10, 2014 at 13:42 Comment(10)
what is your pip freeze output ? You can try to run a python console and then type import sixGotten
$ pip freeze Jinja2==2.7.3 Markdown==2.5.1 MarkupSafe==0.23 Pygments==2.0rc1 Twisted==13.2.0 Unidecode==0.04.16 altgraph==0.10.2 argparse==1.2.1 bdist-mpkg==0.5.0 blinker==1.3 bonjour-py==0.3 docutils==0.12 feedgenerator==1.7 macholib==1.5.1 matplotlib==1.3.1 modulegraph==0.10.4 numpy==1.8.0rc1 pelican==3.4.0 py2app==0.7.3Beyer
pyOpenSSL==0.13.1 pyobjc-core==2.5.1 pyobjc-framework-Accounts==2.5.1 pyobjc-framework-AddressBook==2.5.1 pyobjc-framework-AppleScriptKit==2.5.1 pyobjc-framework-AppleScriptObjC==2.5.1 pyobjc-framework-Automator==2.5.1 pyobjc-framework-CFNetwork==2.5.1 pyobjc-framework-Cocoa==2.5.1 pyobjc-framework-Collaboration==2.5.1 pyobjc-framework-CoreData==2.5.1 pyobjc-framework-CoreLocation==2.5.1 pyobjc-framework-CoreText==2.5.1 pyobjc-framework-DictionaryServices==2.5.1 pyobjc-framework-EventKit==2.5.1 pyobjc-framework-ExceptionHandling==2.5.1 pyobjc-framework-FSEvents==2.5.1Beyer
pyobjc-framework-InputMethodKit==2.5.1 pyobjc-framework-InstallerPlugins==2.5.1 pyobjc-framework-InstantMessage==2.5.1 pyobjc-framework-LatentSemanticMapping==2.5.1 pyobjc-framework-LaunchServices==2.5.1 pyobjc-framework-Message==2.5.1 pyobjc-framework-OpenDirectory==2.5.1 pyobjc-framework-PreferencePanes==2.5.1 pyobjc-framework-PubSub==2.5.1 pyobjc-framework-QTKit==2.5.1 pyobjc-framework-Quartz==2.5.1 pyobjc-framework-ScreenSaver==2.5.1 pyobjc-framework-ScriptingBridge==2.5.1 pyobjc-framework-SearchKit==2.5.1 pyobjc-framework-ServiceManagement==2.5.1 pyobjc-framework-Social==2.5.1Beyer
pyobjc-framework-SyncServices==2.5.1 pyobjc-framework-SystemConfiguration==2.5.1 pyobjc-framework-WebKit==2.5.1 pyparsing==2.0.1 python-dateutil==1.5 pytz==2013.7 scipy==0.13.0b1 six==1.8.0 stevedore==1.0.0 virtualenv==1.11.6 virtualenv-clone==0.2.5 virtualenvwrapper==4.3.1 wsgiref==0.1.2 xattr==0.6.4 zope.interface==4.1.1Beyer
So six is installed. Are you in a virtual env ? If not, you should try to work in a virtual env. It is strange you have so much libraries installed.Gotten
Have you try to run a python console and then type import six?Gotten
I am not in an virtual env - still a Python novice. Running import six in the Python console seems to work, but still can't figure out how to resolve my original issue. Thanks for your help (and patience) with this!Beyer
Using virtualenv is pretty simple. blog.dbrgn.ch/2012/9/18/virtualenv-quickstartGotten
this is not six-related problemMcphail

© 2022 - 2024 — McMap. All rights reserved.