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
In the (normal) situation where psutil is not already installed, "pip install psrecord" fails with this error:
$ pip install psrecord
Collecting psrecord
Downloading psrecord-1.0.tar.gz (55kB)
100% |████████████████████████████████| 61kB 1.2MB/s
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-2BWXB5/psrecord/setup.py", line 34, in <module>
from psrecord import __version__
File "psrecord/__init__.py", line 25, in <module>
from .main import main
File "psrecord/main.py", line 29, in <module>
import psutil
ImportError: No module named psutil
As the stack trace shows, this is because your setup.py file imports the psrecord package in order to get __version__ which is defined in __init__.py. This fails because the psrecord __init__.py also imports psrecord.main, which imports psutil. So it does no good for your setup.py file to say install_requires=['psutil'] because your setup.py script crashes before it reaches that point.
In the (normal) situation where psutil is not already installed, "pip install psrecord" fails with this error:
As the stack trace shows, this is because your setup.py file imports the psrecord package in order to get
__version__
which is defined in__init__.py
. This fails because the psrecord__init__.py
also imports psrecord.main, which imports psutil. So it does no good for your setup.py file to sayinstall_requires=['psutil']
because your setup.py script crashes before it reaches that point.This is a very common pitfall. You need a different method of defining the version in your setup.py file. This webpage documents 7 different ways to do it: https://packaging.python.org/guides/single-sourcing-package-version/
The text was updated successfully, but these errors were encountered: