-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Allow numpy to be import under pypy #14664
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
Conversation
Pypy has evolved greatly, it might be a good idea to remove the import ban.
Can we get it tested on Travis? It looks like it isn't installed here (the header says "numpy: none" and there are a lot of skipped tests in the lambdify tests). Does NumPyPy come with PyPy or does it have to be installed separately? |
Numpypy is deprecated for pypy, numpy is compatible with pypy now. |
In that case, we need to make sure numpy is installed in the pypy travis build. |
Note to anyone reviewing this: you need to check the PyPy tests on Travis manually (they are in allowed_failures). |
Hi! Is there anything I can do to help push this forward? |
Is it possible to get it tested on Travis? |
@asmeurer I've never contributed to sympy before, can you show me how to get this tested on travis. Or more generally how one should know before trying to contribute to sympy? Thx. |
The Travis tests are configured in .travis.yml. You can see the build by clicking the "show all checks" button below (the PyPy builds are at the bottom, under "allowed failures"). You can see in the header of the tests that NumPy isn't installed ( Also, I would recommend merging with the latest master, as it has some other fixes for the PyPy tests. |
Thx for your reply!
Is pypy3 included in the test matrix? It seems that pypy2 is used in the test matrix according to the output in the console log. |
Not right now. What is the status of pypy vs. pypy3? Ideally we would only support the one that is actively developed. |
From what I gathered from pypy blog and their release note, after they've received grants from Mozilla, they have completed python 3.5 support (plus f-string) and are working toward a 3.6 release within 2018. Besides the momentum toward 3.6, the one concerning point about whether to support pypy3 is that windows(32bit) binary is still in beta, while pypy2 has stable windows binary support. I'm not a pypy dev so this is not official, however I hope this material helps people to like pypy more. I've been toying sympy with pypy3 for awhile and really likes the speed-up. Reference: |
@asmeurer Does this PR still holds a chance of being merged? |
Can anyone familiar with travis take a look at this. I've tried the sympy test suite in a ubuntu 18.04 container with the required packages installed. If I run the test after commenting out the two lines for pypy3, the test suite failed on this particular test, others seems to pass just fine:
The error traceback: Traceback (most recent call last):
File "/home/ubuntu/sympy/sympy/utilities/autowrap.py", line 169, in _process_files
retoutput = check_output(command, stderr=STDOUT)
File "/snap/pypy3/50/lib-python/3/subprocess.py", line 356, in check_output
**kwargs).stdout
File "/snap/pypy3/50/lib-python/3/subprocess.py", line 438, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['/home/ubuntu/.venv/bin/python', 'setup.py', 'build_ext', '--inplace']' returned non-zero exit status 1.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/ubuntu/sympy/sympy/external/tests/test_autowrap.py", line 289, in test_autowrap_custom_printer
func = autowrap(expr, backend='cython', tempdir=tmpdir, code_gen=gen)
File "/home/ubuntu/sympy/sympy/core/cache.py", line 96, in wrapper
retval = cfunc(*args, **kwargs)
File "/snap/pypy3/50/lib-python/3/functools.py", line 543, in wrapper
result = user_function(*args, **kwds)
File "/home/ubuntu/sympy/sympy/utilities/autowrap.py", line 648, in autowrap
return code_wrapper.wrap_code(routine, helpers=helps)
File "/home/ubuntu/sympy/sympy/utilities/autowrap.py", line 150, in wrap_code
self._process_files(routine)
File "/home/ubuntu/sympy/sympy/utilities/autowrap.py", line 173, in _process_files
" ".join(command), e.output.decode('utf-8')))
sympy.utilities.autowrap.CodeWrapError: Error while executing command: /home/ubuntu/.venv/bin/python setup.py build_ext --inplace. Command output is:
Compiling wrapper_module_4.pyx because it changed.
[1/1] Cythonizing wrapper_module_4.pyx
running build_ext
building 'wrapper_module_4' extension
creating build
creating build/temp.linux-x86_64-3.6
gcc -pthread -DNDEBUG -O2 -fPIC -I/home/ubuntu/.venv/include -I/snap/pypy3/50/include -c wrapper_module_4.c -o build/temp.linux-x86_64-3.6/wrapper_module_4.o -std=c99
wrapper_module_4.c:506:0: warning: "PyObject_Unicode" redefined
#define PyObject_Unicode PyObject_Str
In file included from /snap/pypy3/50/include/Python.h:143:0,
from wrapper_module_4.c:23:
/snap/pypy3/50/include/pypy_decl.h:677:0: note: this is the location of the previous definition
#define PyObject_Unicode PyPyObject_Unicode
gcc -pthread -DNDEBUG -O2 -fPIC -I/home/ubuntu/.venv/include -I/snap/pypy3/50/include -c wrapped_code_4.c -o build/temp.linux-x86_64-3.6/wrapped_code_4.o -std=c99
wrapped_code_4.c: In function ‘autofunc’:
wrapped_code_4.c:15:22: error: ‘S_PI’ undeclared (first use in this function); did you mean ‘__P’?
autofunc_result = S_PI*a;
^~~~
__P
wrapped_code_4.c:15:22: note: each undeclared identifier is reported only once for each function it appears in
/home/ubuntu/.venv/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File:
/tmp/tmpt0sybg3q/wrapper_module_4.pyx
tree = Parsing.p_module(s, pxd, full_module_name)
error: command 'gcc' failed with exit status 1
============================ tests finished: 8715 passed, 340 skipped, 380 expected to fail, 4 expected to fail but passed, 1 exceptions, in 3209.44 seconds =============================
|
It looks like autowrap has issues with pypy. Does it even work there? I'm curious how it is using Cython. Does Cython work with pypy? |
Hi! I've tried the helloworld example from cython and it worked under pypy. Are there anything I can help to make this PR passed? It would be nice to allow sympy to import numpy under pypy. Thanks. |
The fork has been deleted so the PR cannot be reopened. I'd test it locally and if it works, make a new PR with your patch. |
By the way, if someone deletes their fork, I take that to mean that they withdraw their contribution, so in my opinion, such PRs should not be merged unless the PR author gives explicit permission to do so. I mention this because it is technically possible to download the PR using https://gist.github.com/piscisaureus/3342247. So it's good to just close such PRs. |
So that means, if I make a PR to remove the four lines as this PR did, I should use my name&email instead of this author's? |
This particular PR is so simple that I don't think it really matters. If it were something adding new code that you wanted to use, it would be good to try to contact the person to see if they still are OK with contributing it, or else rewrite it yourself from scratch. |
Hi! I vaguely remember this has been already merged years ago. Feel free to take the line and raise the PR again. |
Just to be clear, my comments were intended to be generally about any PR where the fork has been deleted, not just this one. |
Pypy has evolved greatly, it might be a good idea to remove the import ban.
References to other Issues or PRs
Fixes #14658
Brief description of what is fixed or changed
Remove import ban under pypy
Other comments