starkware-libs / cairo-lang

Apache License 2.0
1.33k stars 260 forks source link

Does `pip3 install cairo-lang` fail depending on Python version? #42

Open adust09 opened 2 years ago

adust09 commented 2 years ago

I tried this page https://www.cairo-lang.org/docs/quickstart.html

but I failed pip3 install cairo-lang

environment

Python 3.7.13 Mac OS Montery(v12.3) Applle Silicon

error message

❯ pip3 install cairo-lang

Collecting cairo-lang
  Using cached cairo-lang-0.8.0.zip (882 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [1 lines of output]
      ERROR: Can not execute `setup.py` since setuptools is not available in the build environment.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

what I did upgrade setuptools by this

pip3 install --upgrade setuptools -> did't work well

next, I try to downgrade python version, but it can't work any versions... (Ignore this issue as I don't think it is directly related to cairo.)

If you were able to install cairo-lang on another Python 3.7 series, I would appreciate it if you could tell me the version.

for example v 3.7.5

❯ pyenv install 3.7.5
python-build: use openssl@1.1 from homebrew
python-build: use readline from homebrew
Downloading Python-3.7.5.tar.xz...
-> https://www.python.org/ftp/python/3.7.5/Python-3.7.5.tar.xz
Installing Python-3.7.5...
python-build: use readline from homebrew
python-build: use zlib from xcode sdk

BUILD FAILED (OS X 12.3 using python-build 20180424)

Inspect or clean up the working tree at /var/folders/x1/jhqvlmx964z9_x4mqg7g_l040000gn/T/python-build.20220324143851.18869
Results logged to /var/folders/x1/jhqvlmx964z9_x4mqg7g_l040000gn/T/python-build.20220324143851.18869.log

Last 10 log lines:
checking for --with-cxx-main=<compiler>... no
checking for clang++... no
configure:

  By default, distutils will build C++ extension modules with "clang++".
  If this is not intended, then set CXX on the configure command line.

checking for the platform triplet based on compiler characteristics... darwin
configure: error: internal configure error for the platform triplet, please file a bug report
make: *** No targets specified and no makefile found.  Stop.

~/cairo_practice main* 14s
SheldonHolmgren commented 1 year ago

What worked for me was

pip uninstall setuptools
pip install setuptools
pip install cairo-lang

Originally I managed to install cairo-lang without problem on Python 3.10 but I had to create a virtualenv with a lower version because the API of the collections module has changed with 3.10 and cairo-compile depends on the older version.