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

Add Mac OS specific installation instructions #12

Open
terotik opened this issue Apr 6, 2020 · 6 comments
Open

Add Mac OS specific installation instructions #12

terotik opened this issue Apr 6, 2020 · 6 comments

Comments

@terotik
Copy link
Contributor

terotik commented Apr 6, 2020

No description provided.

@billlyzhaoyh
Copy link

I am using Mac OS here and created a new conda env and download all the packages in the requirement.txt but not the apt-get packages.

This is the thing I got after reinstalling numpy (the version from the git throws error that the Apple Accelerate backend might be at fault)

Hope to have a Mac OS installation instruction soon so I can start playing around the model!

Error compiling Cython file:

...

cython: language_level=3

from numpy.random cimport bitgen_t
^

cythonsim/simrandom.pxd:2:0: 'numpy/random.pxd' not found

Error compiling Cython file:

...

cython: language_level=3

from numpy.random cimport bitgen_t
^

cythonsim/simrandom.pxd:2:0: 'numpy/random/bitgen_t.pxd' not found

Error compiling Cython file:

...
from numpy.random cimport bitgen_t

cdef class RandomPool:
cdef object gen
cdef bitgen_t *rng
^

cythonsim/simrandom.pxd:7:9: 'bitgen_t' is not a type identifier

Error compiling Cython file:

...
from numpy.random import PCG64
import numpy as np

from cpython.pycapsule cimport PyCapsule_IsValid, PyCapsule_GetPointer
from numpy.random cimport bitgen_t
from numpy.random.c_distributions cimport random_lognormal, random_gamma_f
^

cythonsim/simrandom.pyx:11:0: 'numpy/random/c_distributions.pxd' not found

Error compiling Cython file:

...
from numpy.random import PCG64
import numpy as np

from cpython.pycapsule cimport PyCapsule_IsValid, PyCapsule_GetPointer
from numpy.random cimport bitgen_t
from numpy.random.c_distributions cimport random_lognormal, random_gamma_f
^

@terotik
Copy link
Contributor Author

terotik commented Apr 7, 2020

@billlyzhaoyh just a quick note here that might help before we get the more official process in the documentation

Reina is using dev version of numpy that needs to be compiled, here's how I managed to get it done on Mac:

brew install libomp cmake gcc llvm redis
CC=/usr/local/opt/llvm/bin/clang++ python -m calc.simulation

Also you need to have redis cache running before launching the model

echo 'REDIS_URL=redis://' > .env
brew services start redis

@billlyzhaoyh
Copy link

The errors I encountered with the newest version of numpy is this:

RuntimeError: Polyfit sanity test emitted a warning, most likely due to using a buggy Accelerate backend. If you compiled yourself, see site.cfg.example for information. Otherwise report this to the vendor that provided NumPy.
RankWarning: Polyfit may be poorly conditioned

By tracking the changes on github this seems to be something that was added this version. Do you have any idea why?

@billlyzhaoyh
Copy link

I have fixed the numpy import problem by using openblas and I followed your instructions and used this command to execute with redis running:
CC=/usr/local/Cellar/llvm/10.0.0_1/bin/clang++ python -m calc.simulation

The error messages generated are attached below:
clang-10: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
/Users/billyzhaoyh/.pyxbld/temp.macosx-10.9-x86_64-3.7/pyrex/cythonsim/main.c:6939:13: warning:
code will never be executed [-Wunreachable-code]
__pyx_r = 0;
^
1 warning generated.
ld: unknown option: -platform_version
clang-10: error: linker command failed with exit code 1 (use -v to see invocation)
Traceback (most recent call last):
File "/Users/billyzhaoyh/anaconda/envs/simulation/lib/python3.7/distutils/unixccompiler.py", line 205, in link
self.spawn(linker + ld_args)
File "/Users/billyzhaoyh/anaconda/envs/simulation/lib/python3.7/distutils/ccompiler.py", line 910, in spawn
spawn(cmd, dry_run=self.dry_run)
File "/Users/billyzhaoyh/anaconda/envs/simulation/lib/python3.7/distutils/spawn.py", line 36, in spawn
_spawn_posix(cmd, search_path, dry_run=dry_run)
File "/Users/billyzhaoyh/anaconda/envs/simulation/lib/python3.7/distutils/spawn.py", line 159, in _spawn_posix
% (cmd, exit_status))
distutils.errors.DistutilsExecError: command '/usr/local/Cellar/llvm/10.0.0_1/bin/clang++' failed with exit status 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/billyzhaoyh/anaconda/envs/simulation/lib/python3.7/site-packages/pyximport/pyximport.py", line 215, in load_module
inplace=build_inplace, language_level=language_level)
File "/Users/billyzhaoyh/anaconda/envs/simulation/lib/python3.7/site-packages/pyximport/pyximport.py", line 191, in build_module
reload_support=pyxargs.reload_support)
File "/Users/billyzhaoyh/anaconda/envs/simulation/lib/python3.7/site-packages/pyximport/pyxbuild.py", line 102, in pyx_to_dll
dist.run_commands()
File "/Users/billyzhaoyh/anaconda/envs/simulation/lib/python3.7/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/Users/billyzhaoyh/anaconda/envs/simulation/lib/python3.7/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/Users/billyzhaoyh/anaconda/envs/simulation/lib/python3.7/site-packages/Cython/Distutils/old_build_ext.py", line 186, in run
_build_ext.build_ext.run(self)
File "/Users/billyzhaoyh/anaconda/envs/simulation/lib/python3.7/distutils/command/build_ext.py", line 340, in run
self.build_extensions()
File "/Users/billyzhaoyh/anaconda/envs/simulation/lib/python3.7/site-packages/Cython/Distutils/old_build_ext.py", line 195, in build_extensions
_build_ext.build_ext.build_extensions(self)
File "/Users/billyzhaoyh/anaconda/envs/simulation/lib/python3.7/distutils/command/build_ext.py", line 449, in build_extensions
self._build_extensions_serial()
File "/Users/billyzhaoyh/anaconda/envs/simulation/lib/python3.7/distutils/command/build_ext.py", line 474, in _build_extensions_serial
self.build_extension(ext)
File "/Users/billyzhaoyh/anaconda/envs/simulation/lib/python3.7/distutils/command/build_ext.py", line 559, in build_extension
target_lang=language)
File "/Users/billyzhaoyh/anaconda/envs/simulation/lib/python3.7/distutils/ccompiler.py", line 717, in link_shared_object
extra_preargs, extra_postargs, build_temp, target_lang)
File "/Users/billyzhaoyh/anaconda/envs/simulation/lib/python3.7/distutils/unixccompiler.py", line 207, in link
raise LinkError(msg)
distutils.errors.LinkError: command '/usr/local/Cellar/llvm/10.0.0_1/bin/clang++' failed with exit status 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/billyzhaoyh/anaconda/envs/simulation/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/Users/billyzhaoyh/anaconda/envs/simulation/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/Users/billyzhaoyh/Desktop/Simulation/reina-model/calc/simulation.py", line 8, in
from cythonsim import model
File "/Users/billyzhaoyh/Desktop/Simulation/reina-model/cythonsim/init.py", line 6, in
from . import main as model
File "/Users/billyzhaoyh/anaconda/envs/simulation/lib/python3.7/site-packages/pyximport/pyximport.py", line 462, in load_module
language_level=self.language_level)
File "/Users/billyzhaoyh/anaconda/envs/simulation/lib/python3.7/site-packages/pyximport/pyximport.py", line 231, in load_module
raise exc.with_traceback(tb)
File "/Users/billyzhaoyh/anaconda/envs/simulation/lib/python3.7/site-packages/pyximport/pyximport.py", line 215, in load_module
inplace=build_inplace, language_level=language_level)
File "/Users/billyzhaoyh/anaconda/envs/simulation/lib/python3.7/site-packages/pyximport/pyximport.py", line 191, in build_module
reload_support=pyxargs.reload_support)
File "/Users/billyzhaoyh/anaconda/envs/simulation/lib/python3.7/site-packages/pyximport/pyxbuild.py", line 102, in pyx_to_dll
dist.run_commands()
File "/Users/billyzhaoyh/anaconda/envs/simulation/lib/python3.7/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/Users/billyzhaoyh/anaconda/envs/simulation/lib/python3.7/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/Users/billyzhaoyh/anaconda/envs/simulation/lib/python3.7/site-packages/Cython/Distutils/old_build_ext.py", line 186, in run
_build_ext.build_ext.run(self)
File "/Users/billyzhaoyh/anaconda/envs/simulation/lib/python3.7/distutils/command/build_ext.py", line 340, in run
self.build_extensions()
File "/Users/billyzhaoyh/anaconda/envs/simulation/lib/python3.7/site-packages/Cython/Distutils/old_build_ext.py", line 195, in build_extensions
_build_ext.build_ext.build_extensions(self)
File "/Users/billyzhaoyh/anaconda/envs/simulation/lib/python3.7/distutils/command/build_ext.py", line 449, in build_extensions
self._build_extensions_serial()
File "/Users/billyzhaoyh/anaconda/envs/simulation/lib/python3.7/distutils/command/build_ext.py", line 474, in _build_extensions_serial
self.build_extension(ext)
File "/Users/billyzhaoyh/anaconda/envs/simulation/lib/python3.7/distutils/command/build_ext.py", line 559, in build_extension
target_lang=language)
File "/Users/billyzhaoyh/anaconda/envs/simulation/lib/python3.7/distutils/ccompiler.py", line 717, in link_shared_object
extra_preargs, extra_postargs, build_temp, target_lang)
File "/Users/billyzhaoyh/anaconda/envs/simulation/lib/python3.7/distutils/unixccompiler.py", line 207, in link
raise LinkError(msg)
ImportError: Building module cythonsim.main failed: ["distutils.errors.LinkError: command '/usr/local/Cellar/llvm/10.0.0_1/bin/clang++' failed with exit status 1\n"]

Do you know why clang++ is not executing in this case?

@jukvalim
Copy link
Collaborator

@terotic I added support for running with Docker here, which works fine with Mac OS as well other platforms: https://github.com/jukvalim/reina-model

I created a PR for it, just in case it's something you'd like to have.

@terotik
Copy link
Contributor Author

terotik commented Apr 17, 2020

Fantastic, thank you @jukvalim ! This is now merged.

Ping: @billlyzhaoyh

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

3 participants