You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 9, 2020. It is now read-only.
I'm trying to use kernprof with a script that is used in a virtual environment (created with virtualenv). This virtual environment uses some system-wide packages (i.e., with --system-site-packages) but some are also local to the virtual environment. It seems that kernprof can't locate these modules? In the example below, it can't find the cached_property module, but a quick pip freeze confirms that, indeed, this module is available.
$ kernprof -l myscript.py
Wrote profile results to myscript.lprof
Traceback (most recent call last):
File "/usr/local/bin/kernprof", line 11, in<module>sys.exit(main())
File "/usr/local/lib/python3.6/dist-packages/kernprof.py", line 222, in main
execfile(script_file, ns, ns)
File "/usr/local/lib/python3.6/dist-packages/kernprof.py", line 35, in execfile
exec_(compile(f.read(), filename, 'exec'), globals, locals)
File "pyl4c/apps/soc.py", line 26, in<module>
from cached_property import cached_property
ModuleNotFoundError: No module named 'cached_property'
$ pip freeze | grep cached
cached-property==1.5.1
I confirmed that switching a module from a local to a system-wide install fixed this issue; i.e., after removing cached_property from the virtual environment and installing system-wide with sudo -H pip install cached_property, kernprof moved on to complain about a different module.
Here are my stats:
Python 3.6.8
pip version 19.2.1
virtualenv version 15.1.0
kernprof version 1.0b2
Thanks!
The text was updated successfully, but these errors were encountered:
by running whereis kernprof. I suspect when one call kernprof the system prioritizes to call the first one, which is not the one in the virtual environment.
I'm trying to use
kernprof
with a script that is used in a virtual environment (created withvirtualenv
). This virtual environment uses some system-wide packages (i.e., with--system-site-packages
) but some are also local to the virtual environment. It seems thatkernprof
can't locate these modules? In the example below, it can't find thecached_property
module, but a quickpip freeze
confirms that, indeed, this module is available.I confirmed that switching a module from a local to a system-wide install fixed this issue; i.e., after removing
cached_property
from the virtual environment and installing system-wide withsudo -H pip install cached_property
,kernprof
moved on to complain about a different module.Here are my stats:
pip
version 19.2.1virtualenv
version 15.1.0kernprof
version 1.0b2Thanks!
The text was updated successfully, but these errors were encountered: