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

Error on first run after new installation (Mac OS, f2py, arm64 CPU problem) #122

Closed
jan-eberhardt opened this issue Oct 31, 2023 · 14 comments
Assignees

Comments

@jan-eberhardt
Copy link

I installed the latest version on my machine (MacBook Pro M2, macOS 13.4.1) by Git-cloning and doing

pip install build
cd exostriker
python3 -m build
pip install .

in a new virtual environment with Python 3.11.0.

This worked without problems and installed all needed dependencies (including numpy 1.26.1). I installed gfortran version 12.1.0 and tried to run ExoStriker by just typing exostriker and ran into the following problem:

FileNotFoundError: [Errno 2] No such file or directory: '/opt/miniconda3/envs/exostriker/lib/python3.11/site-packages/exostriker/lib/RV_mod/rvmod/rvmod_for/.libs'

Abort trap: 6

However, there is no folder named 'rvmod_for' inside 'lib/RV_mod/rvmod'.
Help would be greatly appreciated!

@jan-eberhardt
Copy link
Author

The initial problem was located in exostriker/exostriker/lib/RV_mod/rvmod/__init__.py in f_compile().
It was checking the operating system to be Windows (if "win" in sys.platform:) but sys.platform is "darwin" in my case, so that triggered the Windows flag.
A hotfix from @3fon3fonov ( if "win" in sys.platform[0:3]:) fixed this issue but led to a different one on line 761 when trying to import rvmod_for:

ImportError: dlopen(/Users/eberhardt/Documents/PhD/WINE_paper_02/exostriker/exostriker/lib/RV_mod/rvmod/rvmod_for.cpython-311-darwin.so, 0x0002): tried: '/Users/eberhardt/Documents/PhD/WINE_paper_02/exostriker/exostriker/lib/RV_mod/rvmod/rvmod_for.cpython-311-darwin.so' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/eberhardt/Documents/PhD/WINE_paper_02/exostriker/exostriker/lib/RV_mod/rvmod/rvmod_for.cpython-311-darwin.so' (no such file), '/Users/eberhardt/Documents/PhD/WINE_paper_02/exostriker/exostriker/lib/RV_mod/rvmod/rvmod_for.cpython-311-darwin.so' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))

Abort trap: 6

which appears to be a problem related to the Apple Silicon chip.

@3fon3fonov 3fon3fonov changed the title Error on first run after new installation Error on first run after new installation (Mac OS, f2py problem) Oct 31, 2023
@3fon3fonov 3fon3fonov changed the title Error on first run after new installation (Mac OS, f2py problem) Error on first run after new installation (Mac OS, f2py, arm64 CPU problem) Oct 31, 2023
@3fon3fonov
Copy link
Owner

I wonder if this can be reproduced by NOT using Anaconda.... In the past, we had quite a lot of problems with the gfortran compiler that comes with Anaconda installation. The solution was to install system wide gfortran. People on MAC with M1 & M2 chips must test, I only have Intel based Mac's

@vvkrddy
Copy link

vvkrddy commented Nov 6, 2023

On an arm64 Mac, I installed Exostriker by cloning the repository and building it in an Anaconda environment with Python 3.11 installation. I get the following errors:

Click to see Traceback
(exostriker)$> exostriker
Traceback (most recent call last):
  File "/Users/username/anaconda3/envs/exostriker/bin/exostriker", line 5, in <module>
    from exostriker.gui import main
  File "/Users/username/anaconda3/envs/exostriker/lib/python3.11/site-packages/exostriker/__init__.py", line 1, in <module>
    from exostriker import gui
  File "/Users/username/anaconda3/envs/exostriker/lib/python3.11/site-packages/exostriker/gui.py", line 50, in <module>
    import RV_mod as rv
  File "/Users/username/anaconda3/envs/exostriker/lib/python3.11/site-packages/exostriker/lib/RV_mod/__init__.py", line 25, in <module>
    import celerite
  File "/Users/username/anaconda3/envs/exostriker/lib/python3.11/site-packages/celerite/__init__.py", line 29, in <module>
    from . import terms, solver, modeling
  File "/Users/username/anaconda3/envs/exostriker/lib/python3.11/site-packages/celerite/terms.py", line 18, in <module>
    from .solver import get_kernel_value, get_psd_value, check_coefficients
ImportError: dlopen(/Users/username/anaconda3/envs/exostriker/lib/python3.11/site-packages/celerite/solver.cpython-311-darwin.so, 0x0002): Library not loaded: @rpath/libc++.1.dylib
  Referenced from: <AA2C24F3-6060-32F7-A9D3-047FEAAB84FB> /Users/username/anaconda3/envs/exostriker/lib/python3.11/site-packages/celerite/solver.cpython-311-darwin.so
  Reason: tried: '/Users/username/anaconda3/envs/exostriker/lib/libc++.1.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/username/anaconda3/envs/exostriker/lib/libc++.1.dylib' (no such file), '/Users/username/anaconda3/envs/exostriker/lib/libc++.1.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/username/anaconda3/envs/exostriker/lib/libc++.1.dylib' (no such file), '/Users/username/anaconda3/envs/exostriker/bin/../lib/libc++.1.dylib' (no such file), '/Users/username/anaconda3/envs/exostriker/bin/../lib/libc++.1.dylib' (no such file)

I then installed gfortran using the conda-forge channel. I cannot find a 12.1.0 version mentioned by @jan-eberhardt but on installing 13.2.0 (latest available), I am able to open the exostriker GUI despite many warnings in shell.

@3fon3fonov
Copy link
Owner

3fon3fonov commented Nov 6, 2023

@vvkrddy But does the e.g., RV fitting works? Can you import a data set (you can find .vels files in the datafiles root directory), and tell what you see? You may get a lot of stdout/stderr output at first start, but the second one you should not get any warnings. Thus, any input you could provide is vital.

@vvkrddy
Copy link

vvkrddy commented Nov 6, 2023

@3fon3fonov On fitting, I can see the best-fit parameters in the stdout/stderr section of the GUI.

@3fon3fonov
Copy link
Owner

@vvkrddy, if there is no error on the stdout, and you see the fit and its best fit parameters, then you are all set! I would appreciate it if you share more details of your anaconda, gfortran, Python and OS system setup.

Cheers,
Trifon

@vvkrddy
Copy link

vvkrddy commented Nov 6, 2023

Conda version: 23.7.2
Python version: 3.11.0
GFortran version: 13.2.0
Platform: osx-arm64
OS: macOS 14.0

@jan-eberhardt
Copy link
Author

@vvkrddy Where did you get your Conda version from? I found installers specifically for arm64 but I have trouble installing them. They either tell me they're not compatible with my OS version of just produce an error during installation and leave an incomplete Conda installation

@vvkrddy
Copy link

vvkrddy commented Nov 6, 2023

@jan-eberhardt I used the M1 (command line) installer from the official Anaconda site.

@jan-eberhardt
Copy link
Author

When I try that I end up with this error:

# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<

    Traceback (most recent call last):
      File "/Users/eberhardt/anaconda3/lib/python3.11/site-packages/conda/exception_handler.py", line 17, in __call__
        return func(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^
      File "/Users/eberhardt/anaconda3/lib/python3.11/site-packages/conda/cli/main.py", line 64, in main_subshell
        exit_code = do_call(args, parser)
                    ^^^^^^^^^^^^^^^^^^^^^
      File "/Users/eberhardt/anaconda3/lib/python3.11/site-packages/conda/cli/conda_argparse.py", line 167, in do_call
        result = getattr(module, func_name)(args, parser)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Users/eberhardt/anaconda3/lib/python3.11/site-packages/conda/cli/main_init.py", line 36, in execute
        return initialize(
               ^^^^^^^^^^^
      File "/Users/eberhardt/anaconda3/lib/python3.11/site-packages/conda/core/initialize.py", line 137, in initialize
        run_plan_elevated(plan2)
      File "/Users/eberhardt/anaconda3/lib/python3.11/site-packages/conda/core/initialize.py", line 853, in run_plan_elevated
        result = subprocess_call(
                 ^^^^^^^^^^^^^^^^
      File "/Users/eberhardt/anaconda3/lib/python3.11/site-packages/conda/gateways/subprocess.py", line 108, in subprocess_call
        stdout, stderr = process.communicate(input=stdin)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Users/eberhardt/anaconda3/lib/python3.11/subprocess.py", line 1209, in communicate
        stdout, stderr = self._communicate(input, endtime, timeout)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Users/eberhardt/anaconda3/lib/python3.11/subprocess.py", line 2088, in _communicate
        input_view = memoryview(self._input)
                     ^^^^^^^^^^^^^^^^^^^^^^^
    TypeError: memoryview: a bytes-like object is required, not 'str'

Which again leaves an incomplete installation. The directory and files are there but I get a -bash: conda: command not found error when I try to use Conda.

@jan-eberhardt
Copy link
Author

I managed to install Anaconda / Conda correctly, by refusing the conda init command during installation, activating conda's base environment manually and updating my shell from bash to zsh. Now generally, Python / Conda works as intended but after a new installation of ExoStriker, and trying to run it, I get this:

Traceback (most recent call last):
  File "/Users/eberhardt/anaconda3/envs/exostriker/bin/exostriker", line 5, in <module>
    from exostriker.gui import main
  File "/Users/eberhardt/anaconda3/envs/exostriker/lib/python3.11/site-packages/exostriker/__init__.py", line 1, in <module>
    from exostriker import gui
  File "/Users/eberhardt/anaconda3/envs/exostriker/lib/python3.11/site-packages/exostriker/gui.py", line 13, in <module>
    from PyQt5 import QtCore, QtGui, QtWidgets, uic
ImportError: dlopen(/Users/eberhardt/anaconda3/envs/exostriker/lib/python3.11/site-packages/PyQt5/QtCore.abi3.so, 0x0002): Symbol not found: __ZTVNSt3__13pmr25monotonic_buffer_resourceE
  Referenced from: <645DDC2C-F655-324A-BE87-40804F3AC471> /Users/eberhardt/anaconda3/envs/exostriker/lib/python3.11/site-packages/PyQt5/Qt5/lib/QtCore.framework/Versions/5/QtCore
  Expected in:     <54E8FBE1-DF0D-33A2-B8FA-356565C12929> /usr/lib/libc++.1.dylib
(exostriker) eberhardt@mac-n-190 exostriker % 

@vvkrddy
Copy link

vvkrddy commented Nov 6, 2023

@jan-eberhardt Did you install gfortran in the conda env before running exostriker?

@3fon3fonov
Copy link
Owner

@vvkrddy, @jan-eberhardt, gfortran is not related to this error

    from PyQt5 import QtCore, QtGui, QtWidgets, uic
ImportError: dlopen(/Users/eberhardt/anaconda3/envs/exostriker/lib/python3.11/site-packages/PyQt5/QtCore.abi3.so, 0x0002): Symbol not found: __ZTVNSt3__13pmr25monotonic_buffer_resourceE
  Referenced from: <645DDC2C-F655-324A-BE87-40804F3AC471> /Users/eberhardt/anaconda3/envs/exostriker/lib/python3.11/site-packages/PyQt5/Qt5/lib/QtCore.framework/Versions/5/QtCore
  Expected in:     <54E8FBE1-DF0D-33A2-B8FA-356565C12929> /usr/lib/libc++.1.dylib

This seems to be a PyQt5 problem in MAC os, which should go to another thread. @jan-eberhardt if this is an MPIA laptop, I would suggest asking the IT people for help. Else, you need to seek solution for this issue on the internet, since this has nothing to do with the Exo-Striker installation. Of course, if you find a solution, one way or another, please let us know!

@3fon3fonov
Copy link
Owner

Since a fix to the initial problem was quickly provided, I will close this issue, but we still hope that @jan-eberhardt will share a solution in a separate tread.

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

4 participants