In the middle of the logic of my node server, there is a part where the shell script is executed with a child process, and the shell script is to declare PATH and PYTHONPATH as a specific path and then execute a specific module.
#!/bin/sh
BASEPATH=$(dirname "$0")
export PATH=$PATH:$BASEPATH/USD:$PATH:$BASEPATH/usdzconvert;
export PYTHONPATH=$PYTHONPATH:$BASEPATH/USD/lib/python
usdzconvert ../tmp/$2 ../tmp/$1
It works with the same content locally, but if you put it as an instance, that script doesn't seem to run. I can't get the Python module called pxr in that PYTHONPATH path, and it doesn't work after that. If I just run Python and search the import syntax, it's not an export path problem, but I can't find it if I turn around in the shell script file.
I wrote it in the ~/.zshrc
file at all, but it only works within the terminal and fails with the same content in the shell script file while the server is running. In this case, what else should I try...? The deployment environment is mac2.metal (MacOS M1) in AWS EC2. Of course, my local computer is also an M1.
Python version is 3.7.9 version for both local and instance.
for usdzconvert, It has to build on MacOS with Python3.7.9.
And this a content that wrote in README.md
This package installs to /Applications/usdpython and contains
- `usdzconvert`, a Python-based tool to convert from various file formats to usdz
- `usdARKitChecker`, a Python-based tool for usdz validation
- precompiled macOS Python modules for Pixar's USD library
- a set of sample scripts that demonstrate how to write usd files
- the `fixOpacity` tool
- `usdzcreateassetlib`, a standalone tool to generate an asset library from multiple assets
- `usdzaudioimport`, a standalone tool to attach audio files to usdz files
## Precompiled macOS Python Modules for Pixar's USD Library (Version 19.11)
This library was compiled using version 3.7.9 of Python.
This library was compiled using version 22.03 of [the public USD GitHub repository](http://openusd.org) with the following build script arguments (see USDPython/README.md for further details):
python3.7 USD/build_scripts/build_usd.py --build-args TBB,extra_inc=big_iron.inc --python --no-imaging --docs --no-usdview --build-monolithic USDPython
If you prefer to set your environment variables directly ,
To start using USD in Python, set your PATH and PYTHONPATH variables as follows (replace `<PATH_TO_USDPYTHON>` with the path to this USDPython folder):
export PATH=$PATH:<PATH_TO_USDPYTHON>/USD
export PYTHONPATH=$PYTHONPATH:<PATH_TO_USDPYTHON>/USD/lib/python
You should then be able to start using the USD library in Python 3.7:
> python3.7
Python 3.7.9 (v3.7.9:13c94747c7, Aug 15 2020, 01:31:08)
Type "help", "copyright", "credits" or "license" for more information.
>>> import pxr
>>>
and I did as it says on README.md and it works. However, it does not work only within AWS instance.