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

Unable to install lxml on M1 mac #16

Closed
transcendr opened this issue Apr 1, 2023 · 10 comments
Closed

Unable to install lxml on M1 mac #16

transcendr opened this issue Apr 1, 2023 · 10 comments

Comments

@transcendr
Copy link

transcendr commented Apr 1, 2023

This install throws a couple different errors.

I tried another suggestion which gives the same result arch -x86_64 pip3 install lxml

python 3.8.9

any ideas?

Building wheel for lxml (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /Applications/Xcode.app/Contents/Developer/usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/z9/v8hgfs2527j8t9pv656k580w0000gn/T/pip-install-udz7nb_q/lxml/setup.py'"'"'; __file__='"'"'/private/var/folders/z9/v8hgfs2527j8t9pv656k580w0000gn/T/pip-install-udz7nb_q/lxml/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/z9/v8hgfs2527j8t9pv656k580w0000gn/T/pip-wheel-d6m9houy
       cwd: /private/var/folders/z9/v8hgfs2527j8t9pv656k580w0000gn/T/pip-install-udz7nb_q/lxml/
  Complete output (117 lines):
  Building lxml version 4.9.2.
  Building without Cython.
  Building against libxml2 2.9.4 and libxslt 1.1.29
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.14-arm64-3.8
  creating build/lib.macosx-10.14-arm64-3.8/lxml
@Torantulino
Copy link
Member

Torantulino commented Apr 1, 2023

I don't personally know anything about Mac. Here's what the AI says. Follow its advice at your own risk! :

The issue seems to be caused by the installation of the lxml package, not the code you have provided. The problem is related to building the package on your system, which might be caused by a missing or incompatible version of a required dependency.

Please try the following steps:

  1. First, make sure you have installed the required dependencies: libxml2 and libxslt:

    If you are using macOS, you can install these dependencies using Homebrew with the following commands:

    brew install libxml2
    brew install libxslt
    

    If you are using a Linux distribution, use the package manager for your distribution (e.g., apt-get, yum, pacman, etc.) to install libxml2 and libxslt.

  2. Make sure you have lxml version that match your python version

    You can try installing a different version of the package, based on your Python version. For example, if you are using Python 3.8, you can try:

    pip install lxml==4.9.2
    

@transcendr
Copy link
Author

transcendr commented Apr 1, 2023

Hi, thanks for your quick response. In the meantime I was doing some additional troubleshooting and eventually got it working. Here's the steps I took:

  1. upgraded from python 3.8.9 to 3.11 ( brew update && brew install [email protected] )
  2. with that version of python I was able to install lxml without issue
  3. However upon running -r req's again, I had errors from dependency conflicts. I resolved those by using the suggested compatible versions, where final version of req's.txt looks like:
 1 ~ │ beautifulsoup4==4.9.3
   2   │ colorama==0.4.6
   3   │ googlesearch_python==1.1.0
   4   │ openai==0.27.0
   5   │ playsound==1.2.2
   6   │ readability_lxml==0.8.1
   7 ~ │ requests==2.25.1

(excuse the formatting, I bat'd it)

An install from there worked and the system is so far running. Will report back if anything comes up. That said one thing I immediately noticed is that my AI had a step where an agent was to be created. There are two options y (to proceed) and the other to exit. Another option e to open the proposed agent creation command (or any command) and it edit in the default $EDITOR would be awesome. It would be useful to tweak instructions to the agent that are slightly wrong. Anyway, thanks again for your work on this. So far, it looks very interesting.

@Torantulino
Copy link
Member

Torantulino commented Apr 1, 2023

Glad you got it working, thanks for such a detailed response, that's really helpful.
Okay, looks like I need to update the requirements.txt

Tasks from this issue:

  • Update requirements.txt
  • Suggest Python update?
  • Add troubleshooting section?

As for your suggestion, I love it! Someone has recently suggested something similar #13 , so I think I'll be able to kill two birds with one stone here. I'll get right onto implementing that after I push the big scary feature I'm currently working on...
AI CODE EXECUTION

@transcendr
Copy link
Author

Wow dude you rock. You seem super motivated. I'm really excited for where this could go. Hopefully I'll have some time to contribute sooner than later.

Cheers.

@Torantulino
Copy link
Member

Thank you! If you get a chance, please share outputs of the program running in discussions!
It would be great to see people other than myself executing it.

Oh wow, a code contribution would be incredible. 🙏

Thanks for the kind words. 😊

@danielraffel
Copy link

on macOS - when I run python main.py I get these errors

Traceback (most recent call last):
File "/Users/username/Auto-GPT/scripts/main.py", line 3, in
import commands as cmd
File "/Users/username/Auto-GPT/scripts/commands.py", line 1, in
import browse
File "/Users/username/Auto-GPT/scripts/browse.py", line 1, in
from googlesearch import search
ModuleNotFoundError: No module named 'googlesearch

FWIW I do have Requirement already satisfied: googlesearch_python in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from -r requirements.txt (line 4)) (1.1.0)

would love to try this again perhaps when these are updated
#16 (comment)

@microfx
Copy link

microfx commented Apr 9, 2023

oh god... I'm again in python env version hell AAAAAAAAAAHHHHHHHHHHHH ... I have like 5 python versions installed – I will never understand how to manage this ... sad day for me.

@ngmisl ngmisl mentioned this issue Apr 16, 2023
1 task
@kwikcoins kwikcoins mentioned this issue Apr 17, 2023
2 tasks
@bjm88 bjm88 mentioned this issue Apr 27, 2023
1 task
johnseth97 pushed a commit to johnseth97/Auto-GPT that referenced this issue May 3, 2023
waynehamadi added a commit that referenced this issue Sep 5, 2023
Say383 referenced this issue in Say383/Auto-GPT Sep 8, 2023
…t on the command line, fix logging (#16)

* Removed submodule, refactor, docker on pip, async docker logging, running our own tool on CLI rather than OpenAIs
@SurpriseMF3000
Copy link

  1. upgraded from python 3.8.9 to 3.11 ( brew update && brew install [email protected] )

Worked for me;)

@basit26374
Copy link

basit26374 commented Dec 20, 2023

I resolved the issue by upgrading my Python version from 3.8 to 3.11.
brew update && brew install [email protected]

Thanks @transcendr

@raj-333
Copy link

raj-333 commented Feb 2, 2024

I have done using below commands and worked well,

python 3.12,
pip3 uninstall lxml
arch -x86_64 pip3 install lxml (m1 mac and chip)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants