Installing M2Crypto Python Library on Windows Machine for Certificate Authentication

Highlighted
Contributor

Installing M2Crypto Python Library on Windows Machine for Certificate Authentication

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

12 REPLIES 12
Highlighted
Master Anaplanner/Community Boss

Re: Installing M2Crypto Python Library on Windows Machine for Certificate Authentication

Hi Sam,

 

Try installing the attached library

 

Regards,

Anirudh

Contributor

Re: Installing M2Crypto Python Library on Windows Machine for Certificate Authentication

Thanks @anirudh!

 

Do you know how to change the path location when installing it? I want to put it in a venv.

 

Cheers

Highlighted
Contributor

Re: Installing M2Crypto Python Library on Windows Machine for Certificate Authentication

Don't worry, figured it out! Thanks again for your help mate

Cheers
Highlighted
Contributor

Re: Installing M2Crypto Python Library on Windows Machine for Certificate Authentication

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.

Highlighted
Master Anaplanner/Community Boss

Re: Installing M2Crypto Python Library on Windows Machine for Certificate Authentication

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

 

Highlighted
Contributor

Re: Installing M2Crypto Python Library on Windows Machine for Certificate Authentication

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

Highlighted
Master Anaplanner/Community Boss

Re: Installing M2Crypto Python Library on Windows Machine for Certificate Authentication

Hey Sam,

You have to edit the script to say -
'Import M2Crypto'

not __m2crypto

Regards,
Anirudh
Highlighted
Contributor

Re: Installing M2Crypto Python Library on Windows Machine for Certificate Authentication

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.

Highlighted
Not applicable

Re: Installing M2Crypto Python Library on Windows Machine for Certificate Authentication

Hello Sam - I am running the same issue. Can you please specify steps help you to resolve this issue?

 

Regards

Suraphel