pythonwindowspipcocotb

pip install cocotb ask me for visual C++ compiler installation


I followed cocotb officials instructions to install package on windows with miniconda3 and :

conda install -c msys2 m2-base m2-make

but I'm blocked on this error :

(base) PS C:\Users\me> pip install cocotb
Collecting cocotb
  Using cached cocotb-1.6.2.tar.gz (209 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: cocotb
  Building wheel for cocotb (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for cocotb (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [86 lines of output]
      Modelsim/Questa executable (vdbg) executable not found. No FLI interface will be available.
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-3.9
      creating build\lib.win-amd64-3.9\cocotb
      copying cocotb\ANSI.py -> build\lib.win-amd64-3.9\cocotb
      copying cocotb\binary.py -> build\lib.win-amd64-3.9\cocotb
      copying cocotb\clock.py -> build\lib.win-amd64-3.9\cocotb
      copying cocotb\config.py -> build\lib.win-amd64-3.9\cocotb
      copying cocotb\decorators.py -> build\lib.win-amd64-3.9\cocotb
      copying cocotb\handle.py -> build\lib.win-amd64-3.9\cocotb
      copying cocotb\ipython_support.py -> build\lib.win-amd64-3.9\cocotb
      copying cocotb\log.py -> build\lib.win-amd64-3.9\cocotb
      copying cocotb\memdebug.py -> build\lib.win-amd64-3.9\cocotb
      copying cocotb\outcomes.py -> build\lib.win-amd64-3.9\cocotb
      copying cocotb\queue.py -> build\lib.win-amd64-3.9\cocotb
      copying cocotb\regression.py -> build\lib.win-amd64-3.9\cocotb
      copying cocotb\result.py -> build\lib.win-amd64-3.9\cocotb
      copying cocotb\scheduler.py -> build\lib.win-amd64-3.9\cocotb
      copying cocotb\triggers.py -> build\lib.win-amd64-3.9\cocotb
      copying cocotb\utils.py -> build\lib.win-amd64-3.9\cocotb
      copying cocotb\wavedrom.py -> build\lib.win-amd64-3.9\cocotb
      copying cocotb\xunit_reporter.py -> build\lib.win-amd64-3.9\cocotb
      copying cocotb\_py_compat.py -> build\lib.win-amd64-3.9\cocotb
      copying cocotb\_sim_versions.py -> build\lib.win-amd64-3.9\cocotb
      copying cocotb\_version.py -> build\lib.win-amd64-3.9\cocotb
      copying cocotb\__init__.py -> build\lib.win-amd64-3.9\cocotb
      creating build\lib.win-amd64-3.9\pygpi
      copying pygpi\entry.py -> build\lib.win-amd64-3.9\pygpi
      copying pygpi\__init__.py -> build\lib.win-amd64-3.9\pygpi
      creating build\lib.win-amd64-3.9\cocotb\types
      copying cocotb\types\array.py -> build\lib.win-amd64-3.9\cocotb\types
      copying cocotb\types\logic.py -> build\lib.win-amd64-3.9\cocotb\types
      copying cocotb\types\logic_array.py -> build\lib.win-amd64-3.9\cocotb\types
      copying cocotb\types\range.py -> build\lib.win-amd64-3.9\cocotb\types
      copying cocotb\types\__init__.py -> build\lib.win-amd64-3.9\cocotb\types
      creating build\lib.win-amd64-3.9\cocotb\_vendor
      copying cocotb\_vendor\distutils_version.py -> build\lib.win-amd64-3.9\cocotb\_vendor
      copying cocotb\_vendor\__init__.py -> build\lib.win-amd64-3.9\cocotb\_vendor
      creating build\lib.win-amd64-3.9\cocotb\_vendor\find_libpython
      copying cocotb\_vendor\find_libpython\_version.py -> build\lib.win-amd64-3.9\cocotb\_vendor\find_libpython
      copying cocotb\_vendor\find_libpython\__init__.py -> build\lib.win-amd64-3.9\cocotb\_vendor\find_libpython
      copying cocotb\_vendor\find_libpython\__main__.py -> build\lib.win-amd64-3.9\cocotb\_vendor\find_libpython
      creating build\lib.win-amd64-3.9\cocotb\share
      creating build\lib.win-amd64-3.9\cocotb\share\makefiles
      copying cocotb\share\makefiles\Makefile.deprecations -> build\lib.win-amd64-3.9\cocotb\share\makefiles
      copying cocotb\share\makefiles\Makefile.inc -> build\lib.win-amd64-3.9\cocotb\share\makefiles
      copying cocotb\share\makefiles\Makefile.sim -> build\lib.win-amd64-3.9\cocotb\share\makefiles
      creating build\lib.win-amd64-3.9\cocotb\share\makefiles\simulators
      copying cocotb\share\makefiles\simulators\Makefile.activehdl -> build\lib.win-amd64-3.9\cocotb\share\makefiles\simulators
      copying cocotb\share\makefiles\simulators\Makefile.cvc -> build\lib.win-amd64-3.9\cocotb\share\makefiles\simulators
      copying cocotb\share\makefiles\simulators\Makefile.ghdl -> build\lib.win-amd64-3.9\cocotb\share\makefiles\simulators
      copying cocotb\share\makefiles\simulators\Makefile.icarus -> build\lib.win-amd64-3.9\cocotb\share\makefiles\simulators
      copying cocotb\share\makefiles\simulators\Makefile.ius -> build\lib.win-amd64-3.9\cocotb\share\makefiles\simulators
      copying cocotb\share\makefiles\simulators\Makefile.modelsim -> build\lib.win-amd64-3.9\cocotb\share\makefiles\simulators
      copying cocotb\share\makefiles\simulators\Makefile.questa -> build\lib.win-amd64-3.9\cocotb\share\makefiles\simulators
      copying cocotb\share\makefiles\simulators\Makefile.riviera -> build\lib.win-amd64-3.9\cocotb\share\makefiles\simulators
      copying cocotb\share\makefiles\simulators\Makefile.vcs -> build\lib.win-amd64-3.9\cocotb\share\makefiles\simulators
      copying cocotb\share\makefiles\simulators\Makefile.verilator -> build\lib.win-amd64-3.9\cocotb\share\makefiles\simulators
      copying cocotb\share\makefiles\simulators\Makefile.xcelium -> build\lib.win-amd64-3.9\cocotb\share\makefiles\simulators
      creating build\lib.win-amd64-3.9\cocotb\share\include
      copying cocotb\share\include\cocotb_utils.h -> build\lib.win-amd64-3.9\cocotb\share\include
      copying cocotb\share\include\embed.h -> build\lib.win-amd64-3.9\cocotb\share\include
      copying cocotb\share\include\exports.h -> build\lib.win-amd64-3.9\cocotb\share\include
      copying cocotb\share\include\gpi.h -> build\lib.win-amd64-3.9\cocotb\share\include
      copying cocotb\share\include\gpi_logging.h -> build\lib.win-amd64-3.9\cocotb\share\include
      copying cocotb\share\include\py_gpi_logging.h -> build\lib.win-amd64-3.9\cocotb\share\include
      copying cocotb\share\include\sv_vpi_user.h -> build\lib.win-amd64-3.9\cocotb\share\include
      copying cocotb\share\include\vhpi_user.h -> build\lib.win-amd64-3.9\cocotb\share\include
      copying cocotb\share\include\vhpi_user_ext.h -> build\lib.win-amd64-3.9\cocotb\share\include
      copying cocotb\share\include\vpi_user.h -> build\lib.win-amd64-3.9\cocotb\share\include
      copying cocotb\share\include\vpi_user_ext.h -> build\lib.win-amd64-3.9\cocotb\share\include
      creating build\lib.win-amd64-3.9\cocotb\share\def
      copying cocotb\share\def\.gitignore -> build\lib.win-amd64-3.9\cocotb\share\def
      copying cocotb\share\def\aldec.def -> build\lib.win-amd64-3.9\cocotb\share\def
      copying cocotb\share\def\ghdl.def -> build\lib.win-amd64-3.9\cocotb\share\def
      copying cocotb\share\def\icarus.def -> build\lib.win-amd64-3.9\cocotb\share\def
      copying cocotb\share\def\modelsim.def -> build\lib.win-amd64-3.9\cocotb\share\def
      copying cocotb\share\def\README.md -> build\lib.win-amd64-3.9\cocotb\share\def
      creating build\lib.win-amd64-3.9\cocotb\share\lib
      creating build\lib.win-amd64-3.9\cocotb\share\lib\verilator
      copying cocotb\share\lib\verilator\verilator.cpp -> build\lib.win-amd64-3.9\cocotb\share\lib\verilator
      running build_ext
      error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for cocotb
Failed to build cocotb
ERROR: Could not build wheels for cocotb, which is required to install pyproject.toml-based projects
(base) PS C:\Users\me>

I tried with global option :

pip install --global-option build_ext --global-option --compiler=mingw32 cocotb

With exactly the same error.

It seems to be a verilator install error. I don't need verilator, maybe there is an option to not install it ?


Solution

  • I finally managed to install cocotb with following procedure on msys2.

    $ pacman -Syu
    [close then re-launch terminal]
    $ pacman -Su
    
    $ pacman -S –needed base-devel mingw-w64-x86_64-toolchain
    $ pacman -S git
    
    $ pacman -S mingw-w64-x86_64-ghdl-llvm
    
    $ pacman -S mingw-w64-x86_64-gtkwave
    
    $ pacman -S mingw-w64-x86_64-python-scipy mingw-w64-x86_64-python-matplotlib mingw-w64-x86_64-python-numpy
    $ pacman -S --needed make mingw-w64-x86_64-gcc mingw-w64-x86_64-python3-pip mingw-w64-x86_64-python3-setuptools mingw-w64-x86_64-python3-wheel
    
    $ pip install --no-build-isolation cocotb
    $ pip install --no-build-isolation pytest
    $ pip install --no-build-isolation cocotbext-axi
    

    I tested this procedure on other windows computer with succes.