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

uv_unwraper error #20

Open
Kuglx opened this issue Jan 13, 2025 · 17 comments
Open

uv_unwraper error #20

Kuglx opened this issue Jan 13, 2025 · 17 comments

Comments

@Kuglx
Copy link

Kuglx commented Jan 13, 2025

what's the issue here? did i do something wrong? i have installed uv_unwrapper but it still says that i don't have it when i try to run it, it says that uv_unwraper was not found
photo_2025-01-13_22-02-37

@olPlow
Copy link

olPlow commented Jan 14, 2025

Hi ! Same for me ! :) uv_unwrapper not found (:

@jammm
Copy link
Collaborator

jammm commented Jan 15, 2025

Weird, I've not faced this error before. It's likely that pip install is installing to a site-packages directory that isn't used by python?

@gongzhang
Copy link

Same here. Reproducible on Mac.

Traceback (most recent call last):
  File "/Users/gong/git.localized/stable-point-aware-3d/spar3d/models/mesh.py", line 16, in <module>
    from uv_unwrapper import Unwrapper
  File "/Users/gong/git.localized/stable-point-aware-3d/env/lib/python3.10/site-packages/uv_unwrapper-0.0.1-py3.10-macosx-14-arm64.egg/uv_unwrapper/__init__.py", line 3, in <module>
    from . import _C  # noqa: F401
ImportError: dynamic module does not define module export function (PyInit__C)

Something wrong with the compiled _C.cpython-310-darwin.so under uv_unwrapper. It built but not work. Maybe related to clang compiler.

@jammm
Copy link
Collaborator

jammm commented Jan 16, 2025

Which version of python are you using @gongzhang ?

@gongzhang
Copy link

@jammm I've tried Python 3.10 and 3.12.

@jammm
Copy link
Collaborator

jammm commented Jan 16, 2025

Did you update setuptools? pip install -U setuptools==69.5.1

I can't seem to be able to repro this issue on my mac or Windows or Linux .

@jammm
Copy link
Collaborator

jammm commented Jan 16, 2025

Try using the pytorch version 2.5.1 or nightly version.

@gongzhang
Copy link

gongzhang commented Jan 16, 2025

@jammm Yes. Here is the commands I use -

python3.10 -m venv env
source env/bin/activate

# install pytorch (currently 2.5.1)
pip install torch torchvision torchaudio

# update setuptools
pip install -U setuptools==69.5.1

# install wheel
pip install wheel

# install the requirements
pip install -r requirements.txt
pip install -r requirements-demo.txt

# run the gradio
PYTORCH_ENABLE_MPS_FALLBACK=1 python gradio_app.py

macOS 15.2 / Xcode 16.2

@jammm
Copy link
Collaborator

jammm commented Jan 16, 2025

Hmm. That's really weird, because I am also on OSX 15.2, though I used xcode command line tools with python 3.10.11 installed separately from one of their online installers

@gongzhang
Copy link

Hmm... everything looks good but still not work.

Image Image

@gongzhang
Copy link

  1. I see that Kuglx's screenshot is on Windows, while I'm on Mac, so this issue shouldn't be caused by different operating systems.
  2. Since jammm is also using almost the same environment (Python 3.10 on macOS 15.2) but cannot reproduce the issue, it should not be related to the Python version either.
    🤔

@jammm
Copy link
Collaborator

jammm commented Jan 16, 2025

Try installing python with macOS 64-bit universal2 installer from https://www.python.org/downloads/release/python-31011/
Make sure to create a fresh venv with this one

@jammm
Copy link
Collaborator

jammm commented Jan 16, 2025

BTW I would suggest removing these files. Not sure why they're there

Image

The _C comes from https://github.com/Stability-AI/stable-point-aware-3d/blob/main/uv_unwrapper/setup.py#L54

@birdwatch
Copy link

I encountered the same issue.
To identify the cause, I took the following two steps:

First, I checked the dependencies of the .so file generated in uv_unwrapper/build using the ldd command.
I found that some dependencies were not properly resolved, as shown in the first image. To address this, I added the corresponding paths to LD_LIBRARY_PATH. In this case, I did the following:

Image

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:.venv/lib/python3.11/site-packages/torch/lib

Second, I directly executed the setup.py file inside uv_unwrapper.
python3 setup.py build
The execution of setup.py was interrupted due to an error. In my case, as shown in the second image, the error indicated that the -lomp library could not be found.
Image

To resolve this, I installed the OpenMP library. After that, I added the OpenMP path to LD_LIBRARY_PATH ("14" corresponds to the OpenMP version on my PC):
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/llvm-14/lib

After completing these two steps, I ran pip install ./uv_unwrapper/ again and executed run.py. This resolved the error.

@birdwatch
Copy link

My environment:
Ubuntu 22.04
CUDA: 12.2
Python: 3.11.2
Pytorch: 2.5.1+cu121

@gongzhang
Copy link

@jammm @birdwatch Thank you all! I workaround the issue by modifying uv_unwrapper/setup.py like this:

Image

The original script always builds x86_64 binaries instead of arm64 on my Mac.

@jammm
Copy link
Collaborator

jammm commented Jan 17, 2025

The original script always builds universal binaries in my case. Also the logs you shared suggests it was already building for arm64 - uv_unwrapper-0.0.1-py3.10-macosx-14-arm64.egg - so I've a feeling the fix seems like the removal of the -fopenmp flag? I'm not sure though, as it seems to work fine in my mac, and all I had to do was install xcode command-line tools and python 3.10.11 (or above) from python.org on my fresh install of OSX 15.2. It's a new mac so there hasn't been anything installed on that previously.

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

5 participants