0

I am trying to use Pandas to get the table from the web The first error I encounter is "lxml not found, please install it", after the installation through the terminal, I keep getting the error above. And the strange part is that when I try to use jupyter lite the same Error, "lxml not found, please install it", appears as well.

I try everything, from installing it in different ways, uninstalling python and pycharm, I try using homebrew but i can't make it work either. My os is MacOS maybe that is part of the problem but honestly am going crazy.

  • 1
    there should be longer error, right? that would be easier to detect problem. does this help you?, [Python ImportError lxml not found please install it](https://stackoverflow.com/questions/44954802/python-importerror-lxml-not-found-please-install-it) – Krittipoom Apr 21 '23 at 04:46

2 Answers2

0

This is not a direct answer about the 'lxml' package, but I suggest checking which Python binary you are using.

In my experience, a similar issue occurs when I install packages to one binary (for example, '/usr/bin/python') but a different binary is used when running the code (for example, '/Users/username/anaconda3/bin/python').

The easiest way to check which binary you are using is:

A. In a shell:

$ which python

B. In Python (code or interpreter):

>> import sys; sys.executable

A and B might be different.

Check that first, and if that's the case, you may select the python binary by making symlink or specifying absolute python path, or consider using python version manager like pyenv.

lxpdldd
  • 1
  • 1
0

I've run into a similar issue recently while installing a package that depends on ```lxml``, and I shared what helped me resolve the issue below.

The lxml package seems to cause such errors when Xcode Command Line Tools are not correctly installed or some paths are missing/broken. First, I'd suggest checking if you have Xcode installed on your MacOS device.

$ xcode-select --install

The command above will install the required packages if not installed already. If you receive the error xcode-select: error: command line tools are already installed, use "Software Update" to install updates, try resetting Xcode Command Line Tools as follows. It will reset the path to the Xcode Command Line Tools directory, which may help with the issue.

$ sudo xcode-select --reset

After you install/update Xcode Command Line Tools, try installing lxml separately to see if your issue is resolved.

$ pip install lxml
bkaankuguoglu
  • 1,192
  • 1
  • 13
  • 33