Thriftpy / thriftpy2

Pure python approach of Apache Thrift.
MIT License
572 stars 91 forks source link

Cannot pip install thriftpy2 on Colab #223

Closed zhilu1 closed 1 year ago

zhilu1 commented 1 year ago

pip install thriftpy2 on Google colab failed.

Error Info:

Collecting thriftpy2
  Using cached thriftpy2-0.4.16.tar.gz (643 kB)
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> See above for output.

  note: This error originates from a subprocess, and is likely not a problem with pip.
  Preparing metadata (setup.py) ... error
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.
aisk commented 1 year ago

Unless you provide the actual error log, we cannot provide any help.

zhilu1 commented 1 year ago

Unless you provide the actual error log, we cannot provide any help.

That's the error message I got in Google Colab, I don't know where else I can get a log.

For reproduction, enter pip install thriftpy2 on Google colab notebook cell.

图片

aisk commented 1 year ago

Sorry, I can't reproduce the issue.

PDXDJN commented 1 year ago

I get the same error.
IMG_1310

so, I tried installing all recent thriftpy2 versions directly, and none of them work: IMG_1309 It was working without issue until about a week ago.

aisk commented 1 year ago

What's the pip / setuptools / python version?

PDXDJN commented 1 year ago

python 3.10.12 pip 23.1.2 setuptools 67.7.2

aisk commented 1 year ago

Tried the pip / setuptools with provides versions combination, still can't reproduce the issue. I don't have a access for the colab, if some one knows the different between it and a linux environment, please point out.

aisk commented 1 year ago

Some one provided me a Google colab access, and after running pip install thriftpy2 -v, the error log is:


Using pip 23.1.2 from /usr/local/lib/python3.10/dist-packages/pip (python 3.10)
Collecting thriftpy2
  Using cached thriftpy2-0.4.16.tar.gz (643 kB)
  Running command python setup.py egg_info
  /usr/local/lib/python3.10/dist-packages/Cython/Compiler/Main.py:384: FutureWarning: Cython directive 'language_level' not set, using '3str' for now (Py3). This has changed from earlier releases! File: /tmp/pip-install-smk5791j/thriftpy2_5bfb8ae99c874dad96e90a45ca1df5fa/thriftpy2/transport/cybase.pxd
    tree = Parsing.p_module(s, pxd, full_module_name)

  Error compiling Cython file:
  ------------------------------------------------------------
  ...

      cdef int grow(self, int min_size):
          if min_size <= self.buf_size:
              return 0

          cdef int multiples = min_size / self.buf_size
                                        ^
  ------------------------------------------------------------

  thriftpy2/transport/cybase.pyx:90:38: Cannot assign type 'double' to 'int'
  Traceback (most recent call last):
    File "<string>", line 2, in <module>
    File "<pip-setuptools-caller>", line 34, in <module>
    File "/tmp/pip-install-smk5791j/thriftpy2_5bfb8ae99c874dad96e90a45ca1df5fa/setup.py", line 61, in <module>
      cythonize("thriftpy2/transport/cybase.pyx")
    File "/usr/local/lib/python3.10/dist-packages/Cython/Build/Dependencies.py", line 1134, in cythonize
      cythonize_one(*args)
    File "/usr/local/lib/python3.10/dist-packages/Cython/Build/Dependencies.py", line 1301, in cythonize_one
      raise CompileError(None, pyx_file)
  Cython.Compiler.Errors.CompileError: thriftpy2/transport/cybase.pyx
  Compiling thriftpy2/transport/cybase.pyx because it changed.
  [1/1] Cythonizing thriftpy2/transport/cybase.pyx
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> See above for output.

  note: This error originates from a subprocess, and is likely not a problem with pip.
  full command: /usr/bin/python3 -c '
  exec(compile('"'"''"'"''"'"'
  # This is <pip-setuptools-caller> -- a caller that pip uses to run setup.py
  #
  # - It imports setuptools before invoking setup.py, to enable projects that directly
  #   import from `distutils.core` to work with newer packaging standards.
  # - It provides a clear error message when setuptools is not installed.
  # - It sets `sys.argv[0]` to the underlying `setup.py`, when invoking `setup.py` so
  #   setuptools doesn'"'"'t think the script is `-c`. This avoids the following warning:
  #     manifest_maker: standard file '"'"'-c'"'"' not found".
  # - It generates a shim setup.py, for handling setup.cfg-only projects.
  import os, sys, tokenize

  try:
      import setuptools
  except ImportError as error:
      print(
          "ERROR: Can not execute `setup.py` since setuptools is not available in "
          "the build environment.",
          file=sys.stderr,
      )
      sys.exit(1)

  __file__ = %r
  sys.argv[0] = __file__

  if os.path.exists(__file__):
      filename = __file__
      with tokenize.open(__file__) as f:
          setup_py_code = f.read()
  else:
      filename = "<auto-generated setuptools caller>"
      setup_py_code = "from setuptools import setup; setup()"

  exec(compile(setup_py_code, filename, "exec"))
  '"'"''"'"''"'"' % ('"'"'/tmp/pip-install-smk5791j/thriftpy2_5bfb8ae99c874dad96e90a45ca1df5fa/setup.py'"'"',), "<pip-setuptools-caller>", "exec"))' egg_info --egg-base /tmp/pip-pip-egg-info-vgz1vbgz
  cwd: /tmp/pip-install-smk5791j/thriftpy2_5bfb8ae99c874dad96e90a45ca1df5fa/
  Preparing metadata (setup.py) ... error
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.

So I think this is related to https://github.com/Thriftpy/thriftpy2/issues/218, which is already fixed in master branch. I think we should make a release cc @ethe

aisk commented 1 year ago

This should be resolved since v0.14.7 was published.