Search code examples
pythonpackagebitbakeopenembedded

ImportError: No module named bb


To create a helloworld .ipk package, as described here, I cloned bitbake and OpenEmbedded as

git clone git://git.openembedded.org/bitbake
git clone git://git.openembedded.org/openembedded

Then exported following varibales

export OEBASE=/media/sda3/open_env/
export PATH=$OEBASE/bitbak/ebin:$PATH
export BBPATH=$OEBASE/build:$OEBASE/openembedded
export BB_ENV_EXTRAWHITE="OEBASE"

When I run following command I get error given below:

bitbake -b packages/myhelloworld/myhelloworld_0.1.bb

Traceback (most recent call last):
  File "/usr/bin/bitbake", line 35, in <module>
    import bb
ImportError: No module named bb

I am doing this on ubuntu 10.04. What I am missing here?

EDIT:

As given in answer, I executed following commands and getting error as given below:

git clone git://git.openembedded.org/openembedded-core
cd openembedded-core
git clone git://git.openembedded.org/bitbake

cd ..
git checkout dylan
cd bitbake
git checkout 1.18
cd ..

. oe-init-build-env

Modified build/conf/local.conf and created myhelloworld dir in openembedded-core/build/ dir and then executed

bitbake myhelloworld/

I am getting errors as:

Traceback (most recent call last):
  File "/media/sda3/open_env/openembedded-core/bitbake/bin/bitbake", line 34, in <module>
    import bb
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/__init__.py", line 77, in <module>
    from bb import fetch2 as fetch
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/fetch2/__init__.py", line 38, in <module>
    import bb.persist_data, bb.utils
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/persist_data.py", line 35, in <module>
    from pysqlite2 import dbapi2 as sqlite3
ImportError: No module named pysqlite2
/media/sda3/open_env/openembedded-core/bitbake/lib/bb/event.py:104: RuntimeWarning: Parent module 'bb' not found while handling absolute import
  from bb.msg import BBLogFormatter
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/home/python-2.7.3/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/event.py", line 104, in print_ui_queue
    from bb.msg import BBLogFormatter
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/__init__.py", line 77, in <module>
    from bb import fetch2 as fetch
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/fetch2/__init__.py", line 38, in <module>
    import bb.persist_data, bb.utils
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/persist_data.py", line 35, in <module>
    from pysqlite2 import dbapi2 as sqlite3
ImportError: No module named pysqlite2
Error in sys.exitfunc:
Traceback (most recent call last):
  File "/home/python-2.7.3/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/event.py", line 104, in print_ui_queue
    from bb.msg import BBLogFormatter
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/__init__.py", line 77, in <module>
    from bb import fetch2 as fetch
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/fetch2/__init__.py", line 38, in <module>
    import bb.persist_data, bb.utils
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/persist_data.py", line 35, in <module>
    from pysqlite2 import dbapi2 as sqlite3
ImportError: No module named pysqlite2
Pseudo is not present but is required, building this first before the main build
Traceback (most recent call last):
  File "/media/sda3/open_env/openembedded-core/bitbake/bin/bitbake", line 34, in <module>
    import bb
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/__init__.py", line 77, in <module>
    from bb import fetch2 as fetch
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/fetch2/__init__.py", line 38, in <module>
    import bb.persist_data, bb.utils
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/persist_data.py", line 35, in <module>
    from pysqlite2 import dbapi2 as sqlite3
ImportError: No module named pysqlite2
/media/sda3/open_env/openembedded-core/bitbake/lib/bb/event.py:104: RuntimeWarning: Parent module 'bb' not found while handling absolute import
  from bb.msg import BBLogFormatter
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/home/python-2.7.3/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/event.py", line 104, in print_ui_queue
    from bb.msg import BBLogFormatter
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/__init__.py", line 77, in <module>
    from bb import fetch2 as fetch
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/fetch2/__init__.py", line 38, in <module>
    import bb.persist_data, bb.utils
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/persist_data.py", line 35, in <module>
    from pysqlite2 import dbapi2 as sqlite3
ImportError: No module named pysqlite2
Error in sys.exitfunc:
Traceback (most recent call last):
  File "/home/python-2.7.3/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/event.py", line 104, in print_ui_queue
    from bb.msg import BBLogFormatter
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/__init__.py", line 77, in <module>
    from bb import fetch2 as fetch
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/fetch2/__init__.py", line 38, in <module>
    import bb.persist_data, bb.utils
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/persist_data.py", line 35, in <module>
    from pysqlite2 import dbapi2 as sqlite3
ImportError: No module named pysqlite2
Traceback (most recent call last):
  File "/media/sda3/open_env/openembedded-core/bitbake/bin/bitbake", line 34, in <module>
    import bb
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/__init__.py", line 77, in <module>
    from bb import fetch2 as fetch
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/fetch2/__init__.py", line 38, in <module>
    import bb.persist_data, bb.utils
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/persist_data.py", line 35, in <module>
    from pysqlite2 import dbapi2 as sqlite3
ImportError: No module named pysqlite2
/media/sda3/open_env/openembedded-core/bitbake/lib/bb/event.py:104: RuntimeWarning: Parent module 'bb' not found while handling absolute import
  from bb.msg import BBLogFormatter
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/home/python-2.7.3/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/event.py", line 104, in print_ui_queue
    from bb.msg import BBLogFormatter
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/__init__.py", line 77, in <module>
    from bb import fetch2 as fetch
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/fetch2/__init__.py", line 38, in <module>
    import bb.persist_data, bb.utils
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/persist_data.py", line 35, in <module>
    from pysqlite2 import dbapi2 as sqlite3
ImportError: No module named pysqlite2
Error in sys.exitfunc:
Traceback (most recent call last):
  File "/home/python-2.7.3/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/event.py", line 104, in print_ui_queue
    from bb.msg import BBLogFormatter
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/__init__.py", line 77, in <module>
    from bb import fetch2 as fetch
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/fetch2/__init__.py", line 38, in <module>
    import bb.persist_data, bb.utils
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/persist_data.py", line 35, in <module>
    from pysqlite2 import dbapi2 as sqlite3
ImportError: No module named pysqlite2

Solution

  • You're mixing a recent bitbake with OpenEmbedded classic; please don't do that. You're also trying to setup the build environment by hand, avoid that one too. Any new development should be based on OpenEmbedded Core.

    What you should do:

    1. Clone the repositories.

      git clone git://git.openembedded.org/openembedded-core
      cd openembedded-core
      git clone git://git.openembedded.org/bitbake
      

      If you want to use a certain branch, eg jethro

      git checkout jethro
      cd bitbake
      git checkout 1.28
      cd ..
      

      See corresponding release branches of OE-core and bitbake.

    2. Setup the build environment:

      . oe-init-build-env
      
    3. Configure the build.

      I.e. set the correct machine etc. in build/conf/local.conf.

    4. Build!

      Now do you what you want, e.g. any of:

      bitbake core-image-minimal
      bitbake myehelloworld
      

    Update: Note that the last release (of Poky, that officially was tested against Ubuntu 10.04 was Dylan). Later releases might very well have issues on that host, I'd recommend to update to a newer LTS-release.

    Update 2: Your new error says ImportError: No module named pysqlite2. Bitbake will first look for sqlite3. Install that on your build-host apt-get install libsqlite3-dev