skip to Main Content

I am getting the error zsh: illegal hardware instruction if I try to use the request-html module.

2

Answers


  1. Chosen as BEST ANSWER

    I solved it by creating a virtual environment on Python. The error disappears if you install your modules including request-html into a virtual environment.


  2. I’ve been working with an Apple M1 since last month, and I have not seen this behavior.

    My setup is the following:

    1 - I  have [Pyenv][1], a python version manager. 
    
    2 - I always use a virtual environment, since you should avoid 
    installing libraries and changing the root python in your computer. 
    
    3 - I have requests always on the last version >. 2.28, since M1 is new hardware, and It can cause trouble in versions for other hardware. 
    

    I really recommend you use the same setup since it will preserve your python root and also avoid these problems.

    So, try the following:
    1 – install pyenv
    2 – Install python 3.10 or > versions, using pyenv.
    3 – Install python venv
    4 – create a virtual environment, and install requests
    5 – Run your code, using the virtual environment, and check if it solves your problem.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search