Problems with Python subprocesses from Maya GUI
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi there!
I'm kind of desperate with a weird issue that just appeared suddenly without any particular reason/explanation. I'm pretty sure that this is related to something on our side, but I do not know what it is, where to look at and how to fix this. I double checked with IT and they tell me that nothing changed on their side neither.
So, I just hope if you guys could give me just some input that might help me giving some direction to where look into.
Here is my problem:
It started suddenly, yesterday after lunch time that I'm not able anymore to launch Python instances from within a subprocess launched from Maya in GUI mode.
I create a simple executable file that looks like this:
#!/usr/bin/env python
print("Hello World!")Let's say, I save this file to '/tmp/test' and chmod it to 775 to make it executable.
I open Maya, and in the Python script editor, I use following code:
import subprocess
subprocess.call(["/tmp/test"])
# or
# subprocess.call("/tmp/test", shell=True)And I get following in my terminal:
Could not find platform independent libraries <prefix> Could not find platform dependent libraries <exec_prefix> Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] ImportError: No module named site
When I launch my system python, mayapy or any other software with a Python interpretor and execute the same Python code, I get my expected 'Hello World!' printed in my terminal.
Checking a bit internet about this strange error (that I did not see before), people talking about bad Python installations or corrupted virtual environments. But this cannot be the case on my side. I checked multiple Maya versions, and all fail the same way. There is no reason that suddenly, all our Maya installations are broken.
I tried as well to set PYTHONHOME to '/usr/bin/python'. In this case, I just get the import error of the 'site' module.
I tried as well to launch python in verbosity and got this:
Could not find platform independent libraries <prefix> Could not find platform dependent libraries <exec_prefix> Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] # installing zipimport hook import zipimport # builtin # installed zipimport hook # trying site.so # trying sitemodule.so # trying site.py # trying site.pyc # trying /opt/software/thirdparty/autodesk/maya/2018.4/plug-ins/MASH/scripts/site.so # trying /opt/software/thirdparty/autodesk/maya/2018.4/plug-ins/MASH/scripts/sitemodule.so # trying /opt/software/thirdparty/autodesk/maya/2018.4/plug-ins/MASH/scripts/site.py # trying /opt/software/thirdparty/autodesk/maya/2018.4/plug-ins/MASH/scripts/site.pyc # trying /opt/software/thirdparty/autodesk/maya/2018.4/plug-ins/camd/scripts/site.so # trying /opt/software/thirdparty/autodesk/maya/2018.4/plug-ins/camd/scripts/sitemodule.so # trying /opt/software/thirdparty/autodesk/maya/2018.4/plug-ins/camd/scripts/site.py # trying /opt/software/thirdparty/autodesk/maya/2018.4/plug-ins/camd/scripts/site.pyc # trying /opt/software/thirdparty/autodesk/maya/2018.4/plug-ins/camd/scripts/site.so # trying /opt/software/thirdparty/autodesk/maya/2018.4/plug-ins/camd/scripts/sitemodule.so # trying /opt/software/thirdparty/autodesk/maya/2018.4/plug-ins/camd/scripts/site.py # trying /opt/software/thirdparty/autodesk/maya/2018.4/plug-ins/camd/scripts/site.pyc # trying /opt/software/thirdparty/autodesk/maya/2018.4/plug-ins/camd/scripts/site.so # trying /opt/software/thirdparty/autodesk/maya/2018.4/plug-ins/camd/scripts/sitemodule.so # trying /opt/software/thirdparty/autodesk/maya/2018.4/plug-ins/camd/scripts/site.py # trying /opt/software/thirdparty/autodesk/maya/2018.4/plug-ins/camd/scripts/site.pyc # trying /opt/software/thirdparty/autodesk/maya/2018.4/plug-ins/substance/scripts/site.so # trying /opt/software/thirdparty/autodesk/maya/2018.4/plug-ins/substance/scripts/sitemodule.so # trying /opt/software/thirdparty/autodesk/maya/2018.4/plug-ins/substance/scripts/site.py # trying /opt/software/thirdparty/autodesk/maya/2018.4/plug-ins/substance/scripts/site.pyc # trying /opt/software/thirdparty/autodesk/maya/2018.4/plug-ins/xgen/scripts/site.so # trying /opt/software/thirdparty/autodesk/maya/2018.4/plug-ins/xgen/scripts/sitemodule.so # trying /opt/software/thirdparty/autodesk/maya/2018.4/plug-ins/xgen/scripts/site.py # trying /opt/software/thirdparty/autodesk/maya/2018.4/plug-ins/xgen/scripts/site.pyc ImportError: No module named site
I see that it tries to find the 'site' module. But I can import it in my Maya Python script editor, I can import it in my system python and mayapy.
So, if anyone could give me a hint, I would be happy.
Thanks for your time!
Greets,
Carlo