Problems installing M2Crypto in python 3

4.3k views Asked by At

I am building a web app in Django and use the django-paypal library for integration with paypal. The integration went without a problem, the problem is with the paypal encrypted buttons because to use that button/form I need to install M2Crypto.

I am trying to follow this instructions, and I say trying because to be honest I don't quite understand them:

https://gitlab.com/m2crypto/m2crypto/-/blob/master/INSTALL.rst

For example, one of the instructions that I don't understand is:

To install M2Crypto, you must be able to compile and link C sources against Python and OpenSSL

I already install OpenSSL and install Swig following this youtube video:

https://www.youtube.com/watch?v=HDD9QqLtAws

The error generates when use

pip install M2Crypto

And the error is:

  Collecting M2Crypto
  Using cached M2Crypto-0.38.0.tar.gz (1.2 MB)
  Preparing metadata (setup.py) ... done
  Using legacy 'setup.py install' for M2Crypto, since package 'wheel' is not installed.
  Installing collected packages: M2Crypto
  Running setup.py install for M2Crypto ... error
  error: subprocess-exited-with-error

  × Running setup.py install for M2Crypto did not run successfully.
  │ exit code: 1
  ╰─> [60 lines of output]
  running install

  running build
  running build_py
  copying src\M2Crypto\ASN1.py -> build\lib.win-amd64-3.10\M2Crypto
  copying src\M2Crypto\AuthCookie.py -> build\lib.win-amd64-3.10\M2Crypto
  copying src\M2Crypto\BIO.py -> build\lib.win-amd64-3.10\M2Crypto
  copying src\M2Crypto\BN.py -> build\lib.win-amd64-3.10\M2Crypto
  copying src\M2Crypto\callback.py -> build\lib.win-amd64-3.10\M2Crypto
  copying src\M2Crypto\DH.py -> build\lib.win-amd64-3.10\M2Crypto
  copying src\M2Crypto\DSA.py -> build\lib.win-amd64-3.10\M2Crypto
  copying src\M2Crypto\EC.py -> build\lib.win-amd64-3.10\M2Crypto
  copying src\M2Crypto\Engine.py -> build\lib.win-amd64-3.10\M2Crypto
  copying src\M2Crypto\Err.py -> build\lib.win-amd64-3.10\M2Crypto
  copying src\M2Crypto\EVP.py -> build\lib.win-amd64-3.10\M2Crypto
  copying src\M2Crypto\ftpslib.py -> build\lib.win-amd64-3.10\M2Crypto
  copying src\M2Crypto\httpslib.py -> build\lib.win-amd64-3.10\M2Crypto
  copying src\M2Crypto\m2.py -> build\lib.win-amd64-3.10\M2Crypto
  copying src\M2Crypto\m2crypto.py -> build\lib.win-amd64-3.10\M2Crypto
  copying src\M2Crypto\m2urllib.py -> build\lib.win-amd64-3.10\M2Crypto
  copying src\M2Crypto\m2urllib2.py -> build\lib.win-amd64-3.10\M2Crypto
  copying src\M2Crypto\m2xmlrpclib.py -> build\lib.win-amd64-3.10\M2Crypto
  copying src\M2Crypto\Rand.py -> build\lib.win-amd64-3.10\M2Crypto
  copying src\M2Crypto\RC4.py -> build\lib.win-amd64-3.10\M2Crypto
  copying src\M2Crypto\RSA.py -> build\lib.win-amd64-3.10\M2Crypto

  copying src\M2Crypto\six.py -> build\lib.win-amd64-3.10\M2Crypto
  copying src\M2Crypto\SMIME.py -> build\lib.win-amd64-3.10\M2Crypto
  copying src\M2Crypto\threading.py -> build\lib.win-amd64-3.10\M2Crypto
  copying src\M2Crypto\util.py -> build\lib.win-amd64-3.10\M2Crypto
  copying src\M2Crypto\X509.py -> build\lib.win-amd64-3.10\M2Crypto
  copying src\M2Crypto\__init__.py -> build\lib.win-amd64-3.10\M2Crypto
  creating build\lib.win-amd64-3.10\M2Crypto\SSL
  copying src\M2Crypto\SSL\cb.py -> build\lib.win-amd64-3.10\M2Crypto\SSL
  copying src\M2Crypto\SSL\Checker.py -> build\lib.win-amd64-3.10\M2Crypto\SSL
  copying src\M2Crypto\SSL\Cipher.py -> build\lib.win-amd64-3.10\M2Crypto\SSL
  copying src\M2Crypto\SSL\Connection.py -> build\lib.win-amd64-3.10\M2Crypto\SSL
  copying src\M2Crypto\SSL\Context.py -> build\lib.win-amd64-3.10\M2Crypto\SSL
  copying src\M2Crypto\SSL\Session.py -> build\lib.win-amd64-3.10\M2Crypto\SSL
  copying src\M2Crypto\SSL\SSLServer.py -> build\lib.win-amd64-3.10\M2Crypto\SSL
  copying src\M2Crypto\SSL\ssl_dispatcher.py -> build\lib.win-amd64-3.10\M2Crypto\SSL
  copying src\M2Crypto\SSL\timeout.py -> build\lib.win-amd64-3.10\M2Crypto\SSL
  copying src\M2Crypto\SSL\TwistedProtocolWrapper.py -> build\lib.win-amd64-3.10\M2Crypto\SSL
  copying src\M2Crypto\SSL\__init__.py -> build\lib.win-amd64-3.10\M2Crypto\SSL
  running egg_info
  writing src\M2Crypto.egg-info\PKG-INFO
  writing dependency_links to src\M2Crypto.egg-info\dependency_links.txt
  swig.exe -python -py3 -IC:\Users\jorge\AppData\Local\Programs\Python\Python310\include - 
  IC:\Users\jorge\AppData\Local\Programs\Python\Python310\Include -I/usr/include/openssl - 
  includeall -modern -builtin -outdir C:\Users\jorge\AppData\Local\Temp\pip-install-rtopb2r1
  \m2crypto_906291f76c734281be933fa782d5d491\src\M2Crypto -o src/SWIG/_m2crypto_wrap.c 
  src/SWIG/_m2crypto.i
  error: command 'swig.exe' failed: None
  [end of output]
  note: This error originates from a subprocess, and is likely not a problem with pip.
  error: legacy-install-failure

  × Encountered error while trying to install package.
  ╰─> M2Crypto

  note: This is an issue with the package mentioned above, not pip.
  hint: See above for output from the failure.

I'm certain that the error is some step in the instalation that either I'm missing or doing wrong, so I am asking for help if someone can please give me a streamline version of the steps in the installation of M2Crypto

I'm using Python 3.10.0 and Django 3.2.9 in Windows 10

0

There are 0 answers