kcoley / gltf2usd

command-line utility for converting glTF 2.0 models to USD
MIT License
264 stars 38 forks source link

No PIL or Pillow module? Strange. #103

Closed enzyme69 closed 5 years ago

enzyme69 commented 5 years ago

Hello I am back, I downloaded the latest gltf2usd but when running I am getting this error. I am sure I have PIL module. This is so weird.

Traceback (most recent call last):
  File "gltf2usd.py", line 16, in <module>
    from PIL import Image
ImportError: No module named PIL
enzyme69 commented 5 years ago

If I use Python 3:

Traceback (most recent call last):
  File "gltf2usd.py", line 18, in <module>
    from pxr import Usd, UsdGeom, Sdf, UsdShade, Gf, UsdSkel, Vt, Ar, UsdUtils
  File "/Users/jimmygunawan/Projects/Pixar/BUILD/lib/python/pxr/Usd/__init__.py", line 24, in <module>
    import _usd
ModuleNotFoundError: No module named '_usd'
enzyme69 commented 5 years ago

Requirement already satisfied: pillow in /usr/local/lib/python2.7/site-packages (5.3.0) 192-168-1-7:USDZ_TotoroSimple jimmygunawan$ python gltf2usd.py Traceback (most recent call last): File "gltf2usd.py", line 16, in from PIL import Image ImportError: No module named PIL 192-168-1-7:USDZ_TotoroSimple jimmygunawan$ which python /usr/bin/python 192-168-1-7:USDZ_TotoroSimple jimmygunawan$

... I am getting crazy...

enzyme69 commented 5 years ago

Have to use VirtualEnv after all... hmm...

192-168-1-7:~ jimmygunawan$ virtualenv -p python2 VENV_USDZ Running virtualenv with interpreter /usr/local/bin/python2 New python executable in /Users/jimmygunawan/VENV_USDZ/bin/python2.7 Also creating executable in /Users/jimmygunawan/VENV_USDZ/bin/python Installing setuptools, pip, wheel... done. 192-168-1-7:~ jimmygunawan$ source VENV_USDZ/bin/activate (VENV_USDZ) 192-168-1-7:~ jimmygunawan$ python Python 2.7.15 (default, Jul 23 2018, 21:27:06) [GCC 4.2.1 Compatible Apple LLVM 9.1.0 (clang-902.0.39.2)] on darwin Type "help", "copyright", "credits" or "license" for more information.

import PIL Traceback (most recent call last): File "", line 1, in ImportError: No module named PIL

[7]+ Stopped python (VENV_USDZ) 192-168-1-7:~ jimmygunawan$ (VENV_USDZ) 192-168-1-7:~ jimmygunawan$ (VENV_USDZ) 192-168-1-7:~ jimmygunawan$ pip install PIL Collecting PIL Could not find a version that satisfies the requirement PIL (from versions: ) No matching distribution found for PIL (VENV_USDZ) 192-168-1-7:~ jimmygunawan$ pip install pillow Collecting pillow Using cached https://files.pythonhosted.org/packages/2e/f6/e6d56ec19fae0b76932a343355c7a37198fd8e76c26bc2f2779fc85b4684/Pillow-5.3.0-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl Installing collected packages: pillow Successfully installed pillow-5.3.0

enzyme69 commented 5 years ago

(VENV_USDZ) 192-168-1-7:USDZ_TotoroSimple jimmygunawan$ python gltf2usd.py

------------------------ 'python' is dying ------------------------ python crashed. FATAL ERROR: Failed axiom: ' Py_IsInitialized() ' in operator() at line 148 of /Users/jimmygunawan/Projects/Pixar/USD/pxr/base/lib/tf/pyTracing.cpp

The stack can be found in 192-168-1-7.tpgi.com.au:/var/folders/r3/13y_zxhn0557ftnbz9xrt7x00000gn/T//st_python.14422 done.

Abort trap: 6 (VENV_USDZ) 192-168-1-7:USDZ_TotoroSimple jimmygunawan$

enzyme69 commented 5 years ago

If I use virtualenv, and inside Python running: from pxr import Usd it crashes Python...... If I am outside running python, running: from pixr import Usd -- it works! But It does not load PIL...

enzyme69 commented 5 years ago

I am using Apple's Pixar USD Bundle.

enzyme69 commented 5 years ago

I have to do this:

sudo nano ~/.bash_profile

export PATH=$PATH:$HOME/USDPython/USD export PYTHONPATH=$PYTHONPATH:$HOME/USDPython/USD export PYTHONPATH=$PYTHONPATH:/usr/local/lib/python2.7/site-packages

It's so weird, anyhow, it's still pretty annoying that virtualenv one crashing Python, but the main one works. And I also made a new Account cleanly installing Apple's Pixar USD build, and then I still need to do bash_profile stuff and yeah... it works without Python crashing.

enzyme69 commented 5 years ago

Just for my future me or anyone with such issue:

SEE HERE: https://stackoverflow.com/questions/122327/how-do-i-find-the-location-of-my-python-site-packages-directory

https://stackoverflow.com/questions/25607837/pip-install-not-installing-into-correct-directory

screen shot 2018-11-16 at 12 15 47 am

In the past I have been using conda / anaconda / mini-conda, but better of using virtualenv and watch Coding Train video tutorial on it.

But using virtualenv I ended keep crashing if Python USD install is using the one from Apple... it's a headache...

If using Apple USDPython, we need to use Python from Mac.

jan-at-school commented 5 years ago

If I use Python 3:

Traceback (most recent call last):
  File "gltf2usd.py", line 18, in <module>
    from pxr import Usd, UsdGeom, Sdf, UsdShade, Gf, UsdSkel, Vt, Ar, UsdUtils
  File "/Users/jimmygunawan/Projects/Pixar/BUILD/lib/python/pxr/Usd/__init__.py", line 24, in <module>
    import _usd
ModuleNotFoundError: No module named '_usd'

@enzyme69

This error doesn't seem to be related with your solution... How did you overcome this one? I am getting this error for python27 as well as python 3.