On Sun, Sep 2, 2018, 10:36 AM Joe Weidenbach <[email protected]> wrote:

> Hey all,
>
> During a recent bout of programming zealousness, I blew away most of my
> previous mess of an environment and set myself to a cleaner package-based
> install. Now, I’ve loaded maya for the first time since, and it can’t load
> python properly. There was a previous post in here about this for Maya
> 2013, but this is for 2018, and I’d rather not resurrect a really old
> thread.
>
> I’m on windows for this machine, but again I suspect that it’s a more
> widespread issue as I have replicated it on Linux.
>
> The package manager (chocolatey) set up python with the PYTHONHOME
> environment variable, so now Maya can’t find it’s python libraries.
>
> The stack trace:
>
> Could not find maya.utils._guiExceptHook.
> Invalid Python Environment: Python is unable to find Maya's Python modules
> Python Environment:
>   PYTHONHOME = C:\Python27
>   PYTHONPATH = ;C:/Program 
> Files/Autodesk/Maya2018/plug-ins/ATF/scripts;C:/Program 
> Files/Autodesk/Bifrost/Maya2018/scripts/boss;C:/Program 
> Files/Autodesk/Bifrost/Maya2018/scripts/presets;C:/Program 
> Files/Autodesk/Bifrost/Maya2018/scripts;C:/Program 
> Files/Autodesk/Maya2018/plug-ins/MASH/scripts;d:/Users/joe/Documents/maya/modules/ZivaVFX-Maya-1_2/scripts;C:/Program
>  Files/Autodesk/Maya2018/plug-ins/fbx/scripts;C:/Program 
> Files/Autodesk/Maya2018/plug-ins/camd/scripts;C:/solidangle/mtoadeploy/2018/scripts;C:/ProgramData/Autodesk/ApplicationPlugins/ngskintools/Contents/scripts;C:/Program
>  Files/Autodesk/Maya2018/plug-ins/camd/scripts;C:/Program 
> Files/Autodesk/Maya2018/plug-ins/camd/scripts;C:/Program 
> Files/Autodesk/Maya2018/plug-ins/substance/scripts;C:/Program 
> Files/Autodesk/Maya2018/plug-ins/xgen/scripts/cafm;C:/Program 
> Files/Autodesk/Maya2018/plug-ins/xgen/scripts/xgenm;C:/Program 
> Files/Autodesk/Maya2018/plug-ins/xgen/scripts/xgenm/ui;C:/Program 
> Files/Autodesk/Maya2018/plug-ins/xgen/scripts/xgenm/xmaya;C:/Program 
> Files/Autodesk/Maya2018/plug-ins/xgen/scripts/xgenm/ui/ae;C:/Program 
> Files/Autodesk/Maya2018/plug-ins/xgen/scripts/xgenm/ui/brushes;C:/Program 
> Files/Autodesk/Maya2018/plug-ins/xgen/scripts/xgenm/ui/dialogs;C:/Program 
> Files/Autodesk/Maya2018/plug-ins/xgen/scripts/xgenm/ui/fxmodules;C:/Program 
> Files/Autodesk/Maya2018/plug-ins/xgen/scripts/xgenm/ui/tabs;C:/Program 
> Files/Autodesk/Maya2018/plug-ins/xgen/scripts/xgenm/ui/util;C:/Program 
> Files/Autodesk/Maya2018/plug-ins/xgen/scripts/xgenm/ui/widgets;C:/Program 
> Files/Autodesk/Maya2018/plug-ins/xgen/scripts
>   System modules located at: C:\Program 
> Files\Autodesk\Maya2018\bin\python27.zip
>   Search path (sys.path):
>     C:\Program Files\Autodesk\Maya2018\bin
>     C:\Python27\lib\site-packages\rez-2.0.rc1.39-py2.7.egg
>     C:\Program Files\Autodesk\Maya2018\bin
>     C:\Program Files\Autodesk\Maya2018\plug-ins\ATF\scripts
>     C:\Program Files\Autodesk\Bifrost\Maya2018\scripts\boss
>     C:\Program Files\Autodesk\Bifrost\Maya2018\scripts\presets
>     C:\Program Files\Autodesk\Bifrost\Maya2018\scripts
>     C:\Program Files\Autodesk\Maya2018\plug-ins\MASH\scripts
>     d:\Users\joe\Documents\maya\modules\ZivaVFX-Maya-1_2\scripts
>     C:\Program Files\Autodesk\Maya2018\plug-ins\fbx\scripts
>     C:\Program Files\Autodesk\Maya2018\plug-ins\camd\scripts
>     C:\solidangle\mtoadeploy\2018\scripts
>     C:\ProgramData\Autodesk\ApplicationPlugins\ngskintools\Contents\scripts
>     C:\Program Files\Autodesk\Maya2018\plug-ins\substance\scripts
>     C:\Program Files\Autodesk\Maya2018\plug-ins\xgen\scripts\cafm
>     C:\Program Files\Autodesk\Maya2018\plug-ins\xgen\scripts\xgenm
>     C:\Program Files\Autodesk\Maya2018\plug-ins\xgen\scripts\xgenm\ui
>     C:\Program Files\Autodesk\Maya2018\plug-ins\xgen\scripts\xgenm\xmaya
>     C:\Program Files\Autodesk\Maya2018\plug-ins\xgen\scripts\xgenm\ui\ae
>     C:\Program Files\Autodesk\Maya2018\plug-ins\xgen\scripts\xgenm\ui\brushes
>     C:\Program Files\Autodesk\Maya2018\plug-ins\xgen\scripts\xgenm\ui\dialogs
>     C:\Program 
> Files\Autodesk\Maya2018\plug-ins\xgen\scripts\xgenm\ui\fxmodules
>     C:\Program Files\Autodesk\Maya2018\plug-ins\xgen\scripts\xgenm\ui\tabs
>     C:\Program Files\Autodesk\Maya2018\plug-ins\xgen\scripts\xgenm\ui\util
>     C:\Program Files\Autodesk\Maya2018\plug-ins\xgen\scripts\xgenm\ui\widgets
>     C:\Program Files\Autodesk\Maya2018\plug-ins\xgen\scripts
>     C:\Program Files\Autodesk\Maya2018\bin\python27.zip
>     C:\Python27\DLLs
>     C:\Python27\lib
>     C:\Python27\lib\plat-win
>     C:\Python27\lib\lib-tk
>     C:\Python27
>     C:\Python27\lib\site-packages
>
> There’s a huge number of these in the output, I expect it’s one per call
> to Python.
>
> I’d not expect that unsetting PYTHONHOME is expected/required by autodesk
> (although this disproves that theory), as the whole point of shipping
> mayapy is to get away from requiring the system install of python
>
>From reading the docs it seems to be the opposite. Mayapy is shipped to
ensure Maya is correctly bootstrapped for standalone python usage by
providing the correct version of python along with the location of the Maya
libs.


(other benefits include things like being able to use a python compiled
> with VC15, allowing the use of PySide2). The question in my mind would be,
> has anyone found a way to isolate Maya from the system python environment
> so it can be run side by side with other development tools that require
> PYTHONHOME or other features like this?
>
What happens if you set PYTHONHOME explicitly to Maya's location in the
Maya.env file (similar to what mayapy does)?

I would have expected Maya to always set PYTHONHOME to its internal
location before it initialises its embedded Python interpreter so as to
avoid conflicts with the parent process environment. But that doesn't seem
to be the case if you can break it like this.


I can’t imagine it’s that rare of a need.
>
> Also, I tried to work through this with no luck: Python from an external
> interpreter
> <https://knowledge.autodesk.com/support/maya/learn-explore/caas/CloudHelp/cloudhelp/2016/ENU/Maya/files/GUID-83799297-C629-48A8-BCE4-061D3F275215-htm.html>.
> It seems that something in 2018 completely breaks using an external
> interpreter that could, for example, use virtualenvs to manage dependencies
> (this did work as recently as 2016).
>
> Thanks in advance,
>
> Joe
> ​
>
> --
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/0e7033ed-58d2-487b-accd-7c5e29138483%40googlegroups.com
> <https://groups.google.com/d/msgid/python_inside_maya/0e7033ed-58d2-487b-accd-7c5e29138483%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA2Q1XO%2B%2BK0k3z%2Bqvi9xo9_66zQeqVR7EeNE%2BNC25aowWA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to