Hi guys,
I'm running into a few errors trying to install M2Crypto on a windows machine. I've done a fair bit of research and it seems to be a common problem with the library.
Wondering if anyone here has experienced similar issues and resolved them? I'm using Win10(64 bit), Python 3.8 through Pycharm. Pip 20.1.1. I've tried to install both M2Crypto and M2CryptoWin64 but I've had no luck.
Cheers
Solved! Go to Solution.
Some builds for m2crypto for specific versions of Python are available from their CI: https://ci.appveyor.com/project/m2crypto/m2crypto/history. Try selecting a version, selecting a job that matches your Python version, then going to the "Artifacts" tab and downloading an installer. To install a .whl file, see step 11 of my build tutorial below.
I have also attached the m2crypto module that I have built on Windows 10 x64, Python 3.8.1. It should work on any x64-based version of Windows with any version of Python 3.8.X. M2Crypto-0.35.2.win-amd64-py3.8.zip
However, if you are unable to find a build that matches your Python version and system type and architecture, you may need to manually build m2crypto. I adapted the build steps from their CI build scripts: https://gitlab.com/m2crypto/m2crypto/blob/master/appveyor.yml. I built the module by doing the following:
Hi Sam,
Try installing the attached library
Regards,
Anirudh
Thanks @anirudh!
Do you know how to change the path location when installing it? I want to put it in a venv.
Cheers
Hi @anirudh
I've installed M2Crypto successfully but am now getting an error:
File "C:\Users\USERNAME\Desktop\PATH\anaplan_auth.py", line 13, in <module>
from M2Crypto import EVP, RSA
File "C:\Users\USERNAME\Desktop\PATH\venv\lib\site-packages\M2Crypto\__init__.py", line 22, in <module>
import __m2crypto
ModuleNotFoundError: No module named '__m2crypto'
Have you ran into this error before? I've seen a few Google results with the same error for different things? Once I have this all setup I think I'll create a wiki article for setting up Certificate Authentication on Windows systems.
Hi Sam,
I had the same issue with my virtual env
Unfortunately, I had to uninstall the whole python instance, get rid of the old M2Crypto library and then reinstall everything with the attached library.....
Regards,
Anirudh
I tried to uninstall and re-install but that hasn't worked. I'm still getting the error:
File "C:\Users\PATH\TO\FILES\anaplan_auth.py", line 13, in <module>
from M2Crypto import EVP, RSA
File "C:\Users\PATH\TO\FILES\\venv\lib\site-packages\M2Crypto\__init__.py", line 22, in <module>
import __m2crypto
ModuleNotFoundError: No module named '__m2crypto'
But __m2crypto.py is in the same directory
Strange, now I'm getting:
File "C:\Users\Sam\Desktop\Data_Integration_Anaplan\anaplan_auth.py", line 13, in <module>
from M2Crypto import EVP, RSA
File "C:\Users\Sam\Desktop\Data_Integration_Anaplan\venv\lib\site-packages\M2Crypto\__init__.py", line 23, in <module>
import m2
ModuleNotFoundError: No module named 'm2'
There is an m2.py file in the directory though.
Hello Sam - I am running the same issue. Can you please specify steps help you to resolve this issue?
Regards
Suraphel