ERROR: Could not build wheels for lxml, which is required to install pyproject.toml-based projects
Asked Answered
D

5

7

I'm new with python and im trying to install the module of yfinance for my uni class, but I keep getting this error when trying to install it... anyone knows how to solve this problem?enter image description here

Wanted to install yfinance module because when I try to install it in vs code i get the following error: ModuleNotFoundError: No module named 'yfinance

Debit answered 6/6, 2023 at 22:25 Comment(1)
Please don't post pictures of text -- include the text itself directly in the question (formatted as a code sample). The error message asks a pertinent question ("Is libxml2 installed?"). If you're not sure how to answer that question, please give us more information about your environment (such as what OS/distribution you're using).Lomalomas
B
13

This issue is getting resolved for me after doing the upgrade for setuptools.

pip install --upgrade setuptools

pip install lxml

I am using the python version 3.8.16. Hope this helps.

Biancabiancha answered 1/8, 2023 at 3:58 Comment(1)
I'm on 3.8.2 and it did not workMeneau
A
2

pip install lxml==4.8.0

Try to install lxml 4.8 instead of lxml 4.9. Version 4.9 has this issue

Addend answered 20/9, 2023 at 6:23 Comment(0)
A
2

Updating Python to 3.11 did it for me!

brew update && brew install [email protected] 
Attached answered 1/10, 2023 at 16:8 Comment(1)
Downgrading from 3.12 to 3.11 worked for me.Coenocyte
F
0

The lxml package seems to cause such errors when Xcode Command Line Tools are not correctly installed or some paths are missing/broken. As implied in your terminal, first try:

$ 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
Freezedry answered 18/6, 2023 at 12:12 Comment(1)
It did not work. I'm on 3.8.2Meneau
L
0

I was trying to install a library that has lxml as a dependency and faced the same issue. Since I am using Conda, I executed the following command:

conda install -c anaconda lxml

This command instructs Conda to install the lxml package from the official Anaconda channel. It resolved the issue for me. I hope it helps you as well.

Luckless answered 31/12, 2023 at 18:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.