PYTHONHOME issue?
See original GitHub issueI had cocotb running in our work environment only last week or so, but something has started to cause the following issue.
I’m on CentOS 7 and the SIM=xcelium
The simple_dff
example appears to die the same way, so here’s the output from that:
module worklib.dff:sv
errors: 0, warnings: 0
-.--ns INFO cocotb.gpi ..mbed/gpi_embed.cpp:74 in set_program_name_in_venv Did not detect Python virtual environment. Using system-wide Python interpreter
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ModuleNotFoundError: No module named 'encodings'
Current thread 0x00007fa44e62ee00 (most recent call first):
ImportError: No module named site
xmelab: *F,INTERR: INTERNAL EXCEPTION
Some output from cocotb-config
:
$ cocotb-config --version
1.4.0rc1
$ cocotb-config --python-bin
/usr/bin/python3
$ cocotb-config --prefix
/usr/local/lib64/python3.6/site-packages
Running the following (as per Makefile.inc
’s way of calculating PYTHONHOME
):
$ /usr/bin/python3 -c 'from distutils.sysconfig import get_config_var; print(get_config_var("prefix"))'
/usr
An interesting observation (I think anyway?) is if I set PYTHONHOME
to /usr/local
under which the site-packages/cocotb
is really located (as per the cocotb-config
output), I see the same crash.
$ PYTHONHOME=/usr /usr/bin/python3
Python 3.6.8 (default, Apr 2 2020, 13:34:55)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
$ PYTHONHOME=/usr/local /usr/bin/python3
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ModuleNotFoundError: No module named 'encodings'
Current thread 0x00007f4ce0135740 (most recent call first):
Aborted
Any ideas? I’m quite certain this worked only a week ago, I just updated to the latest cocotb, but I’m not ruling out something changing on my system, too.
Thanks for any pointers, and great job with cocotb so far all!!
Issue Analytics
- State:
- Created 3 years ago
- Comments:39 (29 by maintainers)
Top GitHub Comments
Yes, I will attempt to recreate the failure mode. To make it clear: Things started working after removing the hacks that injected libpython via LD_LIBRARY_PATH. These used to work for older versions of Xcelium, but stopped working with Xcelium 20.
Since I was recently able to get the python development packages installed on the systems in question, I do not need to perform these hacks anymore and cocotb works as-is, even in a venv.
The probably easiest option for a bisect is to clone the cocotb repository, and then install with pip from the repository.
Then you can either use
git bisect
or just manually go back to a commit a couple weeks back. Re-runpip install .
after you’ve checked out a different commit.