OSError: [Errno 74] Bad message: ‘/usr/lib/python3/dist-packages’

I am getting the following error in every Python activity on Jetson orin nano please help me resolve this.

t-tech@ttech-desktop:~$ python3
Error in sitecustomize; set PYTHONVERBOSE for traceback:
OSError: [Errno 74] Bad message: ‘/usr/lib/python3/dist-packages’
Error in usercustomize; set PYTHONVERBOSE for traceback:
OSError: [Errno 74] Bad message: ‘/usr/lib/python3/dist-packages’
Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] on linux
Type “help”, “copyright”, “credits” or “license” for more information.

Hi,

Have you installed or tried any command before meeting the error with python3?
Based on the online information, the error seems to relate to PyCharm.

Thanks.

@AastaLLL thanks for your response.

Not as such, install Python virtual environment. Everything was fine till yesterday and I started accessing the Jetson Orin Nano through SSH, and the following thing pops up

  1. OSError: [Errno 74] Bad message: ‘/usr/lib/python3/dist-packages’

  2. Error in usercustomize; set PYTHONVERBOSE for traceback:

  3. OSError: [Errno 74] Bad message: ‘/usr/lib/python3/dist-packages’

  4. Traceback (most recent call last):

  5. File “/usr/lib/python3.10/runpy.py”, line 187, in _run_module_as_main

  6. mod_name, mod_spec, code = _get_module_details(mod_name, _Error)

  7. File “/usr/lib/python3.10/runpy.py”, line 110, in _get_module_details

  8. import(pkg_name)

  9. File “”, line 1027, in _find_and_load

  10. File “”, line 1002, in _find_and_load_unlocked

  11. File “”, line 945, in _find_spec

  12. File “”, line 1439, in find_spec

  13. File “”, line 1411, in _get_spec

  14. File “”, line 1548, in find_spec

  15. File “”, line 1591, in _fill_cache

  16. OSError: [Errno 74] Bad message: ‘/usr/lib/python3/dist-packages’

  17. virtualenvwrapper.sh: There was a problem running the initialization hooks.

  • If Python could not import the module virtualenvwrapper.hook_loader,
  1. check that virtualenvwrapper has been installed for

  2. VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3 and that PATH is

  3. set properly.

I could not find the solution to this issue, so I commented the following lines in ./bashrc file i.e.

#export WORKON_HOME=$HOME/.virtualenvs
#export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
#export VIRTUALENVWRAPPER_VIRTUALENV=/usr/local/bin/virtualenv
#source /usr/local/bin/virtualenvwrapper.sh

then above error for the virtual environment vanish but for every Python activity the OS error is still there.

@linuxdev May please help to resolve this error? Thanks in advance.

I’m not actually all that good with Python. However, one thing to consider is that perhaps there is more than one Python interpreter involved and something wants an update, but the one which is updated is the other version. I’d start by updating packages:

sudo apt update
sudo apt-get upgrade

Then I would see which versions are involved:

which python2
which python3
python --version
python2 --version
python3 --version

If you then have any kid of script referencing just “python”, then explicitly change it to the version you are interested in, e.g., replace “python” in a script with either “python2” or “python3”. At least then you know you are consistently using the major release you intend.

You might also try running test commands in the command line interpreter while specifically naming either python2 or python3 and seeing of one of them breaks.

I am sad to say I do not know enough about Python environments to be of much further help.

Unfortunately, I reflashed the Jetson Orin Nano using SDK Manager, and the issue is resolved. Thanks

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.