1

I read the vmprof doc in https://vmprof.readthedocs.io/en/latest/vmprof.html And I try to to prof pypy, with the cmd:

 pypy -m vmprof --web  hello.py

Then i return that:

/usr/bin/pypy: No module named vmprof

I Try

pip install vmprof 

then

 pypy -m vmprof --web  hello.py

But it doesn't work yet! I am totally confused, can somebody tell me what should i do??? where's the right way?

------- the next day update ---------- aha, now I find the way out!

clone this git repo

https://github.com/vmprof/vmprof-python.git

and that

cd vmprof
cd vmprof-python/
pypy setup.py install

Now you find your pypy have the module vmprof now !

but i meet a new problem, somebody knows how to solve it ?

xxx@yyy:~$  pypy -m vmprof  hello.py

Traceback (most recent call last):
  File "/usr/lib/pypy/lib-python/2.7/runpy.py", line 176, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/pypy/lib-python/2.7/runpy.py", line 73, in _run_code
    exec code in run_globals
  File "/usr/local/lib/pypy2.7/dist-packages/vmprof-0.4.15-py2.7.egg/vmprof/__main__.py", line 75, in <module>
    main()
  File "/usr/local/lib/pypy2.7/dist-packages/vmprof-0.4.15-py2.7.egg/vmprof/__main__.py", line 53, in main
    args.lines, native=native)
  File "/usr/local/lib/pypy2.7/dist-packages/vmprof-0.4.15-py2.7.egg/vmprof/__init__.py", line 72, in enable
    _vmprof.enable(fileno, period, memory, lines, native, real_time)
VMProfError: Invalid argument

I am using a wsl(Windows subsystem for linux), and version is

xxx@yyy:~$  cat /etc/os-release
NAME="Ubuntu"
VERSION="18.04.4 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.4 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic

my pypy

xxx@yyy:~$ pypy
Python 2.7.13 (5.10.0+dfsg-3build2, Feb 06 2018, 18:37:50)
[PyPy 5.10.0 with GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>>
qwr
  • 9,525
  • 5
  • 58
  • 102
LoHiaufung
  • 11
  • 2
  • What version of PyPy? You may need to checkout a different version of vmprof to go with that version of pypy, but I am not sure of the mapping. – mattip Apr 21 '20 at 05:15
  • Does WSL support libunwind? – mattip Apr 21 '20 at 05:17
  • @mattip hi , the version of PyPy is PyPy 5.10.0. And it should work according to the document of vmprof, see the link, https://vmprof.readthedocs.io/en/latest/vmprof.html#requirements – LoHiaufung Apr 21 '20 at 09:09
  • @mattip Another open issue in vmprof gitbub has the same problem, so I guess the key is that WSL doesn't support profiling pypy with vmprof? I am no sure. see the link,_vmprof.enable Invalid argument on Ubuntu 18.04 on WSL – LoHiaufung Apr 21 '20 at 09:12
  • https://github.com/vmprof/vmprof-python/issues/214 – LoHiaufung Apr 21 '20 at 11:33

1 Answers1

1

Are you sure your pip corresponds to pypy and not vanilla python? Try

pypy -m pip install vmprof
qwr
  • 9,525
  • 5
  • 58
  • 102