py5coding / py5generator

Meta-programming project that creates the py5 library code.
https://py5coding.org/
GNU General Public License v3.0
52 stars 13 forks source link

Mac intel trouble installing py5 on MacOS 10.11 El Capitan #424

Closed luanapavanelli closed 2 months ago

luanapavanelli commented 7 months ago

Following miniconda install steps, as I imported py5, I got a jpype error, then I did a jpype1 --force-reinstall and now I have a numpy import error :( @villares was unable to help me, and asked to open this issue!

Python 3.11.8 (/miniconda3/envs/py5coding/bin/python3.11)
>>> import py5
Traceback (most recent call last):
  File "/miniconda3/envs/py5coding/lib/python3.11/site-packages/numpy/core/__init__.py", line 24, in <module>
    from . import multiarray
  File "/miniconda3/envs/py5coding/lib/python3.11/site-packages/numpy/core/multiarray.py", line 10, in <module>
    from . import overrides
  File "/miniconda3/envs/py5coding/lib/python3.11/site-packages/numpy/core/overrides.py", line 8, in <module>
    from numpy.core._multiarray_umath import (
ImportError: dlopen(/miniconda3/envs/py5coding/lib/python3.11/site-packages/numpy/core/_multiarray_umath.cpython-311-darwin.so, 2): Symbol not found: __ZdaPvSt11align_val_t
  Referenced from: /miniconda3/envs/py5coding/lib/python3.11/site-packages/numpy/core/../../../..//libc++.1.dylib
  Expected in: /usr/lib/libc++abi.dylib
 in /miniconda3/envs/py5coding/lib/python3.11/site-packages/numpy/core/../../../..//libc++.1.dylib

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/miniconda3/envs/py5coding/lib/python3.11/site-packages/numpy/__init__.py", line 130, in <module>
    from numpy.__config__ import show as show_config
  File "/miniconda3/envs/py5coding/lib/python3.11/site-packages/numpy/__config__.py", line 4, in <module>
    from numpy.core._multiarray_umath import (
  File "/miniconda3/envs/py5coding/lib/python3.11/site-packages/numpy/core/__init__.py", line 50, in <module>
    raise ImportError(msg)
ImportError: 

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.

We have compiled some common reasons and troubleshooting tips at:

    https://numpy.org/devdocs/user/troubleshooting-importerror.html

Please note and check the following:

  * The Python version is: Python3.11 from "/miniconda3/envs/py5coding/bin/python3.11"
  * The NumPy version is: "1.26.4"

and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.

Original error was: dlopen(/miniconda3/envs/py5coding/lib/python3.11/site-packages/numpy/core/_multiarray_umath.cpython-311-darwin.so, 2): Symbol not found: __ZdaPvSt11align_val_t
  Referenced from: /miniconda3/envs/py5coding/lib/python3.11/site-packages/numpy/core/../../../..//libc++.1.dylib
  Expected in: /usr/lib/libc++abi.dylib
 in /miniconda3/envs/py5coding/lib/python3.11/site-packages/numpy/core/../../../..//libc++.1.dylib

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/miniconda3/envs/py5coding/lib/python3.11/site-packages/py5/__init__.py", line 35, in <module>
    import numpy as np  # noqa
  File "/miniconda3/envs/py5coding/lib/python3.11/site-packages/numpy/__init__.py", line 135, in <module>
    raise ImportError(msg) from e
ImportError: Error importing numpy: you should not try to import numpy from
        its source directory; please exit the numpy source tree, and relaunch
        your python interpreter from there.
villares commented 7 months ago

Thank you for creating this issue @luanapavanelli! As a side note... we were point Thonny to use the miniconda3 interpreter, which used to work for me...

Also, when using the Thonny built-in interpreter we had other errors related to py5_tools importing PIL I think. Luana, we should try to document that too when you have the time!

hx2A commented 7 months ago

Hi, @luanapavanelli ! Thanks for giving py5 a try.

Can I have more information about the original jpype error? It seems the --force-reinstall argument has put this Python environment into a terrible state. Rather than try to unravel it, can we find a way to start from a clean slate? Let's go through the install setup steps for Java and Python first, see what is not working, and then plan out the next steps.

Can you also tell me how you installed Java onto this machine?

villares commented 7 months ago

I can give you some of that info... we were using the JAVA JDK from a failed Thonny + thonny-py5mode install, maybe not such a good idea... As it is a conda env, it will not be hard to restart from a clean state. And we can try the install-jdk route this time. Later we can try to make the Thonny things work (I'm afraid I made Luana jump the gun on this).

hx2A commented 7 months ago

I'm afraid I made Luana jump the gun on this

That's fine, I like having these conversations because we always think of ways to better streamline the install process and avoid various pitfalls. Keep me in the loop and let me know how it goes.

hx2A commented 7 months ago

@villares how is this going?

villares commented 7 months ago

We'll try again soon!

villares commented 7 months ago

Hi @hx2A, following the py5coding.org instructions to the letter, we created a fresh new conda env (py5coding) and used install-jdk. The result was very similar to the error before. Also we tried to install the jupyter kernels and had a similar message. @luanapavanelli will post the results...

luanapavanelli commented 7 months ago

Reminder, I have an intel Mac! Installing kernel error

(py5coding) Luanas-MacBook:~ lua$ python -m py5jupyter.kernels.py5.install --sys-prefix
Traceback (most recent call last):
  File "//miniconda3/envs/py5coding/lib/python3.11/site-packages/numpy/core/__init__.py", line 24, in <module>
    from . import multiarray
  File "//miniconda3/envs/py5coding/lib/python3.11/site-packages/numpy/core/multiarray.py", line 10, in <module>
    from . import overrides
  File "//miniconda3/envs/py5coding/lib/python3.11/site-packages/numpy/core/overrides.py", line 8, in <module>
    from numpy.core._multiarray_umath import (
ImportError: dlopen(//miniconda3/envs/py5coding/lib/python3.11/site-packages/numpy/core/_multiarray_umath.cpython-311-darwin.so, 2): Symbol not found: __ZdaPvSt11align_val_t
  Referenced from: /miniconda3/envs/py5coding/lib/python3.11/site-packages/numpy/core/../../../..//libc++.1.dylib
  Expected in: /usr/lib/libc++abi.dylib
 in /miniconda3/envs/py5coding/lib/python3.11/site-packages/numpy/core/../../../..//libc++.1.dylib

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "//miniconda3/envs/py5coding/lib/python3.11/site-packages/numpy/__init__.py", line 130, in <module>
    from numpy.__config__ import show as show_config
  File "//miniconda3/envs/py5coding/lib/python3.11/site-packages/numpy/__config__.py", line 4, in <module>
    from numpy.core._multiarray_umath import (
  File "//miniconda3/envs/py5coding/lib/python3.11/site-packages/numpy/core/__init__.py", line 50, in <module>
    raise ImportError(msg)
ImportError: 

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.

We have compiled some common reasons and troubleshooting tips at:

    https://numpy.org/devdocs/user/troubleshooting-importerror.html

Please note and check the following:

  * The Python version is: Python3.11 from "//miniconda3/envs/py5coding/bin/python"
  * The NumPy version is: "1.26.4"

and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.

Original error was: dlopen(//miniconda3/envs/py5coding/lib/python3.11/site-packages/numpy/core/_multiarray_umath.cpython-311-darwin.so, 2): Symbol not found: __ZdaPvSt11align_val_t
  Referenced from: /miniconda3/envs/py5coding/lib/python3.11/site-packages/numpy/core/../../../..//libc++.1.dylib
  Expected in: /usr/lib/libc++abi.dylib
 in /miniconda3/envs/py5coding/lib/python3.11/site-packages/numpy/core/../../../..//libc++.1.dylib

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<frozen runpy>", line 189, in _run_module_as_main
  File "<frozen runpy>", line 112, in _get_module_details
  File "//miniconda3/envs/py5coding/lib/python3.11/site-packages/py5jupyter/__init__.py", line 20, in <module>
    from . import widgets  # noqa
    ^^^^^^^^^^^^^^^^^^^^^
  File "//miniconda3/envs/py5coding/lib/python3.11/site-packages/py5jupyter/widgets/__init__.py", line 20, in <module>
    from .sketchportal import Py5SketchPortal
  File "//miniconda3/envs/py5coding/lib/python3.11/site-packages/py5jupyter/widgets/sketchportal.py", line 22, in <module>
    import numpy as np
  File "//miniconda3/envs/py5coding/lib/python3.11/site-packages/numpy/__init__.py", line 135, in <module>
    raise ImportError(msg) from e
ImportError: Error importing numpy: you should not try to import numpy from
        its source directory; please exit the numpy source tree, and relaunch
        your python interpreter from there.

testing import

(py5coding) Luanas-MacBook:~ lua$ python3
Python 3.11.8 | packaged by conda-forge | (main, Feb 16 2024, 20:51:20) [Clang 16.0.6 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import py5
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "//miniconda3/envs/py5coding/lib/python3.11/site-packages/py5/__init__.py", line 34, in <module>
    import jpype.imports  # noqa
    ^^^^^^^^^^^^^^^^^^^^
  File "//miniconda3/envs/py5coding/lib/python3.11/site-packages/jpype/__init__.py", line 18, in <module>
    import _jpype
ImportError: dlopen(//miniconda3/envs/py5coding/lib/python3.11/site-packages/_jpype.cpython-311-darwin.so, 2): Symbol not found: __ZdaPvSt11align_val_t
  Referenced from: /miniconda3/envs/py5coding/lib/python3.11/site-packages/../..//libc++.1.dylib
  Expected in: /usr/lib/libc++abi.dylib
 in /miniconda3/envs/py5coding/lib/python3.11/site-packages/../..//libc++.1.dylib
hx2A commented 7 months ago

Hmmm, this is a new problem. @luanapavanelli , we will figure this out.

Can you try an import test for both numpy and jpype? Try each of these in fresh Python interpreters:

import numpy as np
import jpype
import jpype.imports

Can you also try creating a Python 3.10 environment, running the above test, and then seeing if you can import py5 and install the py5 kernel?

I will keep thinking...

hx2A commented 7 months ago

This numpy troubleshooting page has some ideas but nothing seems to relate to your issue. (Edit: that link seems to be the same as the one cited in the error message)

But perhaps you can try installing a different version of numpy with a command like this:

conda uninstall numpy
conda install -c conda-forge numpy=1.26.3

I am guessing you have a bad numpy wheel or something? I don't know.

hx2A commented 3 months ago

@luanapavanelli , @villares , how is this going? Is py5 working on this machine now?

villares commented 3 months ago

Update: I have scheduled with @luanapavanelli to tackle this in about two weeks :)

villares commented 2 months ago

Cheers! @luanapavanelli and I investigated this together and I believe we finally can close this.

villares commented 2 months ago

I wanted to rename this "Mac intel trouble installing py5 on MacOS 10.11 El Capitan" but couldn't do it... ¯\_(ツ)_/¯

hx2A commented 2 months ago

I wanted to rename this "Mac intel trouble installing py5 on MacOS 10.11 El Capitan" but couldn't do it... ¯\_(ツ)_/¯

I just took care of that. Thank you for following up and getting this issue closed!