This forum is now just an archive. Use the new Q&A website
It is currently Fri Apr 25, 2014 1:17 am

All times are UTC + 2 hours




Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 39 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: No module named lxml
PostPosted: Tue Oct 04, 2011 11:58 am 
Offline

Joined: Tue Oct 04, 2011 11:40 am
Posts: 1
Hello,

I need to install OpenERP v6.0.3 on a CentOS release 5.7 but after I install Python 2.5.1 I get the error message (when I do : python openerp-server.py) :

Code:
Traceback (most recent call last):
  File "openerp-server.py", line 58, in <module>
    import netsvc
  File "/home/openerp/openerp-server-6.0.3/bin/netsvc.py", line 292, in <module>
    import tools
  File "/home/openerp/openerp-server-6.0.3/bin/tools/__init__.py", line 25, in <module>
    from misc import *
  File "/home/openerp/openerp-server-6.0.3/bin/tools/misc.py", line 47, in <module>
    from lxml import etree
ImportError: No module named lxml


But this module is already install on latest version (apt-get install python-lxml).
I know the problem become to multiple python versions (2.4 & 2.5) but I don't know how to resolve this.

Thanks for help.


Top
 Profile  
 
 Post subject: Re: No module named lxml
PostPosted: Thu Oct 06, 2011 9:57 am 
Offline

Joined: Fri Nov 21, 2008 9:56 am
Posts: 3114
Location: Lotharingie
Hi,
for windows I need libxml2 too
bye


Top
 Profile  
 
 Post subject: Re: No module named lxml
PostPosted: Tue Oct 18, 2011 9:02 am 
Offline

Joined: Tue Oct 18, 2011 8:52 am
Posts: 19
Location: Algiers
you installed libxml for python version 2.x and are running python version 2.y

If x > y, then you should run python version 2.x to launch the server. You can do so by editing the file /usr/bin/openerp-server (as root) and changing the python version there.

Otherwise, you should install libxml for python version Y. You can do so by installing easy_install and run easy_install2.y lxml (as root).

Hope this helps.


Top
 Profile  
 
 Post subject: Re: No module named lxml
PostPosted: Mon Feb 06, 2012 4:40 pm 
Offline

Joined: Mon Feb 06, 2012 4:37 pm
Posts: 19
Location: Iasi Romania
Hy

I followed this instructions for Centos
topic22108.html

I don't find anywhere /usr/bin/openerp-server in those instructions

My python version 2.5
Lxml 2.3 that is final version.

Please help.


Top
 Profile  
 
 Post subject: Re: No module named lxml
PostPosted: Mon Feb 06, 2012 4:50 pm 
Offline

Joined: Tue Oct 18, 2011 8:52 am
Posts: 19
Location: Algiers
Can you paste the output of the following command :

Code:
which openerp-server


Maybe it is in /usr/local/bin/


Top
 Profile  
 
 Post subject: Re: No module named lxml
PostPosted: Mon Feb 06, 2012 4:55 pm 
Offline

Joined: Mon Feb 06, 2012 4:37 pm
Posts: 19
Location: Iasi Romania
I search also in /usr/local/bin it is not there.

Which it doesn't return nothing

Code:
./openerp-server.py -s --stop-after-init -c /home/openerp/openerp-server.cfg
Traceback (most recent call last):
  File "./openerp-server.py", line 58, in <module>
    import netsvc
  File "/home/openerp/openerp-server-6.0.1/bin/netsvc.py", line 292, in <module>
    import tools
  File "/home/openerp/openerp-server-6.0.1/bin/tools/__init__.py", line 25, in <module>
    from misc import *
  File "/home/openerp/openerp-server-6.0.1/bin/tools/misc.py", line 47, in <module>
    from lxml import etree
ImportError: No module named lxml


Top
 Profile  
 
 Post subject: Re: No module named lxml
PostPosted: Mon Feb 06, 2012 7:09 pm 
Offline

Joined: Tue Oct 18, 2011 8:52 am
Posts: 19
Location: Algiers
Looking at the traceback I can tell that your installation has been done in /home/openerp.

Can you paste the result of this command ?

Code:
find /home/openerp -iname "*openerp-server.py*"


Top
 Profile  
 
 Post subject: Re: No module named lxml
PostPosted: Mon Feb 06, 2012 7:12 pm 
Offline

Joined: Mon Feb 06, 2012 4:37 pm
Posts: 19
Location: Iasi Romania
Code:
/home/openerp/openerp-server-6.0.1/bin/openerp-server.py
/home/openerp/openerp-server-6.0.1/build/lib/openerp-server/openerp-server.py


Top
 Profile  
 
 Post subject: Re: No module named lxml
PostPosted: Tue Feb 07, 2012 10:24 am 
Offline

Joined: Tue Oct 18, 2011 8:52 am
Posts: 19
Location: Algiers
That's what I thought, you can change the first file.

/home/openerp/openerp-server-6.0.1/bin/openerp-server.py


Top
 Profile  
 
 Post subject: Re: No module named lxml
PostPosted: Tue Feb 07, 2012 11:51 am 
Offline

Joined: Mon Feb 06, 2012 4:37 pm
Posts: 19
Location: Iasi Romania
What to change there


Top
 Profile  
 
 Post subject: Re: No module named lxml
PostPosted: Tue Feb 07, 2012 11:59 am 
Offline

Joined: Tue Oct 18, 2011 8:52 am
Posts: 19
Location: Algiers
Change the python version to the one where lxml has been installed.

You should have a line like this in your file :

Code:
exec /usr/bin/python ./openerp-client.py $@


If lxml has been installed for python 2.7 for example, just change it to :

Code:
exec /usr/bin/python2.7 ./openerp-client.py $@


Or something like that.


Top
 Profile  
 
 Post subject: Re: No module named lxml
PostPosted: Tue Feb 07, 2012 12:10 pm 
Offline

Joined: Mon Feb 06, 2012 4:37 pm
Posts: 19
Location: Iasi Romania
This is the file content

Code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
##############################################################################
#
#    OpenERP, Open Source Management Solution
#    Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU Affero General Public License as
#    published by the Free Software Foundation, either version 3 of the
#    License, or (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU Affero General Public License for more details.
#
#    You should have received a copy of the GNU Affero General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################

"""
OpenERP - Server
OpenERP is an ERP+CRM program for small and medium businesses.

The whole source code is distributed under the terms of the
GNU Public Licence.

(c) 2003-TODAY, Fabien Pinckaers - OpenERP s.a.
"""

#----------------------------------------------------------
# python imports
#----------------------------------------------------------
import logging
import os
import signal
import sys
import threading
import traceback

import release
__author__ = release.author
__version__ = release.version

if os.name == 'posix':
    import pwd
    # We DON't log this using the standard logger, because we might mess
    # with the logfile's permissions. Just do a quick exit here.
    if pwd.getpwuid(os.getuid())[0] == 'root' :
        sys.stderr.write("Attempted to run OpenERP server as root. This is not good, aborting.\n")
        sys.exit(1)

#----------------------------------------------------------
# get logger
#----------------------------------------------------------
import netsvc
logger = logging.getLogger('server')

#-----------------------------------------------------------------------
# import the tools module so that the commandline parameters are parsed
#-----------------------------------------------------------------------
import tools
logger.info("OpenERP version - %s", release.version)
for name, value in [('addons_path', tools.config['addons_path']),
                    ('database hostname', tools.config['db_host'] or 'localhost'),
                    ('database port', tools.config['db_port'] or '5432'),
                    ('database user', tools.config['db_user'])]:
    logger.info("%s - %s", name, value)

# Don't allow if the connection to PostgreSQL done by postgres user
if tools.config['db_user'] == 'postgres':
    logger.error("Connecting to the database as 'postgres' user is forbidden, as it present major security issues. Shutting down.")
    sys.exit(1)

import time

#----------------------------------------------------------
# init net service
#----------------------------------------------------------
logger.info('initialising distributed objects services')

#---------------------------------------------------------------
# connect to the database and initialize it with base if needed
#---------------------------------------------------------------
import pooler

#----------------------------------------------------------
# import basic modules
#----------------------------------------------------------
import osv
import workflow
import report
import service

#----------------------------------------------------------
# import addons
#----------------------------------------------------------

import addons

#----------------------------------------------------------
# Load and update databases if requested
#----------------------------------------------------------

import service.http_server

if not ( tools.config["stop_after_init"] or \
    tools.config["translate_in"] or \
    tools.config["translate_out"] ):
    service.http_server.init_servers()
    service.http_server.init_xmlrpc()
    service.http_server.init_static_http()

    import service.netrpc_server
    service.netrpc_server.init_servers()

if tools.config['db_name']:
    for dbname in tools.config['db_name'].split(','):
        db,pool = pooler.get_db_and_pool(dbname, update_module=tools.config['init'] or tools.config['update'], pooljobs=False)
        cr = db.cursor()

        if tools.config["test_file"]:
            logger.info('loading test file %s', tools.config["test_file"])
            tools.convert_yaml_import(cr, 'base', file(tools.config["test_file"]), {}, 'test', True)
            cr.rollback()

        pool.get('ir.cron')._poolJobs(db.dbname)

        cr.close()

#----------------------------------------------------------
# translation stuff
#----------------------------------------------------------
if tools.config["translate_out"]:
    import csv

    if tools.config["language"]:
        msg = "language %s" % (tools.config["language"],)
    else:
        msg = "new language"
    logger.info('writing translation file for %s to %s', msg, tools.config["translate_out"])

    fileformat = os.path.splitext(tools.config["translate_out"])[-1][1:].lower()
    buf = file(tools.config["translate_out"], "w")
    dbname = tools.config['db_name']
    cr = pooler.get_db(dbname).cursor()
    tools.trans_export(tools.config["language"], tools.config["translate_modules"] or ["all"], buf, fileformat, cr)
    cr.close()
    buf.close()

    logger.info('translation file written successfully')
    sys.exit(0)

if tools.config["translate_in"]:
    context = {'overwrite': tools.config["overwrite_existing_translations"]}
    dbname = tools.config['db_name']
    cr = pooler.get_db(dbname).cursor()
    tools.trans_load(cr,
                     tools.config["translate_in"],
                     tools.config["language"],
                     context=context)
    tools.trans_update_res_ids(cr)
    cr.commit()
    cr.close()
    sys.exit(0)

#----------------------------------------------------------------------------------
# if we don't want the server to continue to run after initialization, we quit here
#----------------------------------------------------------------------------------
if tools.config["stop_after_init"]:
    sys.exit(0)


#----------------------------------------------------------
# Launch Servers
#----------------------------------------------------------

LST_SIGNALS = ['SIGINT', 'SIGTERM']

SIGNALS = dict(
    [(getattr(signal, sign), sign) for sign in LST_SIGNALS]
)

netsvc.quit_signals_received = 0

def handler(signum, frame):
    """
    :param signum: the signal number
    :param frame: the interrupted stack frame or None
    """
    netsvc.quit_signals_received += 1
    if netsvc.quit_signals_received > 1:
        sys.stderr.write("Forced shutdown.\n")
        os._exit(0)

def dumpstacks(signum, frame):
    # code from http://stackoverflow.com/questions/132058/getting-stack-trace-from-a-running-python-application#answer-2569696
    # modified for python 2.5 compatibility
    thread_map = dict(threading._active, **threading._limbo)
    id2name = dict([(threadId, thread.getName()) for threadId, thread in thread_map.items()])
    code = []
    for threadId, stack in sys._current_frames().items():
        code.append("\n# Thread: %s(%d)" % (id2name[threadId], threadId))
        for filename, lineno, name, line in traceback.extract_stack(stack):
            code.append('File: "%s", line %d, in %s' % (filename, lineno, name))
            if line:
                code.append("  %s" % (line.strip()))
    logging.getLogger('dumpstacks').info("\n".join(code))

for signum in SIGNALS:
    signal.signal(signum, handler)

if os.name == 'posix':
    signal.signal(signal.SIGQUIT, dumpstacks)

def quit():
    netsvc.Agent.quit()
    netsvc.Server.quitAll()
    if tools.config['pidfile']:
        os.unlink(tools.config['pidfile'])
    logger = logging.getLogger('shutdown')
    logger.info("Initiating OpenERP Server shutdown")
    logger.info("Hit CTRL-C again or send a second signal to immediately terminate the server...")
    logging.shutdown()

    # manually join() all threads before calling sys.exit() to allow a second signal
    # to trigger _force_quit() in case some non-daemon threads won't exit cleanly.
    # threading.Thread.join() should not mask signals (at least in python 2.5)
    for thread in threading.enumerate():
        if thread != threading.currentThread() and not thread.isDaemon():
            while thread.isAlive():
                # need a busyloop here as thread.join() masks signals
                # and would present the forced shutdown
                thread.join(0.05)
                time.sleep(0.05)
    sys.exit(0)

if tools.config['pidfile']:
    fd = open(tools.config['pidfile'], 'w')
    pidtext = "%d" % (os.getpid())
    fd.write(pidtext)
    fd.close()

netsvc.Server.startAll()

logger.info('OpenERP server is running, waiting for connections...')

while netsvc.quit_signals_received == 0:
    time.sleep(60)

quit()

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:


Top
 Profile  
 
 Post subject: Re: No module named lxml
PostPosted: Tue Feb 07, 2012 12:26 pm 
Offline

Joined: Tue Oct 18, 2011 8:52 am
Posts: 19
Location: Algiers
Oops sorry wrong file.

The file I was talking about is a bash script not a python script.


Top
 Profile  
 
 Post subject: Re: No module named lxml
PostPosted: Tue Feb 07, 2012 12:30 pm 
Offline

Joined: Mon Feb 06, 2012 4:37 pm
Posts: 19
Location: Iasi Romania
Don't understand what to look for


Top
 Profile  
 
 Post subject: Re: No module named lxml
PostPosted: Tue Feb 07, 2012 4:34 pm 
Offline

Joined: Tue Oct 18, 2011 8:52 am
Posts: 19
Location: Algiers
How do you launch openerp-server ?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 39 posts ]  Go to page 1, 2, 3  Next

All times are UTC + 2 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron

Protected by Anti-Spam ACP