Default test " brian2cuda.example_run()" throws error after installation?

Description of problem

I’m trying to install Brian2CUDA as mentioned in Installation — Brian2CUDA 1.0.0 documentation , but the default installation throws an error on my Ubuntu WSL on Windows 11, and I can’t get even a basic install to work at all?

Minimal code to reproduce problem

wsl --install
# wsl --unregister Ubuntu
# wsl --install -d Ubuntu
gcc --version

wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash ./Miniconda3-latest-Linux-x86_64.sh
source ~/.bashrc
conda --version

sudo apt-key del 7fa2af80
wget https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-wsl-ubuntu.pin
sudo mv cuda-wsl-ubuntu.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget https://developer.download.nvidia.com/compute/cuda/11.6.0/local_installers/cuda-repo-wsl-ubuntu-11-6-local_11.6.0-1_amd64.deb
sudo dpkg -i cuda-repo-wsl-ubuntu-11-6-local_11.6.0-1_amd64.deb
sudo apt-key add /var/cuda-repo-wsl-ubuntu-11-6-local/7fa2af80.pub
sudo apt-get update
sudo apt-get -y install cuda
export PATH=${PATH}:/usr/local/cuda-11.6/bin
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/cuda-11.6/lib64
nvcc --version

python -c "import brian2cuda; brian2cuda.example_run()"

What you have already tried

Tried with both CUDA Toolkit version 13.0 (which threw a Thrust requires at least C++17. Define CCCL_IGNORE_DEPRECATED_CPP_DIALECT to suppress this message. error) and version 11.6.0 (which threw sh: 1: make: not found from the traceback below). Please help me do a clean install on WSL so I can run Brian on my PC’s GPU, thanks in advance!

Full traceback of error

 python -c "import brian2cuda; brian2cuda.example_run()"

/home/buidl/miniconda3/lib/python3.13/site-packages/setuptools/_distutils/_msvccompiler.py:12: UserWarning: _get_vc_env is private; find an alternative (pypa/distutils#340)
  warnings.warn(
INFO       CUDA installation directory detected via location of `nvcc` binary: /usr/local/cuda-11.6 [brian2cuda.utils.gputools]
INFO       Compiling device code for GPU 0 (NVIDIA GeForce RTX 4070) [brian2cuda.utils.gputools]
INFO       Compiling device code for compute capability 8.9 (compiler flags: ['-arch=sm_89']) [brian2cuda.device]
INFO       Using the following preferences for CUDA standalone: [brian2cuda.device]
INFO            devices.cuda_standalone.SM_multiplier = 1 [brian2cuda.device]
INFO            devices.cuda_standalone.parallel_blocks = 1 [brian2cuda.device]
INFO            devices.cuda_standalone.launch_bounds = False [brian2cuda.device]
INFO            devices.cuda_standalone.syn_launch_bounds = False [brian2cuda.device]
INFO            devices.cuda_standalone.calc_occupancy = True [brian2cuda.device]
INFO            devices.cuda_standalone.extra_threshold_kernel = True [brian2cuda.device]
INFO            devices.cuda_standalone.random_number_generator_type = CURAND_RNG_PSEUDO_DEFAULT [brian2cuda.device]
INFO            devices.cuda_standalone.random_number_generator_ordering = False [brian2cuda.device]
INFO            devices.cuda_standalone.push_synapse_bundles = True [brian2cuda.device]
INFO            devices.cuda_standalone.threads_per_synapse_bundle = {max} [brian2cuda.device]
INFO            devices.cuda_standalone.bundle_threads_warp_multiple = False [brian2cuda.device]
INFO            devices.cuda_standalone.no_pre_references = False [brian2cuda.device]
INFO            devices.cuda_standalone.no_post_references = False [brian2cuda.device]
INFO            devices.cuda_standalone.default_functions_integral_convertion = <class 'numpy.float64'> [brian2cuda.device]
INFO            devices.cuda_standalone.use_atomics = True [brian2cuda.device]
INFO            devices.cuda_standalone.profile_statemonitor_copy_to_host = None [brian2cuda.device]
INFO            devices.cuda_standalone.cuda_backend.gpu_heap_size = 128 [brian2cuda.device]
INFO            devices.cuda_standalone.cuda_backend.detect_gpus = True [brian2cuda.device]
INFO            devices.cuda_standalone.cuda_backend.gpu_id = None [brian2cuda.device]
INFO            devices.cuda_standalone.cuda_backend.extra_compile_args_nvcc = ['-w', '-use_fast_math'] [brian2cuda.device]
INFO            devices.cuda_standalone.cuda_backend.compute_capability = None [brian2cuda.device]
INFO            devices.cuda_standalone.cuda_backend.detect_cuda = True [brian2cuda.device]
INFO            devices.cuda_standalone.cuda_backend.cuda_path = None [brian2cuda.device]
INFO            devices.cuda_standalone.cuda_backend.cuda_runtime_version = None [brian2cuda.device]
INFO            devices.cuda_standalone.cuda_backend.device_query_path = None [brian2cuda.device]
sh: 1: make: not found
ERROR      Brian 2 encountered an unexpected error. If you think this is a bug in Brian 2, please report this issue either to the discourse forum at <http://brian.discourse.group/>, or to the issue tracker at <https://github.com/brian-team/brian2/issues>. Please include this file with debug information in your report: /tmp/brian_debug_2yd9_gbq.log  You can also include a copy of the redirected std stream outputs, available at '/tmp/brian_stdout_yylgcg7h.log' and '/tmp/brian_stderr_crm6cx23.log'. Thanks! [brian2]
Traceback (most recent call last):
  File "<string>", line 1, in <module>
    import brian2cuda; brian2cuda.example_run()
                       ~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/buidl/miniconda3/lib/python3.13/site-packages/brian2cuda/__init__.py", line 73, in example_run
    device.build(direct_call=False, directory=directory, **build_options)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/buidl/miniconda3/lib/python3.13/site-packages/brian2cuda/device.py", line 1499, in build
    self.compile_source(directory, cpp_compiler, debug, clean)
    ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/buidl/miniconda3/lib/python3.13/site-packages/brian2/devices/cpp_standalone/device.py", line 1185, in compile_source
    raise RuntimeError(error_message)
RuntimeError: Project compilation failed (error code: 32512). Consider running with "clean=True" to force a complete rebuild.

Hi @alexyz. Unfortunately, none of the developers uses brian2cuda via WSL on Windows, so we don’t have much experience with this setup. From the error message, it seems to be missing the make utility. Could you try installing the build-essential package (which will install make and maybe other things)?

sudo apt-get install build-essential

Please let us know whether this helps!

1 Like

Thanks for the super fast response Marcel! I spent the whole day fighting this and was finally able to make it work by picking older versions of multiple packages, listing them here for anyone reading this in the future:

  • Ubuntu: 22.04 on WSL distro
  • gcc: 11.4.0
  • CUDA Toolkit (and thus nvcc): 12.5.0
  • Brian2CUDA: 1.0a8
1 Like