-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
IPython Console not working when connecting standalone app to external interpreter on Mac #21575
Comments
Hi @shubhamg13 thank you for hte feedback! Seems like this is a duplicate of #21338 Could you check the version of Let us know! |
@mrclary, all users who have reported this issue during the last couple of months are using our standalone app. Besides what @dalthviz mentioned above (using an old Jupyter-core version), I think this could be caused by using an external interpreter which is compiled for arm64 while our app is based on Intel. Could you check that? If those two things are not the cause of the problem, could you try to replicate the bug in other ways? Thanks! |
Our standalone application for Spyder 5.5.0 ships with jupyter_core=5.5.0 (for both macOS and Windows). From the
I'll investigate possible arm64 complications. @shubhamg13, could elaborate on how to reproduce the issue? In particular:
|
@mrclary: I'm replying here because I opened a similar issue. I downloaded the standalone for Mac and attempted to bind it to Python 3.12.0 for Mac, the latest release. The errors in the interactive console suggest that the standalone is expecting Intel 64 binaries. But there is only one Mac download for this and other recent versions of Python. @ccordoba said this is a known issue and no fix is planned, so is the standalone version just not going to support recent Python on the Mac? (My issue was #21672, you can see the stack trace there.). Thanks, TB |
So far here is what I've found: I have not been able to reproduce the OP on my M1 machine. I have successfully used an external arm64 (not universal) conda environment. I'm waiting for a response from @shubhamg13 to test a different environment. Although I will likely not test the system On my M1 machine I see the following:
Note: our Spyder standalone application (including our alpha conda-based installer) is x86_64 only (not universal) and when opened macOS will prompt the user to install Rosetta. It is true that we will not build the current standalone application in an arm64 variant. However, our planned release of a conda-based application for version 6 is expected to have an arm64 variant, pending availability of arm64 runners on GitHub early this year. |
Ryan: Thank you for looking at this.
|
TL;DRWhat I've learned is that for Spyder (x86_64) to work with external environments on arm64:
Details
Actually, you should have
Sorry to hear that. I prefer to use miniforge since it is much smaller.
Okay, this is the Python.org installation and it is a universal2 binary (has both x86_64 and arm64 built in). As you observe, there are also
It will only prompt if Rosetta is not already installed.
See above. |
To be clear, my previous comment resolves cross-architecture issues, but I still have not been able to reproduce the OP. |
I don't see anything in the OP traceback (or in #21672 traceback) that indicates an arm64/x86_64 conflict. @shubhamg13, since |
Here's the bottom of the trace:
ImportError:
dlopen(/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site‑packages/psutil/_
psutil_osx.abi3.so, 0x0002): tried:
'/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site‑packages/psutil/_
psutil_osx.abi3.so' (mach‑o file, but is an incompatible architecture (have
'arm64', need 'x86_64')),
'/System/Volumes/Preboot/Cryptexes/OS/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site‑packages/psutil/_
psutil_osx.abi3.so' (no such file),
'/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site‑packages/psutil/_
psutil_osx.abi3.so' (mach‑o file, but is an incompatible architecture (have
'arm64', need 'x86_64'))
…On Fri, Jan 5, 2024 at 3:00 PM Ryan Clary ***@***.***> wrote:
I don't see anything in the OP traceback (or in #21672
<#21672> traceback) that
indicates an arm64/x86_64 conflict.
—
Reply to this email directly, view it on GitHub
<#21575 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ATBPTTGDGZRWHK67V5KF4BLYNBLWVAVCNFSM6AAAAABAEDUE3OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZZGE4TGMJTGA>
.
You are receiving this because you commented.Message ID:
***@***.***>
--
Tom Barson
East Lansing, MI
|
Ryan: Thank you - this is above and beyond.
I will attempt your suggestions tomorrow am when I have a full day to try
them and deal with the consequences.
Appreciate your help very much. Some other tools (VS Code, Jupyter) are
doing fine with my setup, but I miss Spyder. Your suggestions will
be useful even if (or especially if) I revert to Anaconda.
TB
…On Fri, Jan 5, 2024 at 2:41 PM Ryan Clary ***@***.***> wrote:
TL;DR
What I've learned is that for Spyder (x86_64) to work with external
environments on arm64:
- If the environment Python executable is universal, then all binaries
in the Python environment must be x86_64. See below on how to accomplish
this.
- If the environment Python executable is a single architecture, then
all the binaries in the Python environment must be the same architecture.
Details
Ryan: Thank you for looking at this. Some possible things of interest.
1. I don't have a usr/bin/python instance.
Actually, you should have /usr/bin/python3, which comes with macOS, but
it is best to pretend that you don't have anything there 😉.
1. Anaconda used to be installed but I removed it because I kept
having failed update issues. So I've been building a standalone environment
(successfully, so far) except for this problem.
Sorry to hear that. I prefer to use miniforge
<https://github.com/conda-forge/miniforge> since it is much smaller.
1. The python interpreter that is failing to load in Spyder iConsole
is:
/Library/Frameworks/Python.framework/Versions/3.12/bin/python3
There is also a python3.12-intel64 executable in that 'bin' but it
doesn't help if I point to it explicity in Spyder Preferences. It would
want to be started by Rosettta 2, I think.
Okay, this is the Python.org installation and it is a universal2 binary
(has both x86_64 and arm64 built in). As you observe, there are also
python3.12-intel64 and python3.12-arm64 executables; these are also
universal binaries but only have 1 architecture. You are correct that these
executables may not be useful in solving any of the problems that you
observe. There are two problems I think may be occurring for you here.
1. You should avoid using the base Python executable environment. This
is true for any Python install, even for conda (Anaconda or miniforge). One
should always use a virtual environment instead.
For a conda install you would do the following.
$ conda create -n my-venv python=3.12 spyder-kernels=2.5
For any other Python install, use venv.
$ /usr/local/bin/python3 -m venv /path/to/desired/my-venv
$ source /path/to/desired/my-venv/bin/activate
(my-venv) $ python -m pip install spyder-kernels==2.5
You should point Spyder to the python executable in the virtual
environment.
If you were using the Anaconda base environment to "work" in, then I
suspect that is the reason you had update issues. I've also run into all
sorts of problems whenever I've used base environments (even accidentally).
2. When I create a virtual environment as above with
/usr/local/bin/python3 (which just points to the universal binary
/Library/Frameworks/Python.framework/Versions/3.12/bin/python3) and
install spyder-kernels I get the following error in Spyder's IPython
console:
ImportError: dlopen(/Users/ryan/my-venv/lib/python3.12/site‑packages/psutil/_psutil_osx.abi3.so, 0x0002): tried: '/Users/ryan/my-venv/lib/python3.12/site‑packages/psutil/_psutil_osx.abi3.so' (mach‑o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))
I think the problem here is that _psutil_osx.abi3.so is not the *same*
architecture as the Python executable (x86_64 version selected by Rosetta).
As I've found with conda environments, when the Python executable is arm64
*and* _psutil_osx.abi3.so is arm64, then there doesn't seem to be a
problem.
The workaround is to ensure x86_64 binaries are installed in the
virtual environment. After creating the virtual environment as shown above,
when installing spyder-kernels (or *any* package in the environment)
use the arch -x86_64 pre-command:
$ /usr/local/bin/python3 -m venv /path/to/desired/my-venv
$ source /path/to/desired/my-venv/bin/activate
(my-venv) $ arch -x86_64 python -m pip install spyder-kernels==2.5
This ensures that x86_64 packages are installed instead of arm64.
1. I was NOT prompted to install Rosetta 2 when i started Spyder
standalone. I know it's on my machine (and that it works) because I needed
to install it for MATLAB.
It will only prompt if Rosetta is not already installed.
1. Happy to try something if you have ideas.
Thanks, TB
See above.
—
Reply to this email directly, view it on GitHub
<#21575 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ATBPTTFE7UVMCY2OAPVWFVTYNBJPFAVCNFSM6AAAAABAEDUE3OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZZGE3TINBWGY>
.
You are receiving this because you commented.Message ID:
***@***.***>
--
Tom Barson
East Lansing, MI
|
Thanks @tomb1949. That is exactly the same error that I was seeing, but that was not shown in the OP to this issue or in #21672. So that appears to be a completely different issue from the OP and we may have highjacked this issue 😦. But, hey, @ccordoba12 did initiate the idea of arm64/x86_64 conflict 😉. |
Hijackers of the world, unite! ;-). TB
…On Fri, Jan 5, 2024 at 3:30 PM Ryan Clary ***@***.***> wrote:
Thanks @tomb1949 <https://github.com/tomb1949>. That is exactly the same
error that I was seeing, but that was not shown in the OP to this issue or
in #21672 <#21672>. So that
appears to be a completely different issue from the OP and we may have
highjacked this issue 😦. But, hey, @ccordoba12
<https://github.com/ccordoba12> did initiate the idea of arm64/x86_64
conflict 😉.
—
Reply to this email directly, view it on GitHub
<#21575 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ATBPTTBWYWQV47LXD4XZ5GLYNBPFHAVCNFSM6AAAAABAEDUE3OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZZGIZDGMJRHE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
Tom Barson
East Lansing, MI
|
I would note that from the above traceback, all we know is that |
Ryan, Carlos:
Thank you for your suggestions and patience. And apologies for being
offline for a couple of days.
The commands recommended by Carlos did fix the standalone "startup"
problem. But as Ryan more-or-less predicted, script compilation fails as
soon as the process encounters a package that is arm64 only. So running:
from openai import OpenAI
receives the following familiar-sounding message below. The new OpenAI
packages, which embodies a switch to the pydantic object model, fails
because "pydantic_core" is apparently arm64 only. (I tried to use the
'Carlos method' on 'pydantic-core' but the command install it with no
binaries failed, apparently because the compiling the pydantic-core code
has dependencies that are not part of the install (something about
"wheels"). So there's probably no simple comprehensive fix here.
I'm fine with closing the issue. I'm mulling Ryan's recommendation to get a
more complex Python environment going versus going back to Anaconda, which
is what I think is what both of you would see as a preferred solution.
Thanks, Tom Barson
Python 3.12.1 (v3.12.1:2305ca5144, Dec 7 2023, 17:23:39) [Clang 13.0.0
(clang-1300.0.29.30)]
Type "copyright", "credits" or "license" for more information.
IPython 8.19.0 -- An enhanced Interactive Python.
runcell(0,
'/Users/thomasbarson/Documents/OpenAI_replication/simple_example_chat1_TB.py')
Traceback (most recent call last):
File
/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/spyder_kernels/py3compat.py:356
in compat_exec
exec(code, globals, locals)
File ~/Documents/OpenAI_replication/simple_example_chat1_TB.py:19
import openai
File
/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/openai/__init__.py:8
from . import types
File
/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/openai/types/__init__.py:5
from .edit import Edit as Edit
File
/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/openai/types/edit.py:6
from .._models import BaseModel
File
/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/openai/_models.py:20
from pydantic.fields import FieldInfo
File
/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pydantic/fields.py:21
from pydantic_core import PydanticUndefined
File
/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pydantic_core/__init__.py:6
from ._pydantic_core import (
ImportError:
dlopen(/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pydantic_core/_
pydantic_core.cpython-312-darwin.so, 0x0002): tried:
'/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pydantic_core/_
pydantic_core.cpython-312-darwin.so' (mach-o file, but is an incompatible
architecture (have 'arm64', need 'x86_64')),
'/System/Volumes/Preboot/Cryptexes/OS/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pydantic_core/_
pydantic_core.cpython-312-darwin.so' (no such file),
'/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pydantic_core/_
pydantic_core.cpython-312-darwin.so' (mach-o file, but is an incompatible
architecture (have 'arm64', need 'x86_64'))
|
I'm glad to see we are making progress. I would not worry about going back to Anaconda right now. With your existing Python.org installation, you must be adding packages using
This creates a virtual environment If you have several packages you need to install, I would recommend using a simple
and
|
We cannot close the issue until I get a response from @shubhamg13 regarding comments #21575 (comment) and #21575 (comment) |
@mrclary, is it possible to detect if an external environment is universal or not on Mac? That way I think we could post your recommendations as a message in the console:
|
It is possible to detect whether the environment Python executable is x86_64, arm64, or Universal. It is possible to detect whether Spyder is running under Rosetta since
I'll reinvestigate building the standalone installer on arm64. As I recall, there was an issue because PyQt5 was not available in arm64. If I can build a native arm64 standalone, I think other issues may be resolved as well (#20201, #20629). We can discuss possible strategies for moving forward at our next developer meeting. |
@tomb1949, I've uploaded an arm64 build of Spyder 5.5.0 to our release page. This is a full standalone version, but built locally on my M1 iMac, using a universal/arm64 Python environment only. You may want to give that a try; this should not require any of the workarounds that I posted earlier. |
Wow, thank you. I will let you know how this works.
…On Sun, Jan 21, 2024 at 5:22 PM Ryan Clary ***@***.***> wrote:
@tomb1949 <https://github.com/tomb1949>, I've uploaded an arm64 build of
Spyder 5.5.0 to our release page. This is a full standalone version, but
built locally on my M1 iMac, using a universal/arm64 Python environment
only. You may want to give that a try; this should not require any of the
workarounds that I posted earlier.
https://github.com/spyder-ide/spyder/releases/download/v5.5.0/Spyder-arm64.dmg
—
Reply to this email directly, view it on GitHub
<#21575 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ATBPTTAGZHY656ESHQQK64LYPWIL3AVCNFSM6AAAAABAEDUE3OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMBSG44DKNJSHA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
Tom Barson
East Lansing, MI
|
Ryan: I realized that I never confirmed the solution on this issue. The
download works great! I appreciate the support from you and Carlos, and I
still kind of marvel at how things progressed from workaround to solution
to enhanced product. You don't see that every day. Regards, Tom Barson
…On Sun, Jan 21, 2024 at 5:22 PM Ryan Clary ***@***.***> wrote:
@tomb1949 <https://github.com/tomb1949>, I've uploaded an arm64 build of
Spyder 5.5.0 to our release page. This is a full standalone version, but
built locally on my M1 iMac, using a universal/arm64 Python environment
only. You may want to give that a try; this should not require any of the
workarounds that I posted earlier.
https://github.com/spyder-ide/spyder/releases/download/v5.5.0/Spyder-arm64.dmg
—
Reply to this email directly, view it on GitHub
<#21575 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ATBPTTAGZHY656ESHQQK64LYPWIL3AVCNFSM6AAAAABAEDUE3OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMBSG44DKNJSHA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
Tom Barson
East Lansing, MI
|
Thanks @tomb1949! Your appreciation is much appreciated 😁 |
I'm closing this issue due to inactivity. @shubhamg13, if you think this issue is not resolved, please reopen and respond to my comments #21575 (comment) and #21575 (comment). |
Ryan: Again, thank you. TB
…On Mon, May 13, 2024 at 1:39 PM Ryan Clary ***@***.***> wrote:
I'm closing this issue due to inactivity. @shubhamg13
<https://github.com/shubhamg13>, if you think this issue is not resolved,
please reopen and respond to my comments #21575 (comment)
<#21575 (comment)>
and #21575 (comment)
<#21575 (comment)>
.
—
Reply to this email directly, view it on GitHub
<#21575 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ATBPTTDABIR5P3WPWGNIXETZCD3DPAVCNFSM6AAAAABAEDUE3OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBYGM4DGMRSGA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
Tom Barson
East Lansing, MI
|
Description
What steps will reproduce the problem?
Traceback
Versions
Dependencies
The text was updated successfully, but these errors were encountered: