cfbolz changed the topic of #pypy to: PyPy, the flexible snake (IRC logs: https://quodlibet.duckdns.org/irc/pypy/latest.log.html#irc-end ) | use cffi for calling C | if a pep adds a mere 25-30 [C-API] functions or so, it's a drop in the ocean (cough) - Armin
<isidentical>
Is there a [historical] reason regarding why old grammar files (under pyparser/data/Grammar*) kept instead of hosting only the current grammar file?
<mattip>
got me thinking maybe the JIT has problems with this design pattern
<simpson>
It's not the Visitor Pattern that is the problem, but the Expression Problem. Because there's so many different possible behaviors, and the JIT has to be able to jump to each distinct behavior, it doesn't matter whether the dispatch to the individual behaviors is relatively fast.
<simpson>
(I guess yeah, maybe there's also problems with Visitors, but it's not obvious what they would be. Inverting control of Visitors only gives one extra lookup.)
<mattip>
right, I meant the solution to the Expression Problem via a Visitor Pattern solution
<cfbolz>
The visitor is definitely a problem in itself
<cfbolz>
Very branchy
<cfbolz>
Hard to predict
<simpson>
Right. But, since IoC on Visitors only adds one lookup, doing the IoC which inlines the visiting clauses will only *remove* one lookup. So I don't think that avoiding visitors is an ultimate answer.
<simpson>
(Honestly, though, I think I'm up on Mt. Stupid this morning.)
alexge50 has joined #pypy
<cfbolz>
simpson: yes, if I knew what to write instead, that would be great. But I don't
<antocuni>
it's a more general problem which affects a lot of "data driven" programs
<antocuni>
e.g. at some point I had problems with real life code which did a computations using 10-15 variables
<antocuni>
and the code was something like
<antocuni>
if a < 0: a = 0
<antocuni>
if b is None: b = 'hello'
<antocuni>
if c > 100: c = 100
<antocuni>
...
<antocuni>
and at the end you do something with a, b, c
<antocuni>
with the pypy jit, the number of traces quickly explodes
isidentical has quit [Ping timeout: 264 seconds]
<cfbolz>
some more streaming in a few minutes: twitch.tv/pypyproject/
<mattip>
for the sphinx (cpython_doc) benchmark there are two major stages, reading and writing
<mattip>
on my machine, reading is 23 sec for cpython, 51 for pypy, writing is 17 sec for cpython, 35 for pypy
<mattip>
with the JIT
<mattip>
so no useful information there
atomizer_ has joined #pypy
alexge50 has quit [Ping timeout: 256 seconds]
atomizer has quit [Ping timeout: 256 seconds]
nulano has quit [Ping timeout: 256 seconds]
nulano has joined #pypy
jiffe has quit [Ping timeout: 240 seconds]
alexge50 has joined #pypy
jiffe has joined #pypy
otisolsen70_ has joined #pypy
otisolsen70_ has quit [Remote host closed the connection]
lritter has joined #pypy
Marco91 has joined #pypy
Marco91 has left #pypy [#pypy]
Marco91 has joined #pypy
isidentical has joined #pypy
Marco91 has quit [Quit: Leaving]
Marco91 has joined #pypy
Marco91 has quit [Client Quit]
Marco91 has joined #pypy
<Marco91>
Hello everyone! Please, I need a little help with PyPy.
<Marco91>
I installed PyPy via -mpip install numpy but when trying to import via import numpy, the error "ImportError: No module named numpy" occurs.
<antocuni>
how did you install pypy? Which operating system? Could you please paste the full commands which you used?
<Marco91>
Yes
oberstet has quit [Remote host closed the connection]
<Marco91>
@antocuni Installed via tarball file. I downloaded the tarball, unzipped it with the following command: "tar xf pypy-xyztar.bz2", then the following: "./pypy-xyz/bin/pypy", then this one: "./pypy-xxx/bin/pypy -m ensurepip ", then this:" ./pypy-xxx/bin/pypy -mpip install -U pip wheel ", then this:" ./pypy-xxx/bin/pypy -mpip install numpy ", and finally, I tried execute "import numpy", with the reported error occurring. I'm using Google
<Marco91>
Colab. I believe the machine uses Ubuntu. Before the "import numpy" command, I tried to use the "%% pypy" command, in order to enable pypy in Google Colab, but it also didn't work.
<antocuni>
I don't know what is google colab
<antocuni>
the commands you typed look correct
<antocuni>
I suggest to look at which directories are in sys.path
<antocuni>
and search for numpy in those
<Marco91>
the installation is successful, but I can't import numpy via pypy.
<antocuni>
please paste the full commands you type and the output you get
<Marco91>
@nulano You can edit the code as desired
<nulano>
"Couldn't find program: 'pypy'"?
<Marco91>
You can run the lines relative to install first
<antocuni>
how?
<antocuni>
ah, without the comments
<Marco91>
Yes
<antocuni>
sorry, it's late and I'm about to go to bed. I don't think that yours is a pypy problem
<Marco91>
ok, thanks
<antocuni>
your problem is how to convince google colab to run your notebook on pypy
<antocuni>
but I have not idea how to do it :)
<Marco91>
I understand
<Marco91>
Thanks anyway
<Marco91>
@nulano, any ideia how to solve it?
<antocuni>
if type this in a cell: "import sys; print(sys.executable)"
<antocuni>
you get /usr/bin/python3
<nulano>
I'm trying it, but numpy takes a while to install...
<Marco91>
@nulano, no problem, thanks
<Marco91>
@antocuni It's because it's necessary to install PyPy before
<Marco91>
is*
<antocuni>
well, you need to install pypy AND to tell ipython to use it
<antocuni>
which I guess it's the goal of the line with %%pypy
<Marco91>
yes
<Marco91>
and the first line has to be %%pypy
<antocuni>
but then my question is: how does ipython know where to find the executable, since you installed pypy in a directory which very likely is not inside PATH?