plone Assertion error in themes - plone

Iam new to Plone. I installed Plone 4 and i have gone through http://noenieto.com/blog/theming-plone-4 and created theme product.
When i run ./bin/buildout,
iam getting the error as
Develop: '/usr/local/Plone/zinstance/src/plonetheme.hanging'
error in plonetheme.hanging setup command: Distribution contains no modules or packages for namespace package 'plonetheme'
While:
Installing.
Processing develop directory '/usr/local/Plone/zinstance/src/plonetheme.hanging'.
An internal error occured due to a bug in either zc.buildout or in a
recipe being used:
Traceback (most recent call last):
File "/usr/local/Plone/buildout-cache/eggs/zc.buildout-1.4.4-py2.7.egg/zc/buildout/buildout.py", line 1683, in main
getattr(buildout, command)(args)
File "/usr/local/Plone/buildout-cache/eggs/zc.buildout-1.4.4-py2.7.egg/zc/buildout/buildout.py", line 417, in install
installed_develop_eggs = self._develop()
File "/usr/local/Plone/buildout-cache/eggs/zc.buildout-1.4.4-py2.7.egg/zc/buildout/buildout.py", line 657, in _develop
zc.buildout.easy_install.develop(setup, dest)
File "/usr/local/Plone/buildout-cache/eggs/zc.buildout-1.4.4-py2.7.egg/zc/buildout/easy_install.py", line 895, in develop
*args) == 0
AssertionError
Can anyone help me to rectify this error?

Create a module or package for namespace package 'plonetheme', e.g.:
mkdir -p src/plonetheme.hanging/plonetheme/hanging
touch src/plonetheme.hanging/plonetheme/__init__.py
touch src/plonetheme.hanging/plonetheme/hanging/__init__.py
src/plonetheme.hanging/plonetheme/__init__.py should contain something like:
from pkg_resources import declare_namespace
declare_namespace(__name__)

Related

Read the Docs with nbsphinx

I created my own docs for Read the Docs. See my repository
Some of my docs files are jupyter notebook so I used nbshpinx for it.
In my computer I installed all the dependencies and it works great when I use make html.
However, Read the docs throws the error:
Running Sphinx v1.8.5
loading translations [en]... done
Traceback (most recent call last):
File "/home/docs/checkouts/readthedocs.org/user_builds/complex-valued-neural-networks/envs/latest/lib/python3.7/site-packages/sphinx/registry.py", line 472, in load_extension
mod = __import__(extname, None, None, ['setup'])
ModuleNotFoundError: No module named 'nbsphinx'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/docs/checkouts/readthedocs.org/user_builds/complex-valued-neural-networks/envs/latest/lib/python3.7/site-packages/sphinx/cmd/build.py", line 303, in build_main
args.tags, args.verbosity, args.jobs, args.keep_going)
File "/home/docs/checkouts/readthedocs.org/user_builds/complex-valued-neural-networks/envs/latest/lib/python3.7/site-packages/sphinx/application.py", line 228, in __init__
self.setup_extension(extension)
File "/home/docs/checkouts/readthedocs.org/user_builds/complex-valued-neural-networks/envs/latest/lib/python3.7/site-packages/sphinx/application.py", line 449, in setup_extension
self.registry.load_extension(self, extname)
File "/home/docs/checkouts/readthedocs.org/user_builds/complex-valued-neural-networks/envs/latest/lib/python3.7/site-packages/sphinx/registry.py", line 475, in load_extension
raise ExtensionError(__('Could not import extension %s') % extname, err)
sphinx.errors.ExtensionError: Could not import extension nbsphinx (exception: No module named 'nbsphinx')
Extension error:
Could not import extension nbsphinx (exception: No module named 'nbsphinx')
Following this tutorial I created two yml files and the error changed to:
Error
Problem in your project's configuration. Invalid "conda.environment": environment not found
Solved it!
I followed this tutorial
I added in readthedocs.yml:
python:
version: 3
install:
- requirements: docs/requirements.txt
system_packages: true
And then in docs/requirements.txt:
ipykernel
nbsphinx
If questions you can always check the repository where I do it.

Module Import Error with Nosetests and Tox

In my project, I am using tox with nosetests. Using PyCharm, my tox pipeline was passing completely including all the tests. When I execute tox on a Ubuntu18.04 container with python3, it gives me the following error:
ImportError: No module named 'my_project'
leading to the following error at the end:
ERROR: InvocationError for command /.tox/py36/bin/nosetests (exited with code 1)
my_project is the name of the module I am testing and the directory structure looks like this under /, the root dir from which I am executing tox:
my_project/
tests/
tox.ini
setup.cfg
other files
My tox.ini looks as follows:
[tox]
envlist = py36
[testenv]
commands = python3 setup.py build
nosetests
deps = -r{toxinidir}/test-requirements.txt
I have tried to provide the path to project in different ways to nosetests command but none of that works. One line that interests me is in the initial output of tox:
py36 installed: my_project # file:///.tox/.tmp/package/1/my_project-0.4.post52.dev256143400.zip,
which leads me to think if this is the reason that nosetests does not find my_project.
For details, the stack trace for the error is as follows:
ERROR: Failure: ImportError (No module named 'my_project')
Traceback (most recent call last):
File "/.tox/py36/lib/python3.6/site-packages/nose/failure.py", line 39, in runTest
raise self.exc_val.with_traceback(self.tb)
File "/.tox/py36/lib/python3.6/site-packages/nose/loader.py", line 418, in loadTestsFromName
addr.filename, addr.module)
File "/.tox/py36/lib/python3.6/site-packages/nose/importer.py", line 47, in importFromPath
return self.importFromDir(dir_path, fqname)
File "/.tox/py36/lib/python3.6/site-packages/nose/importer.py", line 79, in importFromDir
fh, filename, desc = find_module(part, path)
File "/usr/lib/python3.6/imp.py", line 297, in find_module
raise ImportError(_ERR_MSG.format(name), name=name) ImportError: No module named 'my_project'
I see three possible offenders.
(1) python3 setup.py build should not exist in the commands section.
# the build command is redundant, there is a special option for this.
commands = python3 setup.py build
nosetests
# The install command with it's default
install_command=python -m pip install {opts} {packages}(ARGV)
deps = -r{toxinidir}/test-requirements.txt
(2) And with Pycharm you might have added your project as a sources root (right click folder > mark directory as > sources root). Or configured it otherwise (PATH variable perhaps?) that makes my_project available in context to running it in Pycharm? This should not happen inside tox though, unless you have whitelist externals or sitepackages turned to True..
So when installed on a container this link does not exist.
(3) I can't help but notice the abscence of a setup.py or pyproject.toml. Files used to install my_project. E.g. run this command locally and debug your installation if it doesn't work:
pip install .

Error in install_keras() in R since Ubuntu update

I used the book "Deep Learning with R" since one month now, and it enables me to make my first neural networks.
I am using Ubuntu. Until 2 days ago, everything was OK and worked fine. But two days ago I updated my Ubuntu to Ubuntu 18.02. Since then, my R code is not working anymore.
I have re-done what is recommended in the book (and what has worked one month ago):
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install python-pip python-dev
$ sudo apt-get install build-essential cmake git unzip pkg-config libopenblas-dev liblapack-dev
I had no error.
then in R:
install.packages("keras")
library(keras)
install_keras()
This last command is supposed to install the core Keras library along with its dependencies in a Python virtual environment using TensorFlow.
But I obtained the following error that I really do not understand:
> install_keras()
Using existing virtualenv at ~/.virtualenvs/r-tensorflow
Upgrading pip ...
Traceback (most recent call last):
File "/home/baragatt/.virtualenvs/r-tensorflow/bin/pip", line 7, in <module>
from pip._internal import main
File "/home/baragatt/.virtualenvs/r-tensorflow/local/lib/python2.7/site-packages/pip/_internal/__init__.py", line 5, in <module>
import logging
File "/usr/lib/python2.7/logging/__init__.py", line 26, in <module>
import sys, os, time, cStringIO, traceback, warnings, weakref, collections
File "/usr/lib/python2.7/weakref.py", line 14, in <module>
from _weakref import (
ImportError: cannot import name _remove_dead_weakref
Erreur : Error 1 occurred installing TensorFlow
I have re-installed R, python, tensorflow, but I always have the same error. I do not understand this error. Maybe this is a problem with the virtualenv?
Can someone help me please? It is so frustrating, because two days ago my code was running, and now impossible to work...
I am working with Ubuntu 18.02, at the installed versions are python 2.7.15~rc1-1, R-3.4.4 and tensorflow-1.10.0.
Thanks a lot for this post. I do not really understand what the commands in this post are supposed to fix. But I have done the following:
cd /home/baragatt/.virtualenvs/r-tensorflow/
Then, as proposed in the post:
virtualenv . --system-site-packages
I obtained the following messages:
Running virtualenv with interpreter /usr/bin/python2
New python executable in /home/baragatt/.virtualenvs/r-tensorflow/bin/python2
Not overwriting existing python script /home/baragatt/.virtualenvs/r-tensorflow/bin/python (you must use /home/baragatt/.virtualenvs/r-tensorflow/bin/python2)
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/virtualenv.py", line 2375, in <module>
main()
File "/usr/lib/python3/dist-packages/virtualenv.py", line 724, in main
symlink=options.symlink)
File "/usr/lib/python3/dist-packages/virtualenv.py", line 946, in create_environment
site_packages=site_packages, clear=clear, symlink=symlink))
File "/usr/lib/python3/dist-packages/virtualenv.py", line 1417, in install_python
os.symlink(py_executable_base, full_pth)
OSError: [Errno 17] File exists
I also tried:
virtualenv -p /usr/bin/python2.7 .
And I obtained:
Running virtualenv with interpreter /usr/bin/python2.7
New python executable in /home/baragatt/.virtualenvs/r-tensorflow/bin/python2.7
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/virtualenv.py", line 2375, in <module>
main()
File "/usr/lib/python3/dist-packages/virtualenv.py", line 724, in main
symlink=options.symlink)
File "/usr/lib/python3/dist-packages/virtualenv.py", line 946, in create_environment
site_packages=site_packages, clear=clear, symlink=symlink))
File "/usr/lib/python3/dist-packages/virtualenv.py", line 1278, in install_python
shutil.copyfile(executable, py_executable)
File "/usr/lib/python2.7/shutil.py", line 97, in copyfile
with open(dst, 'wb') as fdst:
IOError: [Errno 40] Too many levels of symbolic links: '/home/baragatt/.virtualenvs/r-tensorflow/bin/python2.7'
I finally find a solution, by looking at different forums.
I thought that the problem should be because of the virtualenvironment that should be created when doing the following command in R.
install_keras()
Hence, I deleted the virtual environment(s) by deleting the directory in which these environements are located (I imagine).
cd ~/.virtualenvs
rm -r r-tensorflow/
Then I have tried the following commands in R
install.packages("keras")
library(keras)
install_keras()
And it works! Honestly, I still do not understand what was the problem that occured after my Ubuntu update.

Plone 4.3.4 - ImportError: No module named dexterity.localcommands.dexterity

On a vanilla Plone 4.3.4 site (Unified Installer on Ubuntu 14.04.1LTS), and after updating buildout.cfg with the zopeskel and paster boiler plate stuff and running buildout, I successfully created a dexterity package in my src folder:
$ cd src
$ ../bin/zopeskel dexterity my.package
After updating buildout.cfg (adding my.package to the eggs section and src/my.package to the develop section) and running buildout, I tried to add content to my new package, like I have done so many times in Plone 4.3.3 and earlier versions:
$ cd my.package
$ ../../bin/paster addcontent dexterity_content
This results in the following error message:
Traceback (most recent call last):
File "../../bin/paster", line 260, in <module>
sys.exit(paste.script.command.run())
File "/home/Plone434_site/buildout-cache/eggs/PasteScript-1.7.5-py2.7.egg/paste/script/command.py", line 104, in run
invoke(command, command_name, options, args[1:])
File "/home/Plone434_site/buildout-cache/eggs/PasteScript-1.7.5-py2.7.egg/paste/script/command.py", line 143, in invoke exit_code = runner.run(args)
File "/home/Plone434_site/buildout-cache/eggs/PasteScript-1.7.5-py2.7.egg/paste/script/command.py", line 238, in run
result = self.command()
File "/home/Plone434_site/buildout-cache/eggs/ZopeSkel-2.21.2-py2.7.egg/zopeskel/localcommands/__init__.py", line 70, in command
self._extend_templates(templates, args[0])
File "/home/Plone434_site/buildout-cache/eggs/ZopeSkel-2.21.2-py2.7.egg/zopeskel/localcommands/__init__.py", line 204, in _extend_templates tmpl = entry.load()(entry.name)
File "/home/Plone434_site/buildout-cache/eggs/setuptools-7.0-py2.7.egg/pkg_resources.py", line 2184, in load ['__name__'])
ImportError: No module named dexterity.localcommands.dexterity
Doing exactly the same on a Plone 4.3.3 site works just fine.
When I run the following:
$ ../../bin/paster addcontent -l
I get the following warning messages:
Warning: could not load entry point dexterity_behavior (ImportError: No module named dexterity.localcommands.dexterity)
Warning: could not load entry point dexterity_content (ImportError: No module named dexterity.localcommands.dexterity)
Available templates:
No template
I am wondering if this is somehow related to Plone 4.3.4 using setuptools 7.0, while previous versions used 0.7.2
Any advice to resolve this issue would be much appreciated.

Syntax Error running bin/buildout on Plone 3.2.3

I get the folowing error when I run bin/buildout.
I´ve check this issue here on Plone.org and they say that it ´s not dangerous
but they do not say how to resolve it.
I want to skip this error in order to execute bin/buildout withouth errors, til now I´m updating my products manually. How can I solve this?
root#sevilla2:/var/plone/zinstance# bin/buildout
While:
Installing.
Getting section precompile.
Initializing section precompile.
Loading zc.buildout recipe entry plone.recipe.precompiler:default.
An internal error occured due to a bug in either zc.buildout or in a
recipe being used:
Traceback (most recent call last):
File "/var/plone/buildout-cache/eggs/zc.buildout-1.1.2-py2.4.egg/zc/buildout/buildout.py", line 1509, in main
getattr(buildout, command)(args)
File "/var/plone/buildout-cache/eggs/zc.buildout-1.1.2-py2.4.egg/zc/buildout/buildout.py", line 357, in install
[self[part]['recipe'] for part in install_parts]
File "/var/plone/buildout-cache/eggs/zc.buildout-1.1.2-py2.4.egg/zc/buildout/buildout.py", line 888, in __getitem__
options._initialize()
File "/var/plone/buildout-cache/eggs/zc.buildout-1.1.2-py2.4.egg/zc/buildout/buildout.py", line 969, in _initialize
recipe_class = _install_and_load(reqs, 'zc.buildout', entry, buildout)
File "/var/plone/buildout-cache/eggs/zc.buildout-1.1.2-py2.4.egg/zc/buildout/buildout.py", line 932, in _install_and_load
return pkg_resources.load_entry_point(
File "/var/plone/buildout-cache/eggs/setuptools-0.6c9-py2.4.egg/pkg_resources.py", line 277, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/var/plone/buildout-cache/eggs/setuptools-0.6c9-py2.4.egg/pkg_resources.py", line 2180, in load_entry_point
return ep.load()
File "/var/plone/buildout-cache/eggs/setuptools-0.6c9-py2.4.egg/pkg_resources.py", line 1913, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/var/plone/buildout-cache/eggs/plone.recipe.precompiler-0.6-py2.4.egg/plone/recipe/precompiler/__init__.py", line 7, in ?
from pythongettext.msgfmt import Msgfmt
File "/var/plone/buildout-cache/eggs/python_gettext-2.1-py2.4.egg/pythongettext/msgfmt.py", line 265
except Exception as msg:
^
SyntaxError: invalid syntax
I came from a migration of my site (successfully completed but builded without buildout)
Plone 3.2.3
CMF 2.1.2 Zope (Zope 2.10.7-final, python 2.4.5, linux2)
Python 2.4.5 [GCC 4.4.5]
PIL 1.1.6
You'll need to pin python-gettext to use a version before version 2.0. That version introduced syntax that requires Python 2.6 or newer (to make the package work on Python 3 as well).
In your buildout versions section, add:
python-gettext = 1.2

Resources