wxWidgets / Phoenix

wxPython's Project Phoenix. A new implementation of wxPython, better, stronger, faster than he was before.
http://wxpython.org/
2.33k stars 515 forks source link

Problem importing 4.2.2 #2614

Open JamesRandom opened 1 month ago

JamesRandom commented 1 month ago

Operating system: MacOS Sonoma 14.6.1 wxPython version & source: 4.2.2 from pypi Python version & source: 3.9.19

Description of the problem:

Attempting to import wx results in an error where __ZN10wxBoxSizer20InformFirstDirectionEiii is not found (see below for details).

The problem does not occur if I pip install wxpython==4.2.1

Code Example (click to expand) ```python $ python Python 3.9.19 (main, Mar 20 2024, 19:50:25) [Clang 15.0.0 (clang-1500.1.0.2.5)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import wx Traceback (most recent call last): File "", line 1, in File "/Users/jamie/Documents/Projects/python/timer/src/.venv/lib/python3.9/site-packages/wx/__init__.py", line 17, in from wx.core import * File "/Users/jamie/Documents/Projects/python/timer/src/.venv/lib/python3.9/site-packages/wx/core.py", line 12, in from ._core import * ImportError: dlopen(/Users/jamie/Documents/Projects/python/timer/src/.venv/lib/python3.9/site-packages/wx/_core.cpython-39-darwin.so, 0x0002): symbol not found in flat namespace '__ZN10wxBoxSizer20InformFirstDirectionEiii' >>> ```
swt2c commented 1 month ago

Is this an x86_64 or ARM processor? Did you install from a wheel or did you compile it yourself?

DietmarSchwertberger commented 1 month ago

This is with a virtual environment? Does it work outside a virtual environment?

reticulatus commented 1 month ago

For comparison, I have an Intel MacBook Pro using macOS Sequoia 15.0 and Python 3.11.9

I installed wxPython 4.2.2 using pip (not in a virtual environment).

It downloaded and installed wxPython-4.2.2-cp311-cp311-macosx_10_10_universal2.whl

I am able to import wx without any errors.

swt2c commented 1 month ago

In looking closer at this, I suspect the OP might be using an ARM64 Mac (would be nice if @JamesRandom could confirm). I noticed something: the 4.2.2 wheels for Python 3.8-3.10 are not shown as universal2, they are only shown as AMD64 only, whereas with 4.2.1, all macOS wheels are universal2. So, if the OP has an ARM Mac, it probably did not install a wheel and tried to build one, and failed somehow. I'll try to look into why we didn't get universal2 wheels for 3.8-3.10.

swt2c commented 1 month ago

So the answer to the last question seems to be that the default behavior is for the wheels to be built as the version that Python was compiled as, and the GitHub Actions Python installs for macOS for Python 3.8 through 3.10 are NOT universal2.

JamesRandom commented 1 month ago

@swt2c You are right, I am running on an Arm-based Mac. And that it depends on the Python version.

Running with Python 3.12, I can install 4.2.2. Python 3.10 and earlier fail.