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

ImportError: cannot import name 'etree' from 'lxml' #196

Closed
kozerskil opened this issue May 24, 2022 · 2 comments
Closed

ImportError: cannot import name 'etree' from 'lxml' #196

kozerskil opened this issue May 24, 2022 · 2 comments
Labels
stale There has not been activity on this issue or PR for quite some time.

Comments

@kozerskil
Copy link

kozerskil commented May 24, 2022

Problem/Motivation

I'm trying to install myfitnesspal and getting the error:
ImportError: cannot import name 'etree' from 'lxml' (/usr/lib/python3.9/site-packages/lxml/init.py)

Actual behavior

2022-05-24 12:49:08.379061 WARNING Error: ------------------------------------------------------------
2022-05-24 12:49:08.441239 WARNING Error: Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/appdaemon/app_management.py", line 993, in check_app_updates
    await utils.run_in_executor(self, self.read_app, mod["name"], mod["reload"])
  File "/usr/lib/python3.9/site-packages/appdaemon/utils.py", line 337, in run_in_executor
    response = future.result()
  File "/usr/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/lib/python3.9/site-packages/appdaemon/app_management.py", line 784, in read_app
    self.modules[module_name] = importlib.import_module(module_name)
  File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/config/appdaemon/apps/weight.py", line 2, in <module>
    import myfitnesspal
  File "/usr/lib/python3.9/site-packages/myfitnesspal/__init__.py", line 1, in <module>
    from myfitnesspal.client import Client  # noqa
  File "/usr/lib/python3.9/site-packages/myfitnesspal/client.py", line 10, in <module>
    import lxml.html
  File "/usr/lib/python3.9/site-packages/lxml/html/__init__.py", line 53, in <module>
    from .. import etree
ImportError: cannot import name 'etree' from 'lxml' (/usr/lib/python3.9/site-packages/lxml/__init__.py)
2022-05-24 12:49:08.442924 WARNING Error: ------------------------------------------------------------

Steps to reproduce

My configuration:

init_commands:
  - pip freeze
python_packages:
  - myfitnesspal
system_packages:
  - py3-wheel

freeze result:

aiodns==3.0.0
aiohttp==3.8.1
aiohttp-jinja2==1.5
aiosignal==1.2.0
appdaemon==4.2.1
appdirs==1.4.4
asn1crypto==1.4.0
astral==2.2
async-timeout==4.0.2
attrs==21.4.0
azure-common==1.1.28
azure-core==1.23.0
azure-keyvault-secrets==4.3.0
azure-mgmt-compute==23.1.0
azure-mgmt-core==1.3.0
azure-mgmt-resource==20.0.0
azure-mgmt-storage==19.0.0
azure-storage-blob==12.9.0
bcrypt==3.2.0
bidict==0.21.4
blessed==1.19.1
CacheControl==0.12.10
cchardet==2.1.7
certifi==2020.12.5
cffi==1.14.5
charset-normalizer==2.0.7
colorama==0.4.4
commonmark==0.9.1
contextlib2==21.6.0
cryptography==3.3.2
deepdiff==5.7.0
distlib==0.3.3
distro==1.6.0
feedparser==6.0.8
frozenlist==1.3.0
html5lib==1.1
idna==3.3
iso8601==1.0.2
isodate==0.6.1
jeepney==0.8.0
Jinja2==3.0.3
keyring==21.8.0
lockfile==0.12.2
lxml==4.8.0
MarkupSafe==2.1.0
measurement==3.2.0
mpmath==1.2.1
msgpack==1.0.2
msrest==0.6.21
multidict==6.0.2
myfitnesspal==1.17.0
oauthlib==3.2.0
ordered-set==4.0.2
packaging==20.9
paho-mqtt==1.6.1
pep517==0.12.0
pid==3.0.4
progress==1.6
pycares==4.1.2
pycparser==2.20
Pygments==2.10.0
pyparsing==2.4.7
python-dateutil==2.8.2
python-engineio==4.3.0
python-socketio==5.5.0
pytz==2021.3
PyYAML==6.0
requests==2.26.0
requests-oauthlib==1.3.1
retrying==1.3.3
rich==9.13.0
SecretStorage==3.3.2
sgmllib3k==1.0.0
six==1.16.0
sockjs==0.11.0
sympy==1.10.1
toml==0.10.2
tomli==1.2.2
typing-extensions==3.10.0.2
urllib3==1.26.7
uvloop==0.16.0
voluptuous==0.12.2
wcwidth==0.2.5
webencodings==0.5.1
websocket-client==1.2.3
yarl==1.7.2
@kozerskil
Copy link
Author

With a simple configuration:

init_commands:
  - pip freeze
python_packages:
  - lxml
system_packages: []

this simple script has same error:

import lxml.html

@github-actions
Copy link

There hasn't been any activity on this issue recently, so we clean up some of the older and inactive issues.
Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thanks!

@github-actions github-actions bot added the stale There has not been activity on this issue or PR for quite some time. label Jun 24, 2022
@github-actions github-actions bot closed this as completed Jul 1, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Jul 31, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
stale There has not been activity on this issue or PR for quite some time.
Projects
None yet
Development

No branches or pull requests

1 participant