2

I've been trying to install the Python package scrypt on my Windows 64 bit laptop, because another package that I want to use requires it. This same package also requires Python 3.6, so on my computer I have both Python 2.7 as well as 3.6, and use pip and pip3 to distinguish between the two. When doing pip install scrypt everything installs fine, but when using pip3 install scrypt I get the following error:

scrypt-1.2.0/lib/crypto\crypto_scrypt.h(33): fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory

I have tried solving this by cloning the repository like so:

$ hg clone http://bitbucket.org/mhallin/py-scrypt
$ cd py-scrypt
$ PATHTOPYTHON3 setup.py build

which then gives the following error

scrypt-1.2.0/libcperciva/crypto/crypto_aes.c(6): fatal error C1083: Cannot open include file: 'openssl/aes.h': No such file or directory

I then solved this error by changing the following code in setup.py

elif sys.platform.startswith('win32'):
    define_macros = [('inline', '__inline')]
    libraries = ['libeay32', 'advapi32']
    extra_sources = ['scrypt-windows-stubs/gettimeofday.c']

    if struct.calcsize('P') == 8:
        library_dirs = ['c:\OpenSSL-Win64\lib']
        includes = ['c:\OpenSSL-Win64\include', 'scrypt-windows stubs/include']
    else:
        library_dirs = ['c:\OpenSSL-Win32\lib']
        includes = ['c:\OpenSSL-Win32\include', 'scrypt-windows-stubs/include']

to simply have the the libraries be the 64 bit ones

library_dirs = ['c:\OpenSSL-Win64\lib']
includes = ['c:\OpenSSL-Win64\include', 'scrypt-windows

but this once again gives an error:

LINK : fatal error LNK1181: cannot open input file 'libeay32.lib'

After this I gave up and came here to ask what to do. How can I get scrypt working with Python 3.6 on Windows?

Amos
  • 1,154
  • 1
  • 16
  • 35

2 Answers2

0

According to the repository information, the scrypt package is only available for versions of Python up to 3.5 for Windows in a pre-compiled form. My guess is it works fine on 2.7 because it's not trying to compile the binary portions from scratch, but on 3.6 it has to and you don't have the pieces it needs installed.

This kind of error is frustrating but unless the package maintainer wants to provide a pre-built package for 3.6, you'll have to fight through building it yourself.

Rob Snyder
  • 46
  • 1
  • 3
0

As per the instructions here: https://stackoverflow.com/a/39270114/150851

You need to install OpenSSL-Win64 1.0.2n from here (not the light version):

http://slproweb.com/products/Win32OpenSSL.html

Then run python setup.py install and it should work.

Jonno_FTW
  • 8,601
  • 7
  • 58
  • 90