Boris, I have been able to fix the issue with the following commands. They're a little specific to my system, but the overall idea might be helpful to others who are having issues with getting the correct Python version to be used to build Gem5, especially in light of the fact that the "python3 -m venv" command doesn't actually create a usable Python virtual environment.
cd /tools/Python/python3.8.16/bin/python3 -m venv pyenv3816-base cp -r /tools/Python/python3.8.16/ pyenv3816-manual cd pyenv3816-manual/lib/pkgconfig/ # Edit "python-3.8-embed.pc" to set "prefix=/home/$USER/pyenv3816-manual". # Edit "python-3.8.pc" to set "prefix=/home/$USER/pyenv3816-manual". cd /home/$USER/pyenv3816-manual/bin cp /home/$USER/pyenv3816-base/bin/activate* . # Edit "activate" to set 'VIRTUAL_ENV="/home/$USER/pyenv3816-manual"' cd /home/$USER/pyenv3816-manual/ cp /home/$USER/pyenv3816-base/pyvenv.cfg . # Edit "pyvenv.cfg" to set "home = /home/$USER/pyenv3816-manual" cd export PATH="/home/$USER/.local/bin:$PATH" export LD_LIBRARY_PATH="/home/$USER/pyenv3816-manual/lib/:$LD_LIBRARY_PATH" source /home/$USER/pyenv3816-manual/bin/activate pip install --upgrade pip pip install pydot graphviz importlib_metadata This finally puts me in a working Python environment with the v3.8.16 version. This environment has the needed "python3-config", it has the needed header files, and it has the needed libraries. It's basically creating a complete Python environment and then augmenting it with the "activate" script (and friends), which allows using it as if it were a virtual environment. Thanks again for all your help. Cheers, ~Aaron Vose -----Original Message----- From: Aaron Vose Sent: Wednesday, June 28, 2023 8:17 AM To: Boris Shingarov <shinga...@labware.com>; The gem5 Users mailing list <gem5-users@gem5.org> Subject: RE: [gem5-users] Gem5 with pydot Boris, You have found exactly what my issue is! I'm running out of a python3 virtual environment created / activated with: "/tools/Python/python3.9.6/bin/python3 -m venv ~/pyenv396" "source ~/pyenv396/bin/activate" The issue is that the virtual environment created in this way does not contain "python3-config". prompt> ls ~/pyenv396/bin/python3-config ls: cannot access /home/avose/pyenv396/bin/python3-config: No such file or directory So, the system's version of python3-config is used instead: prompt> which python3-config /bin/python3-config So, it seems creating and using a python virtual environment in the usual way is not enough for building Gem5. I need to find some other way to get a Python environment setup that has the needed "python3-config" along with all the include / header files and libraries needed by Gem5. Thanks much, ~Aaron Vose -----Original Message----- From: Boris Shingarov <shinga...@labware.com> Sent: Wednesday, June 28, 2023 3:05 AM To: Aaron Vose <av...@maxlinear.com>; The gem5 Users mailing list <gem5-users@gem5.org> Subject: Re: [gem5-users] Gem5 with pydot This email was sent from outside of MaxLinear. Which Python interpreter to embed is a compile-time decision, generally controlled by python3-config / python-config. What does python3-config --ldflags say? Also, what does 'ldd -r gem5.opt' say about libpython? You may also want to search for PYTHON_CONFIG in SConstruct to understand how scons selects the libpython to link to. On 6/27/23 19:40, Aaron Vose wrote: > It does look like the python environment doesn't seem to contain "pydot"; > this is from running gem5: > *** ModuleNotFoundError: No module named 'pydot' > (Pdb) import sys > (Pdb) sys.version_info > sys.version_info(major=3, minor=6, micro=8, releaselevel='final', > serial=0) > > It seems like the Python environment that Gem5 is using above doesn't match > the Python environment I see from running "python3" manually on the command > line: >>>> import sys >>>> sys.version_info > sys.version_info(major=3, minor=9, micro=6, releaselevel='final', > serial=0) > > When I'm building Gem5, I attempt to specify a python version by running the > following: > python3 `which scons` build/RISCV/gem5.opt -j 16 > > In this environment, python3 says (python3 --version): "Python 3.9.6". That's > what I want, and that one has pydot available. > > Maybe my SCons version is influencing things and forcing Python v3.6.8 > somehow? > > Cheers, > ~Aaron Vose > > -----Original Message----- > From: Aaron Vose > Sent: Tuesday, June 27, 2023 7:19 PM > To: Boris Shingarov <shinga...@labware.com>; The gem5 Users mailing > list <gem5-users@gem5.org> > Subject: RE: [gem5-users] Gem5 with pydot > >> Have you rebuilt gem5? > > After rebuilding Gem5, the changes to the "dot_writer.py" are activated. I'll > poke around here and see what I can find.. not sure what's wrong with it yet. > > Thanks much, > ~Aaron Vose > > -----Original Message----- > From: Aaron Vose > Sent: Tuesday, June 27, 2023 7:01 PM > To: Boris Shingarov <shinga...@labware.com>; The gem5 Users mailing > list <gem5-users@gem5.org> > Subject: RE: [gem5-users] Gem5 with pydot > >> Have you rebuilt gem5? > > I have rebuilt after installing pydot, but I don't remember if I did after > changing the "dot_writer.py" file. > I will rebuild again just to be sure. > Thanks much for your help with this. > > Cheers, > ~Aaron Vose > > -----Original Message----- > From: Boris Shingarov <shinga...@labware.com> > Sent: Tuesday, June 27, 2023 6:58 PM > To: Aaron Vose <av...@maxlinear.com>; The gem5 Users mailing list > <gem5-users@gem5.org> > Subject: Re: [gem5-users] Gem5 with pydot > > This email was sent from outside of MaxLinear. > > > Have you rebuilt gem5? > > On 6/27/23 18:52, Aaron Vose wrote: >> Boris, >> >> Thanks much for your suggestion! It's very interesting, because I've done as >> you suggested, and it doesn't seem to drop me into a debug shell at all. I >> even changed those lines in "dot_writer.py" to be the following, and I don't >> see any of the print messages I added. It doesn't print any of my new >> additions at all: >> try: >> import pydot >> print("!!avose: Have PyDot!"); >> except: >> print("!!avose: Miss PyDot!"); >> pydot = False >> >> I wonder if support for pydot is somehow disabled elsewhere? When I try the >> above code in a new file called "test_pydot.py", I do see what I would >> expect: "!!avose: Have PyDot!". >> >> Thanks again, >> ~Aaron Vose >> >> -----Original Message----- >> From: Boris Shingarov <shinga...@labware.com> >> Sent: Monday, June 26, 2023 3:22 PM >> To: The gem5 Users mailing list <gem5-users@gem5.org> >> Cc: Aaron Vose <av...@maxlinear.com> >> Subject: Re: [gem5-users] Gem5 with pydot >> >> This email was sent from outside of MaxLinear. >> >> >> I would debug it like this: >> >> Near the beginning of dot_writer.py, there is: >> >> try: >> import pydot >> except: >> pydot = False >> >> Replace the "pydot = False" with "import pdb; pdb.set_trace()". >> This will drop you into a debug shell where you can investigate why "import >> pydot" failed. >> >> On 6/26/23 14:30, Aaron Vose via gem5-users wrote: >>> All my runs (and many, many examples I see online) have the >>> following warning message: >>> >>> “warn: No dot file generated. Please install pydot to generate the >>> dot file and pdf.” >>> >>> However, I know I have pydot installed; see the following: >>> >>> prompt> pip install pydot >>> >>> Requirement already satisfied: pydot in >>> /home/avose/pyenv396/lib/python3.9/site-packages (1.4.2) >>> >>> Requirement already satisfied: pyparsing>=2.1.4 in >>> /home/avose/pyenv396/lib/python3.9/site-packages (from pydot) >>> (3.1.0) >>> >>> I even went back and rebuilt the entire Gem5 again from scratch >>> after I made sure pydot was installed. I made sure I built Gem5 >>> using the same environment (/home/avose/pyenv396) in which I >>> installed pydot, and I still see this warning, and I don’t get any dot >>> output. >>> >>> Does anyone else have a similar problem or any advice on how to fix this? >>> >>> Thanks much, >>> >>> ~Aaron Vose >>> >>> >>> _______________________________________________ >>> gem5-users mailing list -- gem5-users@gem5.org To unsubscribe send >>> an email to gem5-users-le...@gem5.org >> > _______________________________________________ gem5-users mailing list -- gem5-users@gem5.org To unsubscribe send an email to gem5-users-le...@gem5.org