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
marky1991 has joined #pypy
toad_polo has quit [*.net *.split]
toad_polo has joined #pypy
oberstet has quit [Quit: Leaving]
_whitelogger has joined #pypy
dansan has joined #pypy
lritter has quit [Ping timeout: 264 seconds]
lritter has joined #pypy
mgedmin has quit [Quit: ZNC - https://wiki.znc.in/ZNC]
mgedmin has joined #pypy
jcea has quit [Ping timeout: 260 seconds]
lritter has quit [Quit: Leaving]
<bbot2> Started: http://buildbot.pypy.org/builders/pypy-c-jit-macosx-x86-64/builds/5406 [ricky: force build, py3.7-big-sur-dyld-cache]
<bbot2> Failure: http://buildbot.pypy.org/builders/pypy-c-jit-macosx-x86-64/builds/5406 [ricky: force build, py3.7-big-sur-dyld-cache]
isidentical has joined #pypy
oberstet has joined #pypy
isidentical has quit [Remote host closed the connection]
isidentical has joined #pypy
<isidentical> Is there a [historical] reason regarding why old grammar files (under pyparser/data/Grammar*) kept instead of hosting only the current grammar file?
<cfbolz> Lost in time, I suppose
jcea has joined #pypy
<mattip> cfbolz: http://craftinginterpreters.com is quite a good read
<mattip> the section on the Expression Problem (about visitors)
<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
<antocuni> use a pastebin website
<antocuni> such as http://paste.openstack.org/
<Marco91> ok
<Marco91> @antocuni
<antocuni> sorry, this doesn't help
<antocuni> to help you debugging the issue, I need a full transcript of your terminal session
<antocuni> in particular, I'd like to see what is the output of those commands
<nulano> I believe there is a share button in google colab, that could be helpful here
<Marco91> @antocuni, ok, I will try do it
<Marco91> @nulano, ok, I will share it
<Marco91> Thanks in advance!
<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?
<Marco91> I think is what %%pypy does
<nulano> I think %%pypy is using the system pypy, installed with apt-get
<nulano> but you install numpy into a different copy
<antocuni> Marco91: that answer says to do "apt install pypy", which installs pypy in /usr/bin/pypy
<antocuni> if you install pypy in a random directory, there is no chance that ipython will find it
<Marco91> @antocuni, yes, the second install option that I put in Google Colab
<Marco91> have put*
<antocuni> I claim that your second install option doesn't work
<nulano> maybe '%%script ./pypy3.7-v7.3.3-linux64/bin/pypy
<nulano> '
<nulano> ?
<nulano> It seems to work for me, unless I'm missing something
<Marco91> @antocuni yes
<antocuni> nulano's suggestions seem to have a chance to work
<antocuni> anyway, I suggest to forget about numpy for now
<antocuni> you should try to make sure you run your cells inside a pypy subprocess by printing sys.executable
<antocuni> when you are sure you are doing it, you can install numpy
<Marco91> @antocuni it works
<antocuni> horray
<Marco91> What I do now?
<Marco91> @nulano The Numpy works with you?
<Marco91> NumPy*
<nulano> numpy was taking too long to install so I cancelled it and tried with another package, and that did work
<Marco91> what package?
<nulano> so I see no reason nympy shouldn't work, but I won't know for a while
<nulano> I just installed and imported pytest as that was the first package that crossed my mind
<Marco91> And you just did the import after the install?
<nulano> yes
<Marco91> After or before the %%pypy"?
<Marco91> "%%pypy"
<nulano> after the '%%script ./pypy3.7-v7.3.3-linux64/bin/pypy'
<nulano> just use '%%script ./pypy3.7-v7.3.3-linux64/bin/pypy' instead of '%%pypy'
<Marco91> Great
<Marco91> I'll test it now
<Marco91> It worked, Nulano!
<Marco91> @nulano
<Marco91> Thank you very much!!
<nulano> great!
<Marco91> @nulano you and the "%%script" part save me, and I hope PyPy will save my code too :D
<Marco91> my code is taking too long to run
Marco91 has quit [Quit: Leaving]
Dejan has quit [Quit: Leaving]