plone / training

Plone Trainings
https://training.plone.org
Creative Commons Attribution 4.0 International
58 stars 89 forks source link

Installation of Plone 5.1rc1 for PloneConf Training #298

Closed stevepiercy closed 7 years ago

stevepiercy commented 7 years ago

From an email for the Mastering Plone 5 training:

You can find instructions to prepare a development environment here: https://training.plone.org/5/plone_training_config/instructions.html

That's not entirely correct. One should first review the requirements, then jump into installation. Also these instructions do not adequately cover installation via buildout, which @pbauer suggested.

Here's a quick cheat sheet to get started.

  1. Create a directory to hold your Plone training project, e.g., mkdir ~/projects/ploneconf/; cd ~/projects/ploneconf/.
  2. Clone https://github.com/collective/training_buildout and cd into it.
  3. Create a Python 2.7 virtual environment in the cloned repo (or wherever your prefer).
  4. Install setuptools==33.1.1 and zc.buildout==2.9.4, not the latest, into the virtual environment.
  5. env/bin/python bootstrap.py
  6. env/bin/buildout
  7. bin/instance fg
fulv commented 7 years ago

I would add to step 3 that Plone 5.1xx requires Python 2.7.9 or higher. It would be good to point to instructions for how to update Python because I pretty much hosed an entire Ubuntu 14.04 machine, which comes with 2.7.6.

On Wed, Oct 11, 2017 at 3:50 PM Steve Piercy notifications@github.com wrote:

From an email for the Mastering Plone 5 training:

You can find instructions to prepare a development environment here: https://training.plone.org/5/plone_training_config/instructions.html

That's not entirely correct. One should first review the requirements https://docs.plone.org/manage/installing/requirements.html, then jump into installation. Also these instructions do not adequately cover installation via buildout, which @pbauer https://github.com/pbauer suggested.

Here's a quick cheat sheet to get started.

  1. Create a directory to hold your Plone training project, e.g., mkdir ~/projects/ploneconf/; cd ~/projects/ploneconf/.
  2. Clone https://github.com/collective/training_buildout and cd into it.
  3. Create a Python 2.7 virtual environment in the cloned repo (or wherever your prefer).
  4. Install setuptools==33.1.1 and zc.buildout==2.9.4, not the latest, into the virtual environment.
  5. env/bin/python bootstrap.py
  6. env/bin/buildout
  7. bin/instance fg

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/plone/training/issues/298, or mute the thread https://github.com/notifications/unsubscribe-auth/AAcHxhQh0y3Dd5qcHcDf4hF3suAequp1ks5srMd5gaJpZM4P1ges .

stevepiercy commented 7 years ago

Meh, I goofed. There was a link on the instructions to official installation instructions, which I then followed. I got sidetracked there.

Second time, I followed the correct procedure. This time I still need to downgrade zc.buildout to 2.9.4. I'm not sure how to do that.

$ ./py27/bin/python bootstrap.py
ez_setup.py is deprecated and when using it setuptools will be pinned to 33.1.1 since it's the last version that supports setuptools self upgrade/installation, check https://github.com/pypa/setuptools/issues/581 for more info; use pip to install setuptools
no previously-included directories found matching 'doc'
no previously-included directories found matching 'old-tutorial'
Creating directory '/Users/stevepiercy/projects/Plone/training/buildout/eggs'.
Creating directory '/Users/stevepiercy/projects/Plone/training/buildout/bin'.
Creating directory '/Users/stevepiercy/projects/Plone/training/buildout/parts'.
Creating directory '/Users/stevepiercy/projects/Plone/training/buildout/develop-eggs'.
Generated script '/Users/stevepiercy/projects/Plone/training/buildout/bin/buildout'.
Steves-iMac:buildout stevepiercy$ ./bin/buildout
Getting distribution for 'mr.developer==1.38'.
no previously-included directories found matching 'mr.developer.addon'
Got mr.developer 1.38.
Getting distribution for 'zc.buildout==2.9.4'.
no previously-included directories found matching 'doc'
no previously-included directories found matching 'old-tutorial'
While:
  Installing.
  Loading extensions.
  Getting distribution for 'zc.buildout==2.9.4'.

An internal error occurred due to a bug in either zc.buildout or in a
recipe being used:
Traceback (most recent call last):
  File "/Users/stevepiercy/projects/Plone/training/buildout/eggs/zc.buildout-2.9.5-py2.7.egg/zc/buildout/buildout.py", line 2123, in main
    getattr(buildout, command)(args)
  File "/Users/stevepiercy/projects/Plone/training/buildout/eggs/zc.buildout-2.9.5-py2.7.egg/zc/buildout/buildout.py", line 637, in install
    self._load_extensions()
  File "/Users/stevepiercy/projects/Plone/training/buildout/eggs/zc.buildout-2.9.5-py2.7.egg/zc/buildout/buildout.py", line 1163, in _load_extensions
    newest=self.newest, allow_hosts=self._allow_hosts)
  File "/Users/stevepiercy/projects/Plone/training/buildout/eggs/zc.buildout-2.9.5-py2.7.egg/zc/buildout/easy_install.py", line 913, in install
    return installer.install(specs, working_set)
  File "/Users/stevepiercy/projects/Plone/training/buildout/eggs/zc.buildout-2.9.5-py2.7.egg/zc/buildout/easy_install.py", line 714, in install
    for dist in self._get_dist(req, ws):
  File "/Users/stevepiercy/projects/Plone/training/buildout/eggs/zc.buildout-2.9.5-py2.7.egg/zc/buildout/easy_install.py", line 570, in _get_dist
    dist = self._env.best_match(requirement, ws)
  File "/Users/stevepiercy/projects/Plone/training/buildout/py27/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1130, in best_match
    dist = working_set.find(req)
  File "/Users/stevepiercy/projects/Plone/training/buildout/py27/lib/python2.7/site-packages/pkg_resources/__init__.py", line 724, in find
    raise VersionConflict(dist, req)
VersionConflict: (zc.buildout 2.9.5 (/Users/stevepiercy/projects/Plone/training/buildout/eggs/zc.buildout-2.9.5-py2.7.egg), Requirement.parse('zc.buildout==2.9.4'))

I edited buildout/bin/buildout:

  '/Users/stevepiercy/projects/Plone/training/buildout/eggs/zc.buildout-2.9.5-py2.7.egg',

to

  '/Users/stevepiercy/projects/Plone/training/buildout/eggs/zc.buildout-2.9.4-py2.7.egg',

Which got me past the first hurdle, but I ran into the same setuptools issue.

stevepiercy commented 7 years ago

I used PyCharm's tools to downgrade setuptools to 33.1.1, and started installing with ./bin/buildout. I'll check in when it's done, but I think this could affect other users, and I've completely spaced on how to manage packages outside of PyCharm and pip.

pbauer commented 7 years ago

python bootstrap.py is indeed deprecated. I updated the instruction to use pip install -r requirements.txt. Can you try again with a fresh virtualenv and this and tell me if it worked for you?

pbauer commented 7 years ago

Since installation can be tricky because of dependencies, python-installations and such it says at the beginning of the instruction "If you are not used to running Plone on your laptop skip this part and continue with Install VirtualBox." I still recommend trying to get it to run locally since switching between vagrant foir debugging and running and the host system for editing can be pretty confusing.

stevepiercy commented 7 years ago

One more fatal error:

Getting distribution for 'PyYAML==3.12'.
build/temp.macosx-10.12-x86_64-2.7/check_libyaml.c:2:10: fatal error: 'yaml.h' file not found
#include <yaml.h>
         ^
1 error generated.

libyaml is not found or a compiler error: forcing --without-libyaml
(if libyaml is installed correctly, you may need to
 specify the option --include-dirs or uncomment and
 modify the parameter include_dirs in setup.cfg)
zip_safe flag not set; analyzing archive contents...
Got PyYAML 3.12.

I then installed libyaml via brew install libyaml for macOS 10.12.6, and ran again ./bin/buildout, and there were no errors this time, but I don't know if that actually fixed it.

stevepiercy commented 7 years ago

And one more issue, the docs say to run the following command, but...

$ ./py27/bin/pip install -r requirements.txt
Could not open requirements file: [Errno 2] No such file or directory: 'requirements.txt'

Other than that, I was able to get Plone to run with ./bin/instance fg, although there were several deprecation warnings mixed in with the INFO Zope Ready to handle requests message.

/Users/stevepiercy/projects/Plone/training/buildout/eggs/plone.formwidget.namedfile-2.0.4-py2.7.egg/plone/formwidget/namedfile/widget.py:18: DeprecationWarning: MimeTypeException is deprecated. Import from Products.MimetypesRegistry.interfaces instead
  from Products.MimetypesRegistry.common import MimeTypeException
/Users/stevepiercy/projects/Plone/training/buildout/eggs/plone.app.dexterity-2.4.6-py2.7.egg/plone/app/dexterity/__init__.py:14: DeprecationWarning: Name clash, now use '_' as usual. Will be removed in Plone 5.2
  DeprecationWarning)
/Users/stevepiercy/projects/Plone/training/buildout/eggs/plone.app.multilingual-5.1.2-py2.7.egg/plone/app/multilingual/browser/migrator.py:11: DeprecationWarning: LanguageRootFolder: LanguageRootFolders should be migrate to DexterityContainers
  from plone.app.multilingual.content.lrf import LanguageRootFolder
/Users/stevepiercy/projects/Plone/training/buildout/eggs/plone.portlet.collection-3.2-py2.7.egg/plone/portlet/collection/collection.py:2: DeprecationWarning: isDefaultPage is deprecated. Import from Products.CMFPlone instead
  from plone.app.layout.navigation.defaultpage import isDefaultPage
/Users/stevepiercy/projects/Plone/training/buildout/eggs/Products.CMFPlone-5.1rc1-py2.7.egg/Products/CMFPlone/browser/syndication/views.py:17: DeprecationWarning: wrap_form is deprecated. Import from plone.z3cform.layout instead.
  from plone.app.z3cform.layout import wrap_form
/Users/stevepiercy/projects/Plone/training/buildout/eggs/Zope2-2.13.26-py2.7.egg/OFS/Application.py:102: DeprecationWarning: Expected text
  transaction.get().note("Created Zope Application")
/Users/stevepiercy/projects/Plone/training/buildout/eggs/Zope2-2.13.26-py2.7.egg/OFS/Application.py:265: DeprecationWarning: Expected text
  transaction.get().note(note)
/Users/stevepiercy/projects/Plone/training/buildout/eggs/Zope2-2.13.26-py2.7.egg/OFS/Application.py:521: DeprecationWarning: Expected text
  transaction.get().note('Prior to product installs')
/Users/stevepiercy/projects/Plone/training/buildout/eggs/Zope2-2.13.26-py2.7.egg/OFS/Application.py:775: DeprecationWarning: Expected text
  transaction.get().note('Installed standard objects')
2017-10-11 12:05:42 INFO Zope Ready to handle requests
/Users/stevepiercy/projects/Plone/training/buildout/eggs/Zope2-2.13.26-py2.7.egg/Zope2/App/startup.py:344: DeprecationWarning: Expected text
  T.note(path)
/Users/stevepiercy/projects/Plone/training/buildout/eggs/Zope2-2.13.26-py2.7.egg/Zope2/App/startup.py:357: DeprecationWarning: Expected text
  T.setUser(auth_user.getId(), auth_path)
stevepiercy commented 7 years ago

@pbauer I prefer not using Vagrant, too. But it looks like the requirements.txt file is not pushed to the repo, at least on the master branch.

If you like, I can run through again with a clean install to make sure all the changes and installation of PyYAML works correctly.

pbauer commented 7 years ago

You are right, I commited but somehow forgot to push. I did it now.

stevepiercy commented 7 years ago

Got it.

I wiped it clean, and started from scratch, this time with libyaml installed. However, I had to adjust the path:

Now you can run the buildout for the first time:

$ ./py27/bin/pip install -r requirements.txt
$ ./bin/buildout

The last line should be:

$ ./py27/bin/buildout

It should be done in another half hour or so. I'll check for a fatal pyyaml message, too.

stevepiercy commented 7 years ago

The fatal pyyaml message is now gone, and replaced with a buttload of warnings. Here's just the first:

Getting distribution for 'PyYAML==3.12'.
In file included from ext/_yaml.c:271:
ext/_yaml.h:6:9: warning: 'PyUnicode_FromString' macro redefined [-Wmacro-redefined]
#define PyUnicode_FromString(s) PyUnicode_DecodeUTF8((s), strlen(s), "strict")
...

And the deprecation warnings are fewer upon startup of ./bin/instance fg.

So the remaining items here are to update the docs to:

  1. use the correct path to buildout
  2. mention an optional installation of libyaml
pbauer commented 7 years ago

I changed the parts you mentioned. I also changed it to crate the virtualenv in . which is what we usually do anyway. I also use macOS 10.12 and do not have the problem you describe with yaml. But I added a short section about dependencies you need to install with homebrew.

stevepiercy commented 7 years ago

Confirmed, and thank you! All is well. Closing issue.