No module named 'lxml.etree'

See original GitHub issue

I’m getting an No module named 'lxml.etree' issue. When built on codebuild vs codepipeline I don’t get this issue:

2018-09-01 17:05:15 Reading invoke payload from stdin (you can also pass it from file with --event)
2018-09-01 17:05:15 Invoking app.handler.handle (python3.6)
2018-09-01 17:05:15 Starting new HTTP connection (1): 169.254.169.254

Fetching lambci/lambda:python3.6 Docker container image......
2018-09-01 17:05:16 Mounting /Users/johria/Development/politics-explorer/apps/congressional-statements-scraper/build as /var/task:ro inside runtime container
START RequestId: 4388f94f-e7ad-41bb-a8a1-145076c354f6 Version: $LATEST
Unable to import module 'app.handler': No module named 'lxml.etree'
END RequestId: 4388f94f-e7ad-41bb-a8a1-145076c354f6
REPORT RequestId: 4388f94f-e7ad-41bb-a8a1-145076c354f6 Duration: 1398 ms Billed Duration: 1400 ms Memory Size: 128 MB Max Memory Used: 29 MB

{"errorMessage": "Unable to import module 'app.handler'"}

I download precompiled binaries for psycopg2 right now but I have not needed to do it for lxml. This looks like a difference between the docker-lambda image vs the real image.

Any ideas?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
jfusscommented, Jun 15, 2019

I just tried a simple function that has psycopg2-binary and lxml as a dependency in the requirements.txt file. I was able to import both in the function without the function crashing (complaining about not being importable). I did use sam build to build the function. So either docker-lambda solved this or sam build make it so you don’t need to worry about it. Either way, I can’t reproduce this issue.

Closing this as it seems to be resolved. If not, please cut a new issue.

0reactions
AlJohricommented, Dec 3, 2018

I just downloaded the precompiled binaries for lxml and got around the issue for sam build. I think they are still required locally (sam build) but not in prod but I have not checked since Sept.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ModuleNotFoundError: No module named 'lxml' in Python
The Python "ModuleNotFoundError: No module named 'lxml'" occurs when we forget to install the lxml module before importing it or install it in ......
Read more >
Installing lxml module in python - Stack Overflow
Just do: sudo apt-get install python-lxml. For Python 2 (e.g., required by Inkscape): sudo apt-get install python2-lxml. If you are planning to install...
Read more >
No module named 'lxml.etree' · Issue #18 · lil-lab/newsroom
When running newsroom-scrape cmd, I got this error : ModuleNotFoundError: No module named 'lxml.etree' Full stack : Traceback (most recent ...
Read more >
Installing lxml
lxml is generally distributed through PyPI. Most Linux platforms come with some version of lxml readily packaged, usually named python-lxml for the Python...
Read more >
No module named 'lxml' - Beyond the Basics - Inkscape Forum
To make it short, it means that you lacked some "dependencies" for the libraries you wanted to use. This is a common problem...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found