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

pyperformance doesn't work on the current Python 3.11 dev version: fail to install greenlet #113

Closed
vstinner opened this issue Nov 24, 2021 · 12 comments · Fixed by #133
Closed

Comments

@vstinner
Copy link
Member

$ ./bin/python3.11 -m pyperformance run -o ~/python/pgo_lto_pyperformance_macros.json -v 
(...)
    creating build/temp.linux-x86_64-3.11/src/greenlet
    gcc -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/home/vstinner/python/main/install/venv/cpython3.11-527ffb5582f0/include -I/home/vstinner/python/main/install/include/python3.11 -c src/greenlet/greenlet.c -o build/temp.linux-x86_64-3.11/src/greenlet/greenlet.o
    src/greenlet/greenlet.c: In function ‘g_switchstack’:
    src/greenlet/greenlet.c:508:44: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘recursion_depth’; did you mean ‘recursion_limit’?
      508 |         current->recursion_depth = tstate->recursion_depth;
          |                                            ^~~~~~~~~~~~~~~
          |                                            recursion_limit
    src/greenlet/greenlet.c:509:38: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘frame’; did you mean ‘cframe’?
      509 |         current->top_frame = tstate->frame;
          |                                      ^~~~~
          |                                      cframe
    src/greenlet/greenlet.c:544:17: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘recursion_depth’; did you mean ‘recursion_limit’?
      544 |         tstate->recursion_depth = target->recursion_depth;
          |                 ^~~~~~~~~~~~~~~
          |                 recursion_limit
    src/greenlet/greenlet.c:545:17: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘frame’; did you mean ‘cframe’?
      545 |         tstate->frame = target->top_frame;
          |                 ^~~~~
          |                 cframe
    src/greenlet/greenlet.c: In function ‘g_initialstub’:
    src/greenlet/greenlet.c:821:50: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘recursion_depth’; did you mean ‘recursion_limit’?
      821 |     self->recursion_depth = PyThreadState_GET()->recursion_depth;
          |                                                  ^~~~~~~~~~~~~~~
          |                                                  recursion_limit
    error: command '/usr/bin/gcc' failed with exit code 1
@vstinner
Copy link
Member Author

cc @markshannon @pablogsal

@smontanaro
Copy link

Any further word on this? I encountered it as well.

@vstinner
Copy link
Member Author

vstinner commented Dec 14, 2021

You can hack requirements.txt to not install greenlet, and disable benchmarks using it.

Or someone can try to port greenlet to Python 3.11.

@smontanaro
Copy link

Thanks, I gave that a whirl, but just wind up with an inability to install pyperformance 1.0.3 into the virtual environment later in the process. I think my problem is more basic and reflects a basic unfamiliarity with both virtual environments and how pip searches for packages. This is the eventual error (after removing greenlet from various requirements.txt files):

Command /home/skip/src/python/cpython/venv/cpython3.11-387285c4875d-compat-bb6573ba2f42/bin/python -m pip install pyperformance==1.0.3 failed with exit code 1

This kind of makes sense, because pyperformance 1.0.3 only exists in my git checkout. It's not been installed anywhere (most importantly, is not yet available on PyPI). Is there a way to tell the venv construction (or pip) that pyperformance 1.0.3 can be found in ~/src/python/pyperformance?

@pfmoore
Copy link
Member

pfmoore commented Dec 15, 2021

python -m pip install ~/src/python/pyperformance should do that.

@smontanaro
Copy link

Yes, that works from my ~/src/python/cpython git checkout (and I did install it exactly that way). How do I instruct the virtual environment construction process (which apparently uses a symlink to my locally compiled python executable) to also look there? Here's what I'm trying to execute:

~/src/python/cpython/python -m pyperformance run

and here's the tail end of the output showing that pip was unable to find pyperformance 1.0.3:

Execute: /home/skip/src/python/cpython/venv/cpython3.11-387285c4875d-compat-bb6573ba2f42/bin/python -m pip install pyperformance==1.0.3
/home/skip/src/python/cpython/venv/cpython3.11-387285c4875d-compat-bb6573ba2f42/lib/python3.11/site-packages/pip/_vendor/certifi/core.py:50: DeprecationWarning: path is deprecated. Use files() instead. Refer to https://importlib-resources.readthedocs.io/en/latest/using.html#migrating-from-legacy for migration advice.
  _CACERT_CTX = get_path("pip._vendor.certifi", "cacert.pem")
/home/skip/src/python/cpython/venv/cpython3.11-387285c4875d-compat-bb6573ba2f42/lib/python3.11/site-packages/pip/_internal/locations/_distutils.py:9: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
  from distutils.cmd import Command as DistutilsCommand
/home/skip/src/python/cpython/Lib/distutils/command/install.py:13: DeprecationWarning: The distutils.sysconfig module is deprecated, use sysconfig instead
  from distutils.sysconfig import get_config_vars
ERROR: Could not find a version that satisfies the requirement pyperformance==1.0.3 (from versions: 0.9.0, 0.9.1, 1.0.0, 1.0.1, 1.0.2)
ERROR: No matching distribution found for pyperformance==1.0.3
Command /home/skip/src/python/cpython/venv/cpython3.11-387285c4875d-compat-bb6573ba2f42/bin/python -m pip install pyperformance==1.0.3 failed with exit code 1

Remove directory /home/skip/src/python/cpython/venv/cpython3.11-387285c4875d-compat-bb6573ba2f42

@pfmoore
Copy link
Member

pfmoore commented Dec 15, 2021

Ah, I misunderstood, if it's the pyperformance command that runs pip, I don't know. Sorry for the noise.

@ericsnowcurrently
Copy link
Member

FYI, I recently merged a change that relates to this. If installing a benchmark's requirements fails then that benchmark is skipped and the other benchmarks still run. You can run against main or wait for the next release (1.1.0?).

@smontanaro
Copy link

smontanaro commented Dec 15, 2021

I'm trying to run against cpython main and pyperformance main. I have two sandboxes in sibling directories, cpython and pyperformance. My basic process looks like this:

$ cd blah/blah/blah/cpython
$ ./configure && make -j
$ ./python -m ensurepip
$ ./python -m pip install ../pyperformance

So far, so good. Then I run (still in my cpython sandbox):

./python -m pyperformance run

It churns for a bit then spits out the error about not being able to find pyperformance 1.0.3.

While writing this it occurred to me that maybe I shouldn't be running from the cpython directory. I tried running from the pyperformance sandbox:

../cpython/python -m pyperformance run

That seems to be churning along much better. Not sure why this didn't occur to me before.

@ericsnowcurrently
Copy link
Member

Take a look at the "compile" command (python3 -m pyperformance compile ...). It requires a config file, which can be tricky to make the first time but after that isn't a big deal. The pyperformance docs give a good example.

@smontanaro
Copy link

Nice. I can set it up to performance test two or three versions while I sleep. :-)

@brandtbucher
Copy link
Member

This should fixed once CPython 3.11.0a4 is released and python-greenlet/greenlet#280 is merged.

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

Successfully merging a pull request may close this issue.

5 participants