Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RHEL8/Python 3.8: cocotb 1.7.1 wheel install fails with "ModuleNotFoundError: No module named 'pygpi'"

See original GitHub issue
    I've uninstalled cocotb, changed Python to 3.9 and installed cocotb again
pip3 uninstall cocotb
dnf module install python39
alternatives --config python3
pip3 install cocotb --user --verbose

Wheel install:

Collecting cocotb
  Created temporary directory: /tmp/pip-unpack-otqwhxbk
  Looking up "" in the cache
  No cache entry available
  Starting new HTTPS connection (1): "GET /packages/77/90/5a819a2eaa92fbdd53e5031b86ef49d610cb8283cea2efa5e22864ce7b14/cocotb-1.7.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl HTTP/1.1" 200 3695683
  Downloading cocotb-1.7.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.7 MB)
     |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 3.7 MB 6.4 MB/s eta 0:00:01  Ignoring unknown cache-control directive: immutable
  Updating cache with response from ""
  Caching due to etag
     |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 3.7 MB 6.4 MB/s
  Added cocotb from to build tracker '/tmp/pip-req-tracker-1rsv85er'
  Removed cocotb from from build tracker '/tmp/pip-req-tracker-1rsv8
Installing collected packages: cocotb

However now the simulation fails with:

asim   +access +w -interceptcoutput -O2 -dbg -pli /home/adrian/.local/lib/python3.9/site-packages/cocotb/libs/ endian_swapper_mixed
# ELBREAD: Elaboration process.
# ELBREAD: Elaboration time 0.0 [s].
# KERNEL: Main thread initiated.
# KERNEL: Kernel process initialization phase.
# ELAB2: Elaboration final pass...
# KERNEL: PLI/VHPI kernel's engine initialization done.
# PLI: Loading library '/home/adrian/.local/lib/python3.9/site-packages/cocotb/libs/'
# COUT:      -.--ns INFO     gpi                                ..mbed/gpi_embed.cpp:76   in set_program_name_in_venv        Did not detect Python virtual environment. Using system-wide Python interpreter
# COUT:      -.--ns INFO     gpi                                ../gpi/GpiCommon.cpp:101  in gpi_print_registered_impl       VPI registered
# COUT:      -.--ns INFO     gpi                                ../gpi/GpiCommon.cpp:101  in gpi_print_registered_impl       VHPI registered
# PLI: Loading library '/opt/aldec/rivierapro/bin/'
# ELAB2: Create instances ...
# KERNEL: Time resolution set to 1ps.
# ELAB2: Create instances complete.
# ELAB2: Elaboration final pass complete - time: 0.0 [s].
# KERNEL: Kernel process initialization done.
# Allocation: Simulator allocated 6642 kB (elbread=427 elab2=6064 kernel=150 sdf=0)
# KERNEL: ASDB file was created in location /afs/
run -all
# COUT: ModuleNotFoundError: No module named 'pygpi'

_Originally posted by @abyszuk in

@imphil I’ve tried debugging this ModuleNotFoundError and it could be a problem in cocotb-config, but that’s just my guess.

adrian@pcte247806:tests$ cocotb-config --libpython

However, having multiple python versions installed, there are also multiple libpython binaries:

adrian@pcte247806:/$ ls -l /usr/lib64/ 
-rwxr-xr-x 1 root root 6888 Sep 10  2021 /usr/lib64/

adrian@pcte247806:/$ ls -l /lib64/ 
-rwxr-xr-x 1 root root 3918968 Aug 25  2021 /lib64/

adrian@pcte247806:/$ ls -l /lib64/ 
-rwxr-xr-x 1 root root 3289680 Sep 10  2021 /lib64/

I’ve managed to make some progress by manually modifying Makefile.riviera and adding LIBPYTHON_LOC=/lib64/

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:18 (12 by maintainers)

github_iconTop GitHub Comments

abyszukcommented, Oct 5, 2022

It works!

adrian@pcte247806:tb$ python3.9 -m find_libpython

adrian@pcte247806:tb$ ls -l /usr/lib64/ 
-rwxr-xr-x 1 root root 3918968 Aug 25  2021 /usr/lib64/
imphilcommented, Nov 15, 2022

cocotb 1.7.2 is now released and should resolve the issue you were seeing. Please reopen this isuse if the problem persists.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Default not found with binary install #3083
RHEL8/Python 3.8 : cocotb 1.7.1 wheel install fails with "ModuleNotFoundError: No module named 'pygpi'" #3097.
Read more >
cocotb/Lobby - Gitter
ModuleNotFoundError : No module named 'pygpi' # Loading std.standard ... failed install cocotb by pip3 when use the local package download from pypi,Β ......
Read more >
No module named 'wheel' during pythonnet installation on ...
I am running into this ModuleNotFoundError: No module named 'wheel' error. I did some research and I could not find a fix for...
Read more >
Release Notes β€” cocotb 1.7.2 documentation
Its latest version resolves an issue for users on RedHat Enterprise Linux (RHEL) 8 and Python 3.8, where the correct Python library would...
Read more >
cocotb - PyPI
cocotb is a coroutine based cosimulation library for writing VHDL and Verilog testbenches in Python. Documentation Status CI PyPI Gitpod Ready-to-Code ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found