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

Can't import Julia.Main due to architecture (M1 vs Intel) #532

Open
mberat opened this issue Jun 9, 2023 · 9 comments
Open

Can't import Julia.Main due to architecture (M1 vs Intel) #532

mberat opened this issue Jun 9, 2023 · 9 comments

Comments

@mberat
Copy link

mberat commented Jun 9, 2023

Hi,
I'm trying to get pyjulia up and running but coming across the following issues. Any help would be appreciated.
I have installed both Julia (1.9.1) and Python (3.10) for M1 chip. I will give the output from Julia.install() below.
When I try to run:
from julia import Main

I get the following error:
OSError: dlopen(/Applications/Julia-1.9.app/Contents/Resources/julia/lib/libjulia.1.9.dylib, 0x000A): tried: '/Applications/Julia-1.9.app/Contents/Resources/julia/lib/libjulia.1.9.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/System/Volumes/Preboot/Cryptexes/OS/Applications/Julia-1.9.app/Contents/Resources/julia/lib/libjulia.1.9.dylib' (no such file), '/Applications/Julia-1.9.app/Contents/Resources/julia/lib/libjulia.1.9.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))

My output from julia.install()

import julia
julia.install()
[ Info: Julia version info
Julia Version 1.9.1
Commit 147bdf428cd (2023-06-07 08:27 UTC)
Platform Info:
  OS: macOS (arm64-apple-darwin22.4.0)
  uname: Darwin 22.5.0 Darwin Kernel Version 22.5.0: Mon Apr 24 20:52:24 PDT 2023; root:xnu-8796.121.2~5/RELEASE_ARM64_T6000 x86_64 i386
  CPU: Apple M1 Pro: 
                 speed         user         nice          sys         idle          irq
       #1-10  2400 MHz     178375 s          0 s     105677 s    2108381 s          0 s
  Memory: 32.0 GB (327.453125 MB free)
  Uptime: 23966.0 sec
  Load Avg:  2.11083984375  2.26953125  2.78369140625
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-14.0.6 (ORCJIT, apple-m1)
  Threads: 1 on 8 virtual cores
Environment:
  PATH = /Users/m0a0hd6/Desktop/Ambient_Transition_Project/Julia_JuMP_Exploration/venv/bin:/Users/m0a0hd6/opt/anaconda3/bin:/Users/m0a0hd6/opt/anaconda3/condabin:/Applications/CPLEX_Studio_Beta211/cplex/bin/x86-64_osx:/opt/homebrew/bin:/opt/homebrew/sbin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/Library/Frameworks/Python.framework/Versions/3.8/bin:/Library/Frameworks/Python.framework/Versions/3.10/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/munki:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin
  MANPATH = /opt/homebrew/share/man::
  HOMEBREW_PREFIX = /opt/homebrew
  HOMEBREW_REPOSITORY = /opt/homebrew
  INFOPATH = /opt/homebrew/share/info:
  PYTHONPATH = /Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/third_party/thriftpy:/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev
  HOMEBREW_CELLAR = /opt/homebrew/Cellar
  XPC_FLAGS = 0x0
  HOME = /Users/m0a0hd6
[ Info: Julia executable: /Applications/Julia-1.9.app/Contents/Resources/julia/bin/julia
[ Info: Trying to import PyCall...
┌ Info: PyCall is already installed and compatible with Python executable.
│ 
│ PyCall:
│     python: /Users/m0a0hd6/Desktop/Ambient_Transition_Project/Julia_JuMP_Exploration/venv/bin/python
│     libpython: /Library/Frameworks/Python.framework/Versions/3.10/Python
│ Python:
│     python: /Users/m0a0hd6/Desktop/Ambient_Transition_Project/Julia_JuMP_Exploration/venv/bin/python
└     libpython: /Library/Frameworks/Python.framework/Versions/3.10/Python

@mkitti
Copy link
Member

mkitti commented Jun 10, 2023

Are your Python and Julia installs using the same architecture? Did you download arm64 versions of both?

@mberat
Copy link
Author

mberat commented Jun 12, 2023

Yes, I believe I did.
For Python (3.10) I downloaded and installed "macOS 64-bit universal2 installer"
For Julia (1.9.1) I downloaded and installed "macOS (Apple Silicon)"
Can't these be confirmed from the output I posted above?

@mkitti
Copy link
Member

mkitti commented Jun 12, 2023

No, because it seems that your Python install thinks it is running on an Intel processor.

@mberat
Copy link
Author

mberat commented Jun 12, 2023

Any suggestion as to how I can correct this?

@mkitti
Copy link
Member

mkitti commented Jun 12, 2023

Either tell me more about how you are running Python or download Julia for x86_64.

@mberat
Copy link
Author

mberat commented Jun 12, 2023

I'm using PyCharm, and creating a virtual environment using its environment/interpreter settings.

@mkitti
Copy link
Member

mkitti commented Jun 12, 2023

What if you use Python and pyjulia directly from the macOS terminal?

Perhaps PyCharm is running via Rosetta?

@mberat
Copy link
Author

mberat commented Jun 12, 2023

You were right! I ran the same code without using PyCharm using terminal and I don't get the error.
Interesting. I assume you wouldn't have any advice on making PyCharm to use the correct version?

@mkitti
Copy link
Member

mkitti commented Jun 12, 2023

My wild guess is that you want make sure to download the Apple Silicon version of PyCharm.

image

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

2 participants