Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.7.9 pyenv install on MacOS 13.4.1 (Intel) can run python libraries but not usdview specifically #2520

Closed
carlynorama opened this issue Jun 30, 2023 · 9 comments

Comments

@carlynorama
Copy link

Thanks in advance!

Description of Issue

Got USD library to compile and run on MacOS 13.4.1 using Python 3.7.9 via a pyenv environment. Can use usdcat and write examples in python using the REPL fine. When trying to open a VERY simple usda file using usdview it fails with the below error message

Tried to open a second simple file, identical error message, including the "State file not found, a new one will be created." at the top.

Picked Python 3.7.9 because it was close to 3.7 (https://github.com/PixarAnimationStudios/OpenUSD/blob/release/VERSIONS.md) and Apple's USD Tools says 3.7.9 (FWIW: I do have that up and running using a system install of 3.7.9 on a different box)

State file not found, a new one will be created.
Traceback (most recent call last):
  File "~/opb/USDefault379/bin/usdview", line 35, in <module>
    Usdviewq.Launcher().Run()
  File "~/opb/USDefault379/lib/python/pxr/Usdviewq/__init__.py", line 86, in Run
    self.__LaunchProcess(arg_parse_result)
  File "~/opb/USDefault379/lib/python/pxr/Usdviewq/__init__.py", line 396, in __LaunchProcess
    (app, appController) = self.LaunchPreamble(arg_parse_result)
  File "~/opb/USDefault379/lib/python/pxr/Usdviewq/__init__.py", line 386, in LaunchPreamble
    appController = AppController(arg_parse_result, contextCreator)
  File "~/opb/USDefault379/lib/python/pxr/Usdviewq/appController.py", line 410, in __init__
    self._dataModel = UsdviewDataModel(self._makeTimer, self._configManager.settings)
  File "~/opb/USDefault379/lib/python/pxr/Usdviewq/appController.py", line 128, in __init__
    self._viewSettingsDataModel = ViewSettingsDataModel(self, settings)
  File "~/opb/USDefault379/lib/python/pxr/Usdviewq/viewSettingsDataModel.py", line 136, in __init__
    QtCore.QObject.__init__(self)
TypeError: __init__() missing 2 required positional arguments: 'parent' and 'name'

I'm pretty happy with what I do have running for now, but if there is something obvious to do to fix this (use yet another Python set up?)... I'm in!

Steps to Reproduce

  1. Install pyenv & Build
brew install pyenv # and dependencies...
pyenv install 3.7.9
pyenv init #to get instructions on how to configure your shell
# follow instructions and relaunch shell
pyenv shell 3.7.9
python3 --version # expected: 3.7.9
which pip3 #expected: /Users/$USER/.pyenv/shims/pip3
pip3 install PyOpenGL #if prompted to update pip, go ahead.
pip3 install PySide6
cd $DIRECTORY_WITH_CLONED_REPO
# $BUILD_DESTINATION = "~/opb/USDefault379/" 
python3 USD/build_scripts/build_usd.py $BUILD_DESTINATION 

  1. Successfully test usdcat and python libraries in the REPL
pyenv shell 3.7.9
python3 --version # expected: 3.7.9
which python3  # expected: /Users/$USER/.pyenv/shims/python3
export PATH=$PATH:$BUILD_DESTINATION/bin;
export PYTHONPATH=$PYTHONPATH:$BUILD_DESTINATION/lib/python
usdcat -o someFileName.usda someSource.usdc # Worked
python3 >>> from pxr import Usd, UsdGeom  # etc. rest of HelloWorld.usda example Worked
  1. Run into error with USDView
# Same shell session as all the above working
usdview HelloWorld.usda # FAILS (see above message) And others, like the one listed in this repo's README.md 

System Information (OS, Hardware)

  • MacOS 13.4 Intel (will test M1 next week)
  • FWIW - Xcode 14.3.1 & the command line tools installed, as well as VSCode
  • Homebrew 4.0.26 with brew upgrade run 2023-06-30
  • CMake installed via brew

Package Versions

23.05

Build Flags

Default script run.

@carlynorama
Copy link
Author

Similar to #2407, but I am not using python 3.10

@sunyab
Copy link
Contributor

sunyab commented Jun 30, 2023

Hi @carlynorama,

You are most likely running into #2407. That bug isn't tied to the version of Python, it's tied to the version of PySide6. You'll run into this with any version of PySide6 >= 6.5.0, and from your repro steps you probably have 6.5.1.1 installed.

You can try the workaround mentioned in #2407, or try installing an older version of PySide6 via pip3 install PySide6==6.4.3. A fix for this issue will be included in the upcoming USD release.

@carlynorama
Copy link
Author

Great. Thank you. Recompiling now.

@carlynorama
Copy link
Author

carlynorama commented Jul 1, 2023

usdview opens now! I can see the window for a mere moment and then a fatal crash because of an OpenGL finding problem, which is weird because pip3 list shows PyOpenGL, so I did it.

I will do some more digging, but this seems like a new and different problem and that's something. Thank you.

State file not found, a new one will be created.
ERROR: Usdview encountered an error while rendering.('Unable to load OpenGL library', "dlopen(OpenGL, 0x000A): tried: 'OpenGL' (no such file), '/System/Volumes/Preboot/Cryptexes/OSOpenGL' (no such file), '/Users/labtanza/.pyenv/versions/3.7.9/lib/OpenGL' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/labtanza/.pyenv/versions/3.7.9/lib/OpenGL' (no such file), '/Users/labtanza/.pyenv/versions/3.7.9/lib/OpenGL' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/labtanza/.pyenv/versions/3.7.9/lib/OpenGL' (no such file), '/Users/labtanza/.pyenv/versions/3.7.9/lib/OpenGL' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/labtanza/.pyenv/versions/3.7.9/lib/OpenGL' (no such file), '/Users/labtanza/.pyenv/versions/3.7.9/lib/OpenGL' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/labtanza/.pyenv/versions/3.7.9/lib/OpenGL' (no such file), '/Users/labtanza/.pyenv/versions/3.7.9/lib/OpenGL' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/labtanza/.pyenv/versions/3.7.9/lib/OpenGL' (no such file), '/usr/lib/OpenGL' (no such file, not in dyld cache), 'OpenGL' (no such file), '/usr/local/lib/OpenGL' (no such file), '/usr/lib/OpenGL' (no such file, not in dyld cache)", 'OpenGL', None)
zsh: bus error  usdview 

@meshula
Copy link
Member

meshula commented Jul 1, 2023

Now that you're past the PySide issues, there's a thread of PyOpenGL related problems here: #1372
and the final note is interesting #1372 (comment)

Wonder if anything there helps?

@carlynorama
Copy link
Author

carlynorama commented Jul 1, 2023

Yes! Looking into it. I did half-ass see that already in that I ran pip3 install PyOpenGL PyOpenGL_accelerate in the appropriate environment and tried it (no joy), but I didn't recompile which is on my to-do list for this afternoon.

I'm also interested in #1372 (comment) because I definitely have OpenGL in /System/Library/Frameworks/ on both boxes. I'm not really sure where to put it to make it apply to usdview?

TIL:

@meshula
Copy link
Member

meshula commented Jul 1, 2023

I wonder if it might be helpful to ask the question on the ASWF USD Working Group slack? Some of the places your error message reports looking (/System/Volumes/Preboot/Cryptexes/...) are unfamiliar to me as standard places to find libraries. That might be normal, but just outside of my experience. There might be people at the Slack with some insight into the problem.

@carlynorama
Copy link
Author

carlynorama commented Jul 1, 2023

The pyenv 3.7.9 rebuild after pip3 install PyOpenGL PyOpenGL_accelerate now behaves like the the system 3.79 build on my other machine in that it doesn't crash, but it still can't find OpenGL to do the render.

Interestingly my brew@3.11 build is flaky in other ways so I don't trust it, but does open usdview, and does find OpenGL

The cryptex stuff is an Apple thing. I haven't spent a lot of time on Slack historically but I will check it out!

@carlynorama
Copy link
Author

carlynorama commented Jul 2, 2023

OpenGL issue SOLVED now as well by the folks on slack. THANK YOU.

Answer: Use Python 3.9 instead of 3.7
Why: Apple changed how frameworks were stored from macOS 10 -> macOS 11 and Python 3.9 has the patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants