semgrep/semgrep

Python 3.12 support when installing with `uv`

codeinthehole opened this issue · 1 comments

This is probably more of a question than an official bug.

Symptoms

It's not possible to install a working version of semgrep>=1.90 using uv in a Python 3.12 virtualenv on ARM architecture operating system (e.g. MacOS Silicon).

Semgrep does install but running it yields an OSError:

> semgrep
Traceback (most recent call last):
  File "~/.virtualenvs/testing/bin/semgrep", line 178, in <module>
    exec_osemgrep()
  File "~/.virtualenvs/testing/bin/semgrep", line 159, in exec_osemgrep
    os.execvp(str(path), sys.argv)
  File "<frozen os>", line 580, in execvp
  File "<frozen os>", line 603, in _execvpe
OSError: [Errno 8] Exec format error

Steps to reproduce

Create a Python 3.12 virtualenv using your favourite means. Here I'm using pyenv and pyenv-virtualenvwrapper

$ pyenv local 3.12
$ mkvirtualenv demo

Ensure uv is installed as a system dependency. Here I'm using pipx:

$ pipx install uv==0.4.18

Install semgrep into the virtualenv using uv:

$ uv pip install semgrep==1.90

Run semgrep:

$ semgrep --help
Traceback (most recent call last):
  File "/Users/david.winterbottom/.virtualenvs/demo/bin/semgrep", line 178, in <module>
    exec_osemgrep()
  File "/Users/david.winterbottom/.virtualenvs/demo/bin/semgrep", line 159, in exec_osemgrep
    os.execvp(str(path), sys.argv)
  File "<frozen os>", line 609, in execvp
  File "<frozen os>", line 632, in _execvpe
OSError: [Errno 8] Exec format error

Same behaviour when using --no-cache to install too.

Actually, ignore me - this issue goes away when using uv==0.4.19