Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: requirements: No module named yaml and elftools #6866

Closed
qianfan-Zhao opened this issue Mar 31, 2018 · 6 comments
Closed

build: requirements: No module named yaml and elftools #6866

qianfan-Zhao opened this issue Mar 31, 2018 · 6 comments
Labels
bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug

Comments

@qianfan-Zhao
Copy link
Collaborator

qianfan-Zhao commented Mar 31, 2018

I am installing zephyr to a new ubuntu server according to this guide: Development Environment Setup on Linux. I had install additional packages by using this command:

pip3 install --user -r scripts/requirements.txt

after that i try compile a hello_world example for frdm_k64f,

$ cmake -DBOARD=frdm_k64f ../..
-- Generating zephyr/include/generated/generated_dts_board.h
Traceback (most recent call last):
  File "/home/qianfan/zephyr/scripts/dts/extract_dts_includes.py", line 14, in <module>
    import yaml
ImportError: No module named 'yaml'
CMake Error at /home/qianfan/zephyr/cmake/dts.cmake:121 (message):
  command failed with return code: 1
Call Stack (most recent call first):
  /home/qianfan/zephyr/cmake/app/boilerplate.cmake:260 (include)
  CMakeLists.txt:2 (include)

the build system complained that can't find yaml. so i install python3-yaml using apt-get. after that cmake generated Makefile successful. Unfortunately make can't find 'elftools':

ImportError: No module named 'elftools'
zephyr/CMakeFiles/offsets_h.dir/build.make:60: recipe for target 'zephyr/include/generated/offsets.h' failed

may be we forget add 'yaml' and 'elftools' in scripts/requirements ?

@qianfan-Zhao qianfan-Zhao changed the title build: requirements: No module named yaml build: requirements: No module named yaml and elftools Mar 31, 2018
@nashif nashif added the bug The issue is a bug, or the PR is fixing a bug label Apr 2, 2018
@nashif
Copy link
Member

nashif commented Apr 2, 2018

Your python installation is not working correctly, i.e. when you install with pip3 install --user it does install libraries in your home directory, the installation path seems not to be in your python path

@nashif nashif added the priority: low Low impact/importance bug label Apr 2, 2018
@nashif
Copy link
Member

nashif commented May 5, 2018

works here.

@nashif nashif closed this as completed May 5, 2018
@SebastianBoe
Copy link
Collaborator

This error message might occur if the wrong requirements.txt file is used.

e.g.

pip3 install --user -r scripts/py2-requirements.txt

vs.

pip3 install --user -r scripts/requirements.txt

@mplebanski
Copy link

mplebanski commented Dec 20, 2018

For those using virtualenv and still having this, make sure that you have sourced your virtual environment before running cmake -GNninja -DBOARD=your_board .., otherwise ninja will generate build scripts for your default system interpreter. If that already happened just remove the build directory and run cmake again with already environment sourced. I consider is useful also for people hitting #1392.

@avisconti
Copy link
Collaborator

avisconti commented Apr 10, 2019

I had same issue this week myself, as I was forced to completely re-install a linux workstation (Ubuntu 16)
and to go again through the process of setting up the zephyr toolchain.

Few comments that may help other people in the future:

What I needed to do was to call following command from zephyr HOME:

pip3 install --user -r scripts/requirements.txt
-- or (better for my case) --
python3 -m pip install --user --upgrade -r scripts/requirements.txt

I had to solve following issues:

  1. http_proxy issues: I had '/' character in the pwd and phyton was not able to parse it.
    So, I changed the proxy password to avoid such character.

  2. I had to upgrade setuptools:
    python3 -m pip install --user --upgrade setuptools

  3. I finally ran
    python3 -m pip install --user --upgrade -r scripts/requirements.txt

EDIT::
After solving 1 but prior to install using the scripts/requirements.txt I was able to install
yaml end elftools also in following way:

python3 -m pip install --user pyelftools
python3 -m pip install --user PyYAML

But in this case the version was little bit older than requirements.

@StefanHri
Copy link

I have a similar issue. Even when I do everything as suggested by @avisconti I still get:

CMake Error at /home/stefan/workspaces/zephyrproject/zephyrproject/zephyr/cmake/zephyr_module.cmake:45 (message):
  Traceback (most recent call last):

    File "/home/stefan/workspaces/zephyrproject/zephyrproject/zephyr/scripts/zephyr_module.py", line 18, in <module>
      import yaml

  ImportError: No module named 'yaml'

Call Stack (most recent call first):
  /home/stefan/workspaces/zephyrproject/zephyrproject/zephyr/cmake/app/boilerplate.cmake:429 (include)
  CMakeLists.txt:7 (include)


-- Configuring incomplete, errors occurred!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug
Projects
None yet
Development

No branches or pull requests

6 participants