diff --git a/pygenn/genn_model.py b/pygenn/genn_model.py index f5009a4b9..d0e27d3c4 100644 --- a/pygenn/genn_model.py +++ b/pygenn/genn_model.py @@ -31,7 +31,6 @@ from os import path, environ from platform import system from psutil import cpu_count -from setuptools import msvc from shutil import which from subprocess import check_call # to call make from textwrap import dedent @@ -70,9 +69,17 @@ # If we're on windows if system() == "Windows": + # Try import the helper to get Visual C++ environment from setuptools + # **NOTE** this was removed in version 74.0 + try: + from setuptools.msvc import msvc14_get_vc_env as _get_vc_env + # If this fails, import from distutils + except ImportError: + from distutils._msvccompiler import _get_vc_env + # Get environment and cache in class, convertings # all keys to upper-case for consistency - _msvc_env = msvc.msvc14_get_vc_env("x86_amd64") + _msvc_env = _get_vc_env("x86_amd64") _msvc_env = {k.upper(): v for k, v in _msvc_env.items()} # Update process's environment with this diff --git a/setup.py b/setup.py index df63b9bb3..046668b07 100644 --- a/setup.py +++ b/setup.py @@ -290,7 +290,7 @@ python_requires=">=3.6", install_requires=["numpy>=1.17", "psutil", "importlib-metadata>=1.0;python_version<'3.8'", - "setuptools<74.0"], + "setuptools"], extras_require={ "doc": ["sphinx", "sphinx-gallery", "sphinx-argparse"], "userproject": ["mnist", "tqdm", "scipy", "matplotlib"],