Using pymongo in maya

maya

#1

Hi

Can I use pymongo in maya? I manually copied pymongo and bson in my script folder in the maya scripts folder but it seems there is a problem.

How to write some code that work in maya but at the same time use external modules?
I am working on a standalone application to manage assets but works in maya also (maybe other dcc apps)

Thanks


#3

If you’re on 2017+ you can just do

mayapy -m esnurepip
mayapy -m pip install --upgrade pip setuptools pymongo

No need to use get-pip

Though you might need to be running as a admin at least on windows, no clue what the permission module looks like on other OSes.


#4

Thanks

Is there any way other than installing it in maya ,I do not want to do that to every machine also it means I have to do that to other applications as well.


#5

So this is a deep question as you’re getting into packaging and deployment territory.

rez is a project that has been embraced by a lot of VFX teams, and I’ve been seeing some uptick in usage for games as well.

While the devil is in the details (and there are a lot of devils, and detials) at a high level you need a few things.

  1. Some method of making your code available to your users.
    a) Network share
    b) Pulled from source control
    c) Pushed by a build machine
  2. Some method of defining an environment that takes advantage of your code.
    a) Shell script to define environment before launching an app
    b) Launcher application to define proper environment for your app.

Sometimes you can combine both of these things, have your launcher also act as an update service that pulls new builds and launches the program.

Some applications make this easier than other, Maya has both the Maya.env file, and its module system for packaging plugins / scripts with a predefined environment.
Houdini also has houdini.env which works similar to Maya’s, I don’t believe it has something like the module system (which is a shame).
Max, I’ve got no idea, that app is still a bit of mystery to me.

But basically each tool has its own quirks and oddities, and covering all those bases all the time is hard.
So as you go down this road, start simple, and be prepared to throw it all away once you’ve learned some lessons on what works for you and your team.

Also, this forum is full of some past topics on this so poke around, and don’t be afraid to ask questions, we’re here to help.