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
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/hr/kqh8ht4172s832b39r1ydw5h0000gp/T/pip-req-build-906fvzmo/setup.py", line 2, in <module>
from paytmpg import package_version
File "/private/var/folders/hr/kqh8ht4172s832b39r1ydw5h0000gp/T/pip-req-build-906fvzmo/paytmpg/__init__.py", line 13, in <module>
from paytmpg.pg.Payment import Payment
File "/private/var/folders/hr/kqh8ht4172s832b39r1ydw5h0000gp/T/pip-req-build-906fvzmo/paytmpg/pg/Payment.py", line 10, in <module>
from paytmpg.pg.utils.SignatureUtil import generateSignature
File "/private/var/folders/hr/kqh8ht4172s832b39r1ydw5h0000gp/T/pip-req-build-906fvzmo/paytmpg/pg/utils/SignatureUtil.py", line 6, in <module>
from Crypto.Cipher import AES
ModuleNotFoundError: No module named 'Crypto'
My setup:
python3.7, pip 21.1.2
Steps to reproduce:
git clone
start a new virtualenv of python3.7 / 3.8 (new env without any existing packages installed is key here)
This is happening because of compilation error caused due to Crypto dependency in the installation flow. This is introduced during setup time because of this line in setup.py : from paytmpg import package_version. This ends up loading __init__.py of paytmpg package, which also loads Payment -> SignatureUtil -> Crypto. (You can find that in the stacktrace above as well).
Simple solution would be to move VERSION.py outside paytmpg package and put that in the root of the project (or alternatively hardcode it in setup.py itself). Once the import statement dependency from setup.py is removed, installation works as expected. You can let me know if I should raise a pull request for the same.
Hi team,
pip install is failing with error:
My setup:
python3.7, pip 21.1.2
Steps to reproduce:
python setup.py install
--> throws error mentioned aboveProblem & Suggested Solution:
This is happening because of compilation error caused due to
Crypto
dependency in the installation flow. This is introduced during setup time because of this line insetup.py
:from paytmpg import package_version
. This ends up loading__init__.py
of paytmpg package, which also loadsPayment
->SignatureUtil
->Crypto
. (You can find that in the stacktrace above as well).Simple solution would be to move VERSION.py outside paytmpg package and put that in the root of the project (or alternatively hardcode it in
setup.py
itself). Once the import statement dependency fromsetup.py
is removed, installation works as expected. You can let me know if I should raise a pull request for the same.PS : For solution completeness, I was also reading about how to solve these issues. If we need the current setup to work as-is, there are other best-practices like defining a
pyproject.toml
file (Refer: https://stackoverflow.com/questions/62983756/what-is-pyproject-toml-file-for), where we can mention build-time dependencies. (Refer : https://stackoverflow.com/questions/49715799/how-to-specify-dependencies-that-setup-py-needs-during-installation). Here, pip understands and installs the dependencies based on pyproject.toml first, and then installs setup.py.The text was updated successfully, but these errors were encountered: