This is a rare case, when install pynng in Windows 10 and VS 2019, need to oversome several issues. Here just a quick fix.

first, using following command to install

git clone
cd pynng
pip3 install -e .

before pip3 install -e ., change the

in build_libs function:

def build_libs():
    Builds the nng and mbedtls libs.

    # The user has to have the correct Visual Studio version on the path or the
    # build will fail, possibly in exciting and mysterious ways.
    major, minor, *_ = sys.version_info

    is_64bit = sys.maxsize > 2**32
    if WINDOWS:
        if is_64bit:
            flags += ['-G', 'Visual Studio 16 2019']
            flags += ['-A', 'x64']
            flags += ['-A', 'win32']

    # if shutil.which('ninja'):
    #     # the ninja build generator is a million times faster.
    #     flags += ['-G', 'Ninja']

to force make in VS2019 and x64.

in build_mbedtls function:

def build_mbedtls(cmake_args):
    Clone mbedtls and build it with cmake.

    do = check_call
    if not os.path.exists('mbedtls'):
        do('git clone --recursive {}'.format(MBEDTLS_REPO), shell=True)
        # for local hacking, just copy a directory (network connection is slow)
        # do('cp -r ../mbedtls mbedtls', shell=True)
        # do('git checkout {}'.format(MBEDTLS_REV), shell=True, cwd='mbedtls')

    cwd = 'mbedtls/build'
    cmake_cmd = ['cmake'] + cmake_args
    cmake_cmd += [
    print('building mbedtls with:', cmake_cmd)
    do(cmake_cmd, cwd=cwd)
        'cmake --build . --config Release --target install',

here is the mbedtle version problem (i guess).

then run pip3 install -e ., suppose there some error pop up, telling the encoding warnning as error (when you are not in English version VS).

now change CMakeKists.txt under mbedtls folder.

option(MBEDTLS_FATAL_WARNINGS "Compiler warnings treated as errors" OFF) < turn this option to OFF.

delete mbedtls\build folder then try again, should work like a charm.


comments powered by Disqus