apache2 - runs python 2.6, instead of 2.7 - apache

I'm trying to set up apache2 web server for Odoo. The only problem I got is it does not run correct version of python. I'm using squeez linux distribution, so default version is 2.6. But I need 2.7. So I installed it separately and I could run it using virtualenv just fine (before I had set Odoo server using that approach). Now I need to do the same, but also need to introduce apache2. But for some reason it always runs python 2.6 and with that Odoo (v8) fails to start, because it requires python 2.7.
So when I start apache2 and try to open server address, I get this error:
mod_wsgi (pid=32341): Target WSGI script '/opt/odoo/openerp-wsgi.py' cannot be loaded as Python module.
mod_wsgi (pid=32341): Exception occurred processing WSGI script '/opt/odoo/openerp-wsgi.py'.
Traceback (most recent call last):
File "/opt/odoo/openerp-wsgi.py", line 22, in <module>
import openerp
File "/opt/odoo/odoo/openerp/__init__.py", line 72, in <module>
import modules
File "/opt/odoo/odoo/openerp/modules/__init__.py", line 27, in <module>
from . import db, graph, loading, migration, module, registry
File "/opt/odoo/odoo/openerp/modules/graph.py", line 32, in <module>
import openerp.osv as osv
File "/opt/odoo/odoo/openerp/osv/__init__.py", line 22, in <module>
import osv
File "/opt/odoo/odoo/openerp/osv/osv.py", line 23, in <module>
from .orm import Model, TransientModel, AbstractModel
File "/opt/odoo/odoo/openerp/osv/orm.py", line 5, in <module>
from ..models import (
File "/opt/odoo/odoo/openerp/models.py", line 2083
groupby_dict = {gb['groupby']: gb for gb in annotated_groupbys}
This error clearly indicates that python 2.6 version is being run (dict comprehensions were introduced in 2.7). And anything I tried, let to same outcome, I either got different error or apache still runs version 2.6.
My configuration:
site config:
<VirtualHost *:80>
ServerName some.eu
ServerAlias *.some.eu
WSGIDaemonProcess oe user=user group=some_group processes=2 python-path=/opt/odoo/odoo/ display-name=apache-odoo
WSGIScriptAlias / /opt/odoo/openerp-wsgi.py
WSGIProcessGroup oe
ErrorLog /var/log/odoo/odoo-error.log
CustomLog /var/log/odoo/odoo-access.log combined
<Directory /opt/odoo/odoo>
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
My wsgi configuration file:
import sys
import os
import site
#Activate virtualenv
activate_this = os.path.expanduser("/opt/odoo/venv/bin/activate_this.py")
execfile(activate_this, dict(__file__=activate_this))
site.addsitedir('/opt/odoo/venv/lib/python2.7/site-packages/')
sys.path.append("/opt/odoo/odoo")
import openerp
#----------------------------------------------------------
# Common
#----------------------------------------------------------
openerp.multi_process = True # Nah!
# Equivalent of --load command-line option
openerp.conf.server_wide_modules = ['web']
conf = openerp.tools.config
# Path to the OpenERP Addons repository (comma-separated for
# multiple locations)
conf['addons_path'] = '/path/to/addons/'
Activating virtualenv in wsgi file seems to do nothing. If I change in apache site configuration python-path to /opt/venv/lib/python2.7/site-packages/, then I start getting different error saying that run time version is 2.6 and compiletime version is 2.7. Like this:
/opt/odoo/odoo/openerp/osv/orm.py:2: RuntimeWarning: compiletime version 2.7 of module 'lxml.etree' does not match runtime version 2.6
Does anyone have any solutions for this?

Finally found a solution for this (reference that helped me solve it http://jamesseibel.com/blog/?p=45).
First I removed old mod_wsgi files:
rm -rf /usr/lib/apache2/modules/mod_wsgi*
Then downloaded and installed mod_wsgi this way:
wget https://github.com/GrahamDumpleton/mod_wsgi/archive/master.zip
unzip master
cd mod_wsgi-master
sudo ./configure --with-python=/path/to/bin/python2.7
sudo LD_RUN_PATH=/usr/local/lib make
sudo make install
Now it runs on python2.7

Related

pipenv installed pip does not work with specified python version

On a Raspberry Pi OS Bullseye system, I tried to install numpy with pipenv using a specific python version and got this:
$ pipenv --python /opt/python/3.7/bin/python3 install numpy --verbose
Creating a virtualenv for this project…
Using /opt/python/3.7/bin/python3 (3.7.9) to create virtualenv…
⠋created virtual environment CPython3.7.9.final.0-32 in 410ms
creator CPython3Posix(dest=/home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC, clear=False, no_vcs_ignore=False, global=False)
seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/pi/.local/share/virtualenv)
added seed packages: pip==20.3.4, pkg_resources==0.0.0, setuptools==44.1.1, wheel==0.34.2
activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator
Virtualenv location: /home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC
Installing numpy…
⠙Installing 'numpy'
$ "/home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/bin/pip" install --verbose "numpy" -i https://pypi.org/simple --exists-action w
⠙
Error: An error occurred while installing numpy!
Traceback (most recent call last):
File "/home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/bin/pip", line 5, in <module>
from pip._internal.cli.main import main
File "/home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/lib/python3.7/site-packages/pip/_internal/cli/main.py", line 10, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/lib/python3.7/site-packages/pip/_internal/cli/autocompletion.py", line 9, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/lib/python3.7/site-packages/pip/_internal/cli/main_parser.py", line 7, in <module>
from pip._internal.cli import cmdoptions
File "/home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/lib/python3.7/site-packages/pip/_internal/cli/cmdoptions.py", line 23, in <module>
from pip._vendor.packaging.utils import canonicalize_name
ModuleNotFoundError: No module named 'pip._vendor.packaging'
Looking at the verbose output i see that the path to pip used by pipenv is /home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/bin/pip.
Calling this pip directly indeed leads to the same error:
$ /home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/bin/pip --version
Traceback (most recent call last):
File "/home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/bin/pip", line 5, in <module>
from pip._internal.cli.main import main
File "/home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/lib/python3.7/site-packages/pip/_internal/cli/main.py", line 10, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/lib/python3.7/site-packages/pip/_internal/cli/autocompletion.py", line 9, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/lib/python3.7/site-packages/pip/_internal/cli/main_parser.py", line 7, in <module>
from pip._internal.cli import cmdoptions
File "/home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/lib/python3.7/site-packages/pip/_internal/cli/cmdoptions.py", line 23, in <module>
from pip._vendor.packaging.utils import canonicalize_name
ModuleNotFoundError: No module named 'pip._vendor.packaging'
Which python is used in that case? Looking at the shebang line it would seem it's the one I passed to pipenv initially:
$ head -n 1 /home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/bin/pip
#!/home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/bin/python
$ ls -l /home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/bin/python
lrwxrwxrwx 1 pi pi 27 Dec 11 11:00 /home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/bin/python -> /opt/python/3.7/bin/python3
But when I explicitly use that exact interpreter there is no error:
$ /opt/python/3.7/bin/python3 /home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/bin/pip --version
pip 20.1.1 from /opt/python/3.7/lib/python3.7/site-packages/pip (python 3.7)
The difference seems to be that in the case it goes wrong, the pip installation in /home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/lib/python3.7/site-packages/pip is used while in the working case it's the one in /opt/python/3.7/lib/python3.7/site-packages/pip.
But why? My understanding of the shebang is that it points to the interpreter that's to be used. In the working example all i do is call that interpreter explicitly myself. Why is there a difference in behaviour?
And also, why did pipenv even install its own pip in /home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/lib/python3.7/site-packages/pip ? Why didn't it reuse the pip that comes with the python version I passed? And if that's just how pipenv works, why is its pip broken? What's going on? And how can I fix it?
EDIT
When i use my system python 3.9 installation it works fine.

Trouble running a python/poetry flask app under apache / wsgi

I've written a flask app using poetry and want to run it under the control of apache and wsgi. I've spent hours scouring documentation and experimenting and I've learned a lot but still have not figured it out. Here is the blow by blow:
The app works when I run it directly from the command line in poetry:
python3 ./otproject/otpflask/src/run.py
* Serving Flask app 'teacher' (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: on
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
* Restarting with stat
* Debugger is active!
* Debugger PIN: 141-706-196
^Crpsalas#otproject:~/mydev/development$
According to poetry, my venv is here:
$ poetry env info
VirtualEnv
Python: 3.8.10
Implementation: CPython
Path: /home/rpsalas/.cache/pypoetry/virtualenvs/otproject-Yy_WWjvb-py3.8
Valid: True
System
Platform: linux
OS: posix
Python: /usr
Then I configure my apache mod_wsgi as follows
<VirtualHost *:80>
WSGIDaemonProcess test python-home=/home/rpsalas/.cache/pypoetry/virtualenvs/otproject-Yy_WWjvb-py3.8
WSGIProcessGroup test
WSGIApplicationGroup %{GLOBAL}
WSGIScriptAlias /test /var/www/test/test.wsgi
<Directory /var/www/test/src/>
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
The wsgi python script test.wsgi looks like this:
#!/usr/bin/env python
from otproject.otpflask.teacher import app as application
But when I restart the apache service it fails horribly:
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'
Current thread 0x00007f99756e4c40 (most recent call first):
<no Python frame>
[Sun Jul 25 20:35:24.503068 2021] [wsgi:warn] [pid 154900:tid 140297076886592] (13)Permission denied: mod_wsgi (pid=154900): Unable to stat Python home /home/rpsalas/.cache/pypoetry/virtualenvs/otproject-Yy_WWjvb-py3.8. Python interpreter may not be able to be initialized correctly. Verify the supplied path and access permissions for whole of the path.
Python path configuration:
PYTHONHOME = '/home/rpsalas/.cache/pypoetry/virtualenvs/otproject-Yy_WWjvb-py3.8'
PYTHONPATH = (not set)
program name = 'python3'
isolated = 0
environment = 1
user site = 1
import site = 1
sys._base_executable = '/usr/bin/python3'
sys.base_prefix = '/home/rpsalas/.cache/pypoetry/virtualenvs/otproject-Yy_WWjvb-py3.8'
sys.base_exec_prefix = '/home/rpsalas/.cache/pypoetry/virtualenvs/otproject-Yy_WWjvb-py3.8'
sys.executable = '/usr/bin/python3'
sys.prefix = '/home/rpsalas/.cache/pypoetry/virtualenvs/otproject-Yy_WWjvb-py3.8'
sys.exec_prefix = '/home/rpsalas/.cache/pypoetry/virtualenvs/otproject-Yy_WWjvb-py3.8'
sys.path = [
'/home/rpsalas/.cache/pypoetry/virtualenvs/otproject-Yy_WWjvb-py3.8/lib/python38.zip',
'/home/rpsalas/.cache/pypoetry/virtualenvs/otproject-Yy_WWjvb-py3.8/lib/python3.8',
'/home/rpsalas/.cache/pypoetry/virtualenvs/otproject-Yy_WWjvb-py3.8/lib/python3.8/lib-dynload',
]

EMR JupyterHub: S3 persistence of notebooks not working

I am trying to set up an EMR cluster with JupyterHub and S3 persistence. I have the following classification:
{
"Classification": "jupyter-s3-conf",
"Properties": {
"s3.persistence.enabled": "true",
"s3.persistence.bucket": "my-persistence-bucket"
}
}
I am installing dask with the following step (otherwise, opening the notebook would result in a 500 error):
command-runner.jar
Arguments: /usr/bin/sudo /usr/bin/docker exec jupyterhub conda install dask
However, when I then open a new notebook, it is not persisted. The bucket stays empty. The cluster DOES have access to S3, as when running a Spark job with the same configuration which reads from and writes to S3, it can do so, with the same bucket.
However, when looking into the jupyter log on my master, I see this:
[E 2019-08-07 12:27:14.609 SingleUserNotebookApp application:574] Exception while loading config file /etc/jupyter/jupyter_notebook_config.py
Traceback (most recent call last):
File "/opt/conda/lib/python3.6/site-packages/traitlets/config/application.py", line 562, in _load_config_files
config = loader.load_config()
File "/opt/conda/lib/python3.6/site-packages/traitlets/config/loader.py", line 457, in load_config
self._read_file_as_dict()
File "/opt/conda/lib/python3.6/site-packages/traitlets/config/loader.py", line 489, in _read_file_as_dict
py3compat.execfile(conf_filename, namespace)
File "/opt/conda/lib/python3.6/site-packages/ipython_genutils/py3compat.py", line 198, in execfile
exec(compiler(f.read(), fname, 'exec'), glob, loc)
File "/etc/jupyter/jupyter_notebook_config.py", line 5, in <module>
from s3contents import S3ContentsManager
File "/opt/conda/lib/python3.6/site-packages/s3contents/__init__.py", line 15, in <module>
from .gcsmanager import GCSContentsManager
File "/opt/conda/lib/python3.6/site-packages/s3contents/gcsmanager.py", line 8, in <module>
from s3contents.gcs_fs import GCSFS
File "/opt/conda/lib/python3.6/site-packages/s3contents/gcs_fs.py", line 3, in <module>
import gcsfs
File "/opt/conda/lib/python3.6/site-packages/gcsfs/__init__.py", line 4, in <module>
from .dask_link import register as register_dask
File "/opt/conda/lib/python3.6/site-packages/gcsfs/dask_link.py", line 56, in <module>
register()
File "/opt/conda/lib/python3.6/site-packages/gcsfs/dask_link.py", line 51, in register
dask.bytes.core._filesystems['gcs'] = DaskGCSFileSystem
AttributeError: module 'dask.bytes.core' has no attribute '_filesystems'
What am I missing and what is going wrong?
It turned out it was a chain reaction of upgrading and installing custom packages breaking compatibility. I install additional packages in my cluster with the command-runner where I had some issues - I could only run one conda install command, the second one failed with no module named 'conda'.
So I updated Anaconda first by doing /usr/bin/sudo /usr/bin/docker exec jupyterhub conda update -n base conda with the command-runner. This caused jinja2 not finding markupsafe. Installing markupsafe pulled jupyterhub to 1.0.0 which broke even more things.
So here is how I got it to work (executed in order with command-runner.jar):
/usr/bin/sudo /usr/bin/docker exec jupyterhub conda update -n base conda
updates Anaconda.
/usr/bin/sudo /usr/bin/docker exec jupyterhub conda install --freeze-installed markupsafe
installs markupsafe which is needed after step 1.
Installed my desired additional packages into the container, but always with --freeze-installed option to circumvent breaking anything installed by EMR
A custom bootstrap action that runs a script from S3 installs my desired packages from step 3 with pip-3.6 as well so they work for PySpark (for it to work, they have to be installed on all nodes directly)

Plone ldap add on installation issue

I am trying to get ldap authentication to work on Plone version 4.2. I have hammered at the issue for several hours without results. I have even tried these steps:
Install python-ldap 2.6 (C:\Python26)
Install Plone 4.2 with the installer (D:\Plone)
Edit buildout.cfg with plone.app.ldap in the EGG and ZCML section
Create a new folder called python_ldap-2.3.12-py2.6.egg in D:\Plone\buildout-cache\eggs\
Copy C:\Python26\lib\site-packages\python_ldap-2.3.12-py2.6.egg-info to D:\Plone\buildout-cache\eggs\python_ldap-2.3.12-py2.6.egg\ and rename to EGG-INFO
Also copy the ldap folder in C:\Python26\lib\site-packages\ to D:\Plone\buildout-cache\eggs\python_ldap-2.3.12-py2.6.egg\
Also copy the file ldapurl.py to C:\Python26\lib\site-packages\ to D:\Plone\buildout-cache\eggs\python_ldap-2.3.12-py2.6.egg\
Next copy:
folder: C:\Python26\lib\site-packages\python_ldap-2.3.12-py2.6.egg-info
folder: C:\Python26\lib\site-packages\ldap
to D:\Plone\python\Lib\site-packages
Start commandbox and run bin\buildout
Start Plone, log in as admin and go to the extra products section. Here you will find the LDAP product. Install it and enter you LDAP details.
None of that really helped. When i try bin/buildout, I get the following message:
Installing instance.
Getting distribution for 'dataflake.fakeldap'.
zip_safe flag not set; analyzing archive contents...
Installed /tmp/easy_install-oISsVG/dataflake.fakeldap-1.0/setuptools_git-0.4.2-py2.6.egg
Got dataflake.fakeldap 1.0.
Generated script '/usr/local/Plone/zinstance/bin/instance'.
Installing zopepy.
Generated interpreter '/usr/local/Plone/zinstance/bin/zopepy'.
Installing zopeskel.
Generated script '/usr/local/Plone/zinstance/bin/zopeskel'.
Generated script '/usr/local/Plone/zinstance/bin/paster'.
Updating backup.
Updating chown.
chown: Running
echo Dummy references to force this to execute after referenced parts
echo /usr/local/Plone/zinstance/var/backups sudo -u plone
chmod 600 .installed.cfg
find /usr/local/Plone/zinstance/var -type d -exec chmod 700 {} \;
chmod 744 /usr/local/Plone/zinstance/bin/*
Dummy references to force this to execute after referenced parts
/usr/local/Plone/zinstance/var/backups sudo -u plone
Updating repozo.
Updating unifiedinstaller.
*************** PICKED VERSIONS ****************
[versions]
Products.LDAPMultiPlugins = 1.14
Products.LDAPUserFolder = 2.23
Products.PloneLDAP = 1.1
collective.sendaspdf = 2.6
dataflake.fakeldap = 1.0
jquery.pyproxy = 0.4.1
plone.app.ldap = 1.2.8
*************** /PICKED VERSIONS ***************
When I try bin/buildout, it says daemon process started and gives an id but when i try localhost:8080, it says "Problem loading page" and the page does not load. I tried bin/instance fg to display the errors and i following message.
bin/instance fg
2012-07-24 08:53:18 INFO ZServer HTTP server started at Tue Jul 24 08:53:18 2012
Hostname: 0.0.0.0
Port: 8080
2012-07-24 08:53:18 INFO Zope Set effective user to "plone"
2012-07-24 08:53:19 WARNING SecurityInfo Conflicting security declarations for "setText"
2012-07-24 08:53:19 WARNING SecurityInfo Class "ATTopic" had conflicting security declarations
2012-07-24 08:53:19 ERROR Application Could not import Products.LDAPMultiPlugins
Traceback (most recent call last):
File "/usr/local/Plone/buildout-cache/eggs/Zope2-2.13.15-py2.6.egg/OFS/Application.py", line 606, in import_product
product=__import__(pname, global_dict, global_dict, silly)
File "/usr/local/Plone/buildout-cache/eggs/Products.LDAPMultiPlugins-1.14-py2.6.egg/Products/LDAPMultiPlugins/__init__.py", line 22, in <module>
from Products.LDAPMultiPlugins.LDAPMultiPlugin import addLDAPMultiPluginForm
File "/usr/local/Plone/buildout-cache/eggs/Products.LDAPMultiPlugins-1.14-py2.6.egg/Products/LDAPMultiPlugins/LDAPMultiPlugin.py", line 29, in <module>
from Products.LDAPUserFolder import manage_addLDAPUserFolder
File "/usr/local/Plone/buildout-cache/eggs/Products.LDAPUserFolder-2.23-py2.6.egg/Products/LDAPUserFolder/__init__.py", line 20, in <module>
from Products.LDAPUserFolder.LDAPUserFolder import LDAPUserFolder
File "/usr/local/Plone/buildout-cache/eggs/Products.LDAPUserFolder-2.23-py2.6.egg/Products/LDAPUserFolder/LDAPUserFolder.py", line 52, in <module>
from Products.LDAPUserFolder.LDAPDelegate import filter_format
File "/usr/local/Plone/buildout-cache/eggs/Products.LDAPUserFolder-2.23-py2.6.egg/Products/LDAPUserFolder/LDAPDelegate.py", line 19, in <module>
import ldap
File "/usr/local/Plone/buildout-cache/eggs/python_ldap-2.3.12-py2.6.egg/ldap/__init__.py", line 22, in <module>
from _ldap import *
ImportError: No module named _ldap
Traceback (most recent call last):
File "/usr/local/Plone/buildout-cache/eggs/Zope2-2.13.15-py2.6.egg/Zope2/Startup/run.py", line 76, in <module>
run()
File "/usr/local/Plone/buildout-cache/eggs/Zope2-2.13.15-py2.6.egg/Zope2/Startup/run.py", line 22, in run
starter.prepare()
File "/usr/local/Plone/buildout-cache/eggs/Zope2-2.13.15-py2.6.egg/Zope2/Startup/__init__.py", line 86, in prepare
self.startZope()
File "/usr/local/Plone/buildout-cache/eggs/Zope2-2.13.15-py2.6.egg/Zope2/Startup/__init__.py", line 259, in startZope
Zope2.startup()
File "/usr/local/Plone/buildout-cache/eggs/Zope2-2.13.15-py2.6.egg/Zope2/__init__.py", line 47, in startup
_startup()
File "/usr/local/Plone/buildout-cache/eggs/Zope2-2.13.15-py2.6.egg/Zope2/App/startup.py", line 67, in startup
OFS.Application.import_products()
File "/usr/local/Plone/buildout-cache/eggs/Zope2-2.13.15-py2.6.egg/OFS/Application.py", line 583, in import_products
import_product(product_dir, product_name, raise_exc=debug_mode)
File "/usr/local/Plone/buildout-cache/eggs/Zope2-2.13.15-py2.6.egg/OFS/Application.py", line 606, in import_product
product=__import__(pname, global_dict, global_dict, silly)
File "/usr/local/Plone/buildout-cache/eggs/Products.LDAPMultiPlugins-1.14-py2.6.egg/Products/LDAPMultiPlugins/__init__.py", line 22, in <module>
from Products.LDAPMultiPlugins.LDAPMultiPlugin import addLDAPMultiPluginForm
File "/usr/local/Plone/buildout-cache/eggs/Products.LDAPMultiPlugins-1.14-py2.6.egg/Products/LDAPMultiPlugins/LDAPMultiPlugin.py", line 29, in <module>
from Products.LDAPUserFolder import manage_addLDAPUserFolder
File "/usr/local/Plone/buildout-cache/eggs/Products.LDAPUserFolder-2.23-py2.6.egg/Products/LDAPUserFolder/__init__.py", line 20, in <module>
from Products.LDAPUserFolder.LDAPUserFolder import LDAPUserFolder
File "/usr/local/Plone/buildout-cache/eggs/Products.LDAPUserFolder-2.23-py2.6.egg/Products/LDAPUserFolder/LDAPUserFolder.py", line 52, in <module>
from Products.LDAPUserFolder.LDAPDelegate import filter_format
File "/usr/local/Plone/buildout-cache/eggs/Products.LDAPUserFolder-2.23-py2.6.egg/Products/LDAPUserFolder/LDAPDelegate.py", line 19, in <module>
import ldap
File "/usr/local/Plone/buildout-cache/eggs/python_ldap-2.3.12-py2.6.egg/ldap/__init__.py", line 22, in <module>
from _ldap import *
ImportError: No module named _ldap
What am i doing wrong? Help wil be deeply appreciated
Your buildout ran successfully, there were no problems there. Some of the packages you picked were not pinned, so your buildout reported what versions it choose for you.
Your server itself is not indeed running because the Python LDAP egg you installed seems to be incorrectly installed. The buildout-cache/eggs/python_ldap-2.3.12-py2.6.egg/ldap/_ldap.so library file is missing.
Remove the whole egg (rm -rf buildout-cache-eggs/python_ldap-2.3.12-py2.6.egg) make sure you have the OpenLDAP 2.x library and headers installed on your system (on Ubuntu and Debian the libldap2-dev should be enough). Then re-run buildout to reinstall the egg.
Alternatively, you could try and install the system python-ldap package (remove the egg) and see if buildout picks that up instead.
You need to install 2 libs:
sudo apt-get install libldap2-dev
sudo apt-get install libsasl2-dev
Hope that will help.

Django-nonrel import cache fail

I am trying to setup django-nonrel on GAE (Google App Engine) -
following the steps here http://www.allbuttonspressed.com/projects/djangoappengine#installation
The test application works great -
I was able to use the cache API in the application, but not so for the tests and shell:
Attempting to from django.core.cache import cache in the shell gives me:
>>> from django.core.cache import cache
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "django-testapp/django/core/cache/__init__.py", line 182, in <module>
cache = get_cache(DEFAULT_CACHE_ALIAS)
File "django-testapp/django/core/cache/__init__.py", line 180, in get_cache
return backend_cls(location, params)
File "django-testapp/django/core/cache/backends/memcached.py", line 154, in __init__
import memcache
ImportError: No module named memcache
Similarly attempting ./manage.py test fails the same way.
Any idea why ./manage runserver works fine, but ./manage shell or ./manage test fails to import cache?
I had the same problem when I upgraded to Google App Engine 1.6.0 from 1.5.5 .
I solved the problem by installing python-memcached:
pip install python-memcached
For gentoo users it's recommended:
emerge -av dev-python/python-memcached
I alse do like this:
sudo pip install python-memcached
then restart the django, it works.