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

Juliaup interferes with PATH preventing python-jl from using rmg_env conda environment. #2730

Open
djlucey opened this issue Nov 13, 2024 · 2 comments

Comments

@djlucey
Copy link

djlucey commented Nov 13, 2024

Bug Description

Installation from source with Anaconda instructions don't seem to work on Apple silicon with JuliaUp installed.

How To Reproduce

Install JuliaUp and Conda and RMG.

The .zshrc file looks like

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/opt/anaconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/opt/anaconda3/etc/profile.d/conda.sh" ]; then
        . "/opt/anaconda3/etc/profile.d/conda.sh"
    else
        export PATH="/opt/anaconda3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda initialize <<<


# >>> juliaup initialize >>>

# !! Contents within this block are managed by juliaup !!

path=('/Users/my_username/.juliaup/bin' $path)
export PATH

# <<< juliaup initialize <<<

export PYTHONPATH=/Users/my_username/RMG-Py/:$PYTHONPATH
export PATH=/Users/my_username/RMG-Py/:$PATH
conda activate default%  

Before activating the rmg_env conda environment:

(base)% echo $PATH
/Users/my_username/RMG-Py/:/Users/my_username/.juliaup/bin:/opt/anaconda3/bin:/opt/anaconda3/condabin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/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

Notice Users/my_username/.juliaup/bin is near the front.
Then activate the conda environment with

(base)% conda activate /Users/my_username/miniforge3/envs/rmg_env

and after:

(rmg_env)% echo $PATH
/Users/my_username/RMG-Py:/Users/my_username/.juliaup/bin:/Users/my_username/miniforge3/envs/rmg_env/bin:/opt/anaconda3/condabin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/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

the /Users/my_username/.juliaup/bin stays in front of the /Users/my_username/miniforge3/envs/rmg_env/bin on the path, so that version of julia is used instead of the one in the RMG environment.

The one in the rmg_env was compiled with x86_64 and is compatible with python-jl etc.
The one in .juliaup is not.

As a consequence, running python-jl in the RMG environment gives the error:

% python-jl Precompiling PyCall... Info Given PyCall was explicitly requested, output will be shown live ERROR: LoadError: could not load library "/Users/my_username/miniforge3/envs/rmg_env/lib/libpython3.7m.dylib" dlopen(/Users/my_username/miniforge3/envs/rmg_env/lib/libpython3.7m.dylib, 0x0009): tried: '/Users/my_username/miniforge3/envs/rmg_env/lib/libpython3.7m.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/my_username/miniforge3/envs/rmg_env/lib/libpython3.7m.dylib' (no such file), '/Users/my_username/miniforge3/envs/rmg_env/lib/libpython3.7m.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64')). Please runPkg.build("PyCall")if your Python build has changed

Installation Information

Describe your installation method and system information.

  • OS (include version if known): Mac OS 15.1 on Apple M1 Pro chip
  • Installation method: from source with Anaconda (miniforge)
  • RMG version information:
    • RMG-Py: 3.2.0-362-g43d5bf89c
    • RMG-database: 3.2.0-113-g64dd3b60a

Additional Context

Manually removing /Users/my_username/.juliaup/bin from the path solves the problem.
But is there another way?

(issue drafted by @rwest)

@djlucey
Copy link
Author

djlucey commented Nov 13, 2024

A solution is to reorder things in the .zshrc putting anaconda after juliaup like this:



# >>> juliaup initialize >>>

# !! Contents within this block are managed by juliaup !!

path=('/Users/my_username/.juliaup/bin' $path)
export PATH

# <<< juliaup initialize <<<

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/opt/anaconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/opt/anaconda3/etc/profile.d/conda.sh" ]; then
        . "/opt/anaconda3/etc/profile.d/conda.sh"
    else
        export PATH="/opt/anaconda3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda initialize <<<


export PYTHONPATH=/Users/my_username/RMG-Py/:$PYTHONPATH
export PATH=/Users/my_username/RMG-Py/:$PATH
conda activate default

@JacksonBurns
Copy link
Contributor

The current installation instructions rely on using a julia binary from conda-forge (not the recommended install, but what we have working) - we are moving toward using juliaup in #2687 but it isn't ready yet. What prompted trying to use juliaup with the current version of RMG?

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