Python Forum

Full Version: Difficulty installing Pycrypto
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have a dependency, which calls for Pycrypto. I have downloaded the gz for version 2.6.1 and copied the folder to pycrypto-2.6.1. Upon executing ‘python setup.py install’ in this folder I get stopped with...

Error:
warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath. building 'Crypto.Random.OSRNG.winrandom' extension error: Unable to find vcvarsall.bat
I have searched for a clear answer to this issue but haven't found anything that is useful. There does not appear to be a whl file for Pycrypto either.

I am trying to get this installed on Windows 10 32bit, with python 3.6.0.

Due to network restrictions, I will have to manually download anything that needs to be applied to my environment.

I appreciate any tips or hints that can help me get through this.
check https://github.com/dlitz/pycrypto/issues/238
Recommendation is to use PyCryptodome, which may be installed as drop-in replacement in virtualenvironment. Check https://pycryptodome.readthedocs.io/en/l...ction.html

if you want to try and install PyCrypto after all
https://stackoverflow.com/q/11405549/4046632
https://stackoverflow.com/q/2817869/4046632
I loaded PyCryptodome and reran the install for pysftp. It ran exactly the way it did before. I verified the failure by attempting to import pysftp and having it come back and tell me that it can't find the module for pysftp.

So, I think I'm at a dead in on this one.
(Feb-10-2020, 03:27 PM)KipCarter Wrote: [ -> ]I loaded PyCryptodome and reran the install for pysftp. It ran exactly the way it did before. I verified the failure by attempting to import pysftp and having it come back and tell me that it can't find the module for pysftp.

So, I think I'm at a dead in on this one.

I don't remember, nor I can see a post by you about problem installing pysftp. What is the problem?
Quick test i get no error on import,as most of the time when i test stuff that can have problem virtual environment.
Then is isolated of all i done an installed before.
E:\div_code
λ python -m venv pysftp_env

E:\div_code
λ cd pysftp_env\

E:\div_code\pysftp_env
λ E:\div_code\pysftp_env\Scripts\activate

(pysftp_env) E:\div_code\pysftp_env
λ pip install pysftp
Collecting pysftp .....  
Successfully installed bcrypt-3.1.7 cffi-1.14.0 cryptography-2.8 paramiko-2.7.1 pycparser-2.19 pynacl-1.3.0 pys
ftp-0.2.9 six-1.14.0

(pysftp_env) E:\div_code\pysftp_env
λ python
Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 21:26:53) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pysftp
>>>
>>> pysftp.__version__
'0.2.9'
>>> exit()
Test connect:
(pysftp_env) E:\div_code\pysftp_env
λ python
Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 21:26:53) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pysftp
>>>
>>> cnopts = pysftp.CnOpts()
>>> cnopts.hostkeys = None
>>> con =  pysftp.Connection('198.18.8.139', username='tester', password='password', cnopts=cnopts)
>>> con.listdir()
['testfile.txt']
>>> con.get('testfile.txt')
>>> exit()

(pysftp_env) E:\div_code\pysftp_env
λ cat testfile.txt
This is a test file created by Rebex Tiny SFTP server.