Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Maya: Missing PyMEL issue #2353

Closed
antirotor opened this issue Dec 1, 2021 · 10 comments · Fixed by #2445 or #4724
Closed

Maya: Missing PyMEL issue #2353

antirotor opened this issue Dec 1, 2021 · 10 comments · Fixed by #2445 or #4724
Labels
host: Maya type: bug Something isn't working

Comments

@antirotor
Copy link
Member

antirotor commented Dec 1, 2021

Problem

Some of publishing plugins are not working in Maya 2022 because of missing pymel module:

Skipped: "%s" (%s) collect_ass No module named 'pymel'
Skipped: "%s" (%s) collect_renderable_camera No module named 'pymel'
Skipped: "%s" (%s) collect_review No module named 'pymel'
Skipped: "%s" (%s) extract_playblast No module named 'pymel'
Skipped: "%s" (%s) extract_thumbnail No module named 'pymel'
Skipped: "%s" (%s) validate_attributes No module named 'pymel'
Skipped: "%s" (%s) validate_mesh_arnold_attributes No module named 'pymel'
Skipped: "%s" (%s) validate_mesh_overlapping_uvs No module named 'pymel'
Skipped: "%s" (%s) validate_no_namespace No module named 'pymel'
Skipped: "%s" (%s) validate_render_image_rule No module named 'pymel'
Skipped: "%s" (%s) validate_rig_output_ids No module named 'pymel'

PyMel is can be missing from Maya (can be installed separately) and we should account for that.

It can be installed like mayapy -m pip install pymel or mayapy -m pip install --user pymel

We should use Validator to find out if we have pymel available and instruct user to install it, or we should do it automatically (tricky, because it will either neeed Administrator privilegues as it will modify maya install location, or it will install per user)

[cuID:OP-2084]

@antirotor antirotor added type: bug Something isn't working host: Maya labels Dec 1, 2021
@BigRoy
Copy link
Collaborator

BigRoy commented Dec 15, 2021

Without Pymel the user is also unable to e.g. load a published model - resulting in an error like this:
maya_load_model_no_pymel

@BigRoy
Copy link
Collaborator

BigRoy commented Dec 15, 2021

We should use Validator to find out if we have pymel available and instruct user to install it, or we should do it automatically (tricky, because it will either neeed Administrator privilegues as it will modify maya install location, or it will install per user)

That wouldn't be the case if we just provide the pymel package as a dependency to OpenPype however. Nevertheless, the easier fix might be to not reply on Pymel altogether.

@ClementHector
Copy link
Contributor

We can verify / solve this problem in several places:

  • In the launcher, check with mayapy pip seach mayapy
  • When starting maya, check with import pymel
  • In pyblish, check with a pyblish plugin and a resolver

@ClementHector
Copy link
Contributor

That wouldn't be the case if we just provide the pymel package as a dependency to OpenPype however. Nevertheless, the easier fix might be to not reply on Pymel altogether.

I am afraid that this may not be possible because some future version of pymel may not work with maya 2022 and pymel which must install by mayapy.

@BigRoy
Copy link
Collaborator

BigRoy commented Dec 15, 2021

I am afraid that this may not be possible because some future version of pymel may not work with maya 2022 and pymel which must install by mayapy.

True. We would likely need a pymel version per Maya version in that case.

Anyway, might also be able to just "find" the package without importing it as 'validation' on launch so that Pymel doesn't necessarily try to to initialize.


Just checked, when doing import pymel then Pymel doesn't actually do the slow first initialization. It only triggers that when doing import pymel.core or import pymel.all. So for simplicity we could indeed just do:

try:
    import pymel
except ImportError as exc:
    # Detected failure of importing pymel

@ClementHector
Copy link
Contributor

Anyway, might also be able to just "find" the package without importing it as 'validation' on launch so that Pymel doesn't necessarily try to to initialize.

good idea!

@BigRoy
Copy link
Collaborator

BigRoy commented Feb 25, 2022

The Pymel issue itself isn't fixed with #2445. Machines can still have missing Pymel and get the same 'error'. Just to be aware of.

@mkolar mkolar changed the title Maya 2022: Missing PyMEL issue Maya: Missing PyMEL issue Apr 29, 2022
@mkolar
Copy link
Member

mkolar commented Apr 29, 2022

true. I'm reopening this so we don't forget and remaining to Maya in general. not just 2022

@m-u-r-p-h-y
Copy link
Member

just bumping the issue as we came across the missing pymel install on some client machine again . . .

@BigRoy
Copy link
Collaborator

BigRoy commented Mar 27, 2023

Not this exact issue but @gabormarinov mentioned on Discord an issue with being unable to import pymel in Maya 2020 with more recent versions of Arnold loaded.

import pymel.core as pm
# Error: NameError: file C:\Program Files\Autodesk\Maya2020\Python\lib\site-packages\pymel\core\__init__.py line 77: name 'windows' is not defined # 

Which seemed to be related to this issue: https://stackoverflow.com/questions/72318878/cant-import-pymel-in-maya
This might be another +1 to removing our dependency on Pymel in OpenPype.

Note that the stackoverflow topic has an answer from our one and only @antirotor ❤️ and apparently a dedicated OpenPype issue for it too: #3233

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
host: Maya type: bug Something isn't working
Projects
None yet
6 participants