plone / sphinxtheme.plone

Sphinx Themes for Plone Documentation Project
GNU General Public License v2.0
2 stars 1 forks source link

Pip install is not working #53

Closed svx closed 7 years ago

svx commented 7 years ago

Install from GitHub via pip is not working

I try to install a certain branch from GitHub:

pip install git+https://github.com/plone/sphinx.themes.plone.git@ploneorg5_adjustmens

And I get:

Error processing line 3 of /usr/lib/python2.7/site-packages/sphinx.themes.plone-0.2.0.dev1-py2.7-nspkg.pth:

  Traceback (most recent call last):
    File "/usr/lib/python2.7/site.py", line 152, in addpackage
      exec line
    File "<string>", line 1, in <module>
  KeyError: 'sphinx'

If I try now make html I get:

AttributeError: 'module' object has no attribute 'themes'

This is somehow not ideal :)

svx commented 7 years ago

Digging deeper

make html

Traceback (most recent call last):
  File "/srv/Projects/test/sphinx/foo/bin/sphinx-build", line 7, in <module>
    from sphinx import main

Steps to reproduce (Ubuntu 16.10):

virtualenv -p python2.7 foo
cd foo/
source bin/activate
pip install sphinx
bin/sphinx-quickstart 
pip install git+https://github.com/plone/sphinx.themes.plone.git@ploneorg5_adjustmens#egg=sphinx.themes.plone
vim docs/conf.py 
make html

If I 'just' do:

virtualenv -p python2.7 foo
cd foo/
source bin/activate
pip install sphinx
bin/sphinx-quickstart
make html

It works with the default alabaster theme, as soon as I install our theme via pip and adjust the conf.py, I get the error.

stevepiercy commented 7 years ago

What's in your conf.py?

svx commented 7 years ago

I use the same conf.py as we use on docs.plone.org and also the same sphinx version.

The only difference to docs.plone.org is that I do not use buildout, but pip instead. Since I really only need the theme and one other sphinx extension I do not see the point of running buildout.

IMHO this should be possible with pip. :)

svx commented 7 years ago

Same if I use buildout:

[buildout]

extensions =
    mr.developer

allow-picked-versions = true
auto-checkout +=
    sphinx.themes.plone

parts +=
    sphinx-build

[sources]
sphinx.themes.plone = git https://github.com/plone/sphinx.themes.plone.git branch=ploneorg5_adjustmens

[sphinx-build]
recipe = zc.recipe.egg
eggs =
    Sphinx
    sphinx.themes.plone

[versions]
# use the same as the Plone release
zc.buildout = 2.4.3
setuptools = 18.3.1

Sphinx = 1.3.6
six = 1.10.0
Pygments = 2.1.3
svx commented 7 years ago

Okay, if I pin all versions also for zc.buildout and setuptools, before I run buildout, I am getting somewhere with buildout.

Things to figure out:

svx commented 7 years ago

This is working:

$ cat requirements.txt 
zc.buildout == 2.4.3
setuptools == 18.3.1
Sphinx == 1.3.6
-e git+https://github.com/plone/sphinx.themes.plone@ploneorg5_adjustmens#egg=sphinx.themes.plone

Next step newer versions of:

svx commented 7 years ago

Upgrading Sphinx to latest version works.

IMHO it is a problem with setuptools and zc.buildout

If I upgrade one of them, I get

$ make html
sphinx-build -b html -d _build/doctrees   . _build/html
Traceback (most recent call last):
  File "/srv/Projects/test/sphinx/pip-install/bin/sphinx-build", line 7, in <module>
    from sphinx import main
ImportError: cannot import name main
Makefile:56: recipe for target 'html' failed
make: *** [html] Error 1
loechel commented 7 years ago

@svx it might is also a problem of order. As sphinx.theme.plone itself requires Sphinx to be installed before, a namespace clash occure after installation. A manual update or reinstall of Sphinx itself fixes the problem for the moment.

So there must be some problem with the namespace and package layout. But there we might need help from someone who has more insights into package and namespace layout.

loechel commented 7 years ago

@svx I think we do have a namespace clash, that make some problem, we do use sphinx as primary namespace, and Sphinx itself has the same but with upper case, which is in Python context ignored and threaten as lower case. We might could easyly fix that by renaming the package to sphinxtheme.plone, which will remove one dot, but also replace two whole namespaces with just one.

svx commented 7 years ago

@loechel I am fine with everything :)

I say choose that one which is less work ? :)

loechel commented 7 years ago

@svx could we close this issue now?

I think it is fixed.