exoplanet-dev / exoplanet

Fast & scalable MCMC for all your exoplanet needs!
https://docs.exoplanet.codes
MIT License
206 stars 52 forks source link

Installation error in windows gcc exit status 1 with no sys/mman.h file #72

Closed Vital-Fernandez closed 4 years ago

Vital-Fernandez commented 4 years ago

I run the following commands to install exoplanet in a new anaconda environment:

conda create -n exoplanet_env python=3.7
conda activate exoplanet_env
python -m pip install --upgrade pip
conda install numpy astropy pymc3
python -m pip install -U exoplanet

And then I get:

(exoplanet_env) C:\Users\Vital>python -m pip install -U exoplanet
Collecting exoplanet
  Using cached https://files.pythonhosted.org/packages/7e/c6/a59b918455922c915e71d040cb0f069d0c6d2653d33f38e12d27c875c6c8/exoplanet-0.2.3-py2.py3-none-any.whl
Requirement already satisfied, skipping upgrade: pymc3>=3.5 in d:\programs\anaconda3\envs\exoplanet_env\lib\site-packages (from exoplanet) (3.7)
Requirement already satisfied, skipping upgrade: theano>=1.0.4 in d:\programs\anaconda3\envs\exoplanet_env\lib\site-packages (from exoplanet) (1.0.4)
Requirement already satisfied, skipping upgrade: astropy>=3.1 in d:\programs\anaconda3\envs\exoplanet_env\lib\site-packages (from exoplanet) (3.2.3)
Requirement already satisfied, skipping upgrade: numpy>=1.13.0 in d:\programs\anaconda3\envs\exoplanet_env\lib\site-packages (from exoplanet) (1.17.4)
Processing c:\users\vital\appdata\local\pip\cache\wheels\62\39\dd\45d51f03ee2b1c044c89fcf3a08cb0496734605d7b9ef4e5b6\rebound_pymc3-0.0.3-cp37-none-any.whl
Requirement already satisfied, skipping upgrade: h5py>=2.7.0 in d:\programs\anaconda3\envs\exoplanet_env\lib\site-packages (from pymc3>=3.5->exoplanet) (2.9.0)
Requirement already satisfied, skipping upgrade: patsy>=0.4.0 in d:\programs\anaconda3\envs\exoplanet_env\lib\site-packages (from pymc3>=3.5->exoplanet) (0.5.1)
Requirement already satisfied, skipping upgrade: tqdm>=4.8.4 in d:\programs\anaconda3\envs\exoplanet_env\lib\site-packages (from pymc3>=3.5->exoplanet) (4.40.2)
Requirement already satisfied, skipping upgrade: scipy>=0.18.1 in d:\programs\anaconda3\envs\exoplanet_env\lib\site-packages (from pymc3>=3.5->exoplanet) (1.3.2)
Requirement already satisfied, skipping upgrade: pandas>=0.18.0 in d:\programs\anaconda3\envs\exoplanet_env\lib\site-packages (from pymc3>=3.5->exoplanet) (0.25.3)
Requirement already satisfied, skipping upgrade: six>=1.9.0 in d:\programs\anaconda3\envs\exoplanet_env\lib\site-packages (from theano>=1.0.4->exoplanet) (1.13.0)
Collecting rebound>=3.10.1
  Using cached https://files.pythonhosted.org/packages/fc/c5/0bab299d215e9da2d93607344957e726ab29b2f13a86c0cf09b637bd48a0/rebound-3.12.1.tar.gz
Requirement already satisfied, skipping upgrade: python-dateutil>=2.6.1 in d:\programs\anaconda3\envs\exoplanet_env\lib\site-packages (from pandas>=0.18.0->pymc3>=3.5->exoplanet) (2.8.1)
Requirement already satisfied, skipping upgrade: pytz>=2017.2 in d:\programs\anaconda3\envs\exoplanet_env\lib\site-packages (from pandas>=0.18.0->pymc3>=3.5->exoplanet) (2019.3)
Building wheels for collected packages: rebound
  Building wheel for rebound (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: 'D:\Programs\Anaconda3\envs\exoplanet_env\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Vital\\AppData\\Local\\Temp\\pip-install-9vkxn_kd\\rebound\\setup.py'"'"'; __file__='"'"'C:\\Users\\Vital\\AppData\\Local\\Temp\\pip-install-9vkxn_kd\\rebound\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\Vital\AppData\Local\Temp\pip-wheel-u01p09vw' --python-tag cp37
       cwd: C:\Users\Vital\AppData\Local\Temp\pip-install-9vkxn_kd\rebound\
  Complete output (31 lines):
  fatal: not a git repository (or any of the parent directories): .git
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.7
  creating build\lib.win-amd64-3.7\rebound
  copying rebound\data.py -> build\lib.win-amd64-3.7\rebound
  copying rebound\horizons.py -> build\lib.win-amd64-3.7\rebound
  copying rebound\interruptible_pool.py -> build\lib.win-amd64-3.7\rebound
  copying rebound\particle.py -> build\lib.win-amd64-3.7\rebound
  copying rebound\plotting.py -> build\lib.win-amd64-3.7\rebound
  copying rebound\simulation.py -> build\lib.win-amd64-3.7\rebound
  copying rebound\simulationarchive.py -> build\lib.win-amd64-3.7\rebound
  copying rebound\tools.py -> build\lib.win-amd64-3.7\rebound
  copying rebound\units.py -> build\lib.win-amd64-3.7\rebound
  copying rebound\widget.py -> build\lib.win-amd64-3.7\rebound
  copying rebound\__init__.py -> build\lib.win-amd64-3.7\rebound
  copying rebound\rebound.h -> build\lib.win-amd64-3.7\rebound
  running build_ext
  building 'librebound' extension
  creating build\temp.win-amd64-3.7
  creating build\temp.win-amd64-3.7\Release
  creating build\temp.win-amd64-3.7\Release\src
  D:\Programs\Anaconda3\envs\exoplanet_env\Library\mingw-w64\bin\gcc.exe -mdll -O -Wall -DMS_WIN64 -DLIBREBOUND -Isrc -ID:\Programs\Anaconda3\envs\exoplanet_env\include -ID:\Programs\Anaconda3\envs\exoplanet_env\include -c src/rebound.c -o build\temp.win-amd64-3.7\Release\src\rebound.o -fstrict-aliasing -O3 -std=c99 -Wno-unknown-pragmas -DGITHASH=d15889dce6327b47ace8111b0b376361aba81ff9 -DLIBREBOUND -D_GNU_SOURCE -fPIC
  src/rebound.c:1:0: warning: -fPIC ignored for target (all code is position independent)
   /**
   ^
  src/rebound.c:33:22: fatal error: sys/mman.h: No such file or directory
  compilation terminated.
  error: command 'D:\\Programs\\Anaconda3\\envs\\exoplanet_env\\Library\\mingw-w64\\bin\\gcc.exe' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for rebound
  Running setup.py clean for rebound
Failed to build rebound
Installing collected packages: rebound, rebound-pymc3, exoplanet
    Running setup.py install for rebound ... error
    ERROR: Command errored out with exit status 1:
     command: 'D:\Programs\Anaconda3\envs\exoplanet_env\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Vital\\AppData\\Local\\Temp\\pip-install-9vkxn_kd\\rebound\\setup.py'"'"'; __file__='"'"'C:\\Users\\Vital\\AppData\\Local\\Temp\\pip-install-9vkxn_kd\\rebound\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Vital\AppData\Local\Temp\pip-record-uxwu9jsr\install-record.txt' --single-version-externally-managed --compile
         cwd: C:\Users\Vital\AppData\Local\Temp\pip-install-9vkxn_kd\rebound\
    Complete output (31 lines):
    fatal: not a git repository (or any of the parent directories): .git
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.7
    creating build\lib.win-amd64-3.7\rebound
    copying rebound\data.py -> build\lib.win-amd64-3.7\rebound
    copying rebound\horizons.py -> build\lib.win-amd64-3.7\rebound
    copying rebound\interruptible_pool.py -> build\lib.win-amd64-3.7\rebound
    copying rebound\particle.py -> build\lib.win-amd64-3.7\rebound
    copying rebound\plotting.py -> build\lib.win-amd64-3.7\rebound
    copying rebound\simulation.py -> build\lib.win-amd64-3.7\rebound
    copying rebound\simulationarchive.py -> build\lib.win-amd64-3.7\rebound
    copying rebound\tools.py -> build\lib.win-amd64-3.7\rebound
    copying rebound\units.py -> build\lib.win-amd64-3.7\rebound
    copying rebound\widget.py -> build\lib.win-amd64-3.7\rebound
    copying rebound\__init__.py -> build\lib.win-amd64-3.7\rebound
    copying rebound\rebound.h -> build\lib.win-amd64-3.7\rebound
    running build_ext
    building 'librebound' extension
    creating build\temp.win-amd64-3.7
    creating build\temp.win-amd64-3.7\Release
    creating build\temp.win-amd64-3.7\Release\src
    D:\Programs\Anaconda3\envs\exoplanet_env\Library\mingw-w64\bin\gcc.exe -mdll -O -Wall -DMS_WIN64 -DLIBREBOUND -Isrc -ID:\Programs\Anaconda3\envs\exoplanet_env\include -ID:\Programs\Anaconda3\envs\exoplanet_env\include -c src/rebound.c -o build\temp.win-amd64-3.7\Release\src\rebound.o -fstrict-aliasing -O3 -std=c99 -Wno-unknown-pragmas -DGITHASH=d15889dce6327b47ace8111b0b376361aba81ff9 -DLIBREBOUND -D_GNU_SOURCE -fPIC
    src/rebound.c:1:0: warning: -fPIC ignored for target (all code is position independent)
     /**
     ^
    src/rebound.c:33:22: fatal error: sys/mman.h: No such file or directory
    compilation terminated.
    error: command 'D:\\Programs\\Anaconda3\\envs\\exoplanet_env\\Library\\mingw-w64\\bin\\gcc.exe' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'D:\Programs\Anaconda3\envs\exoplanet_env\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Vital\\AppData\\Local\\Temp\\pip-install-9vkxn_kd\\rebound\\setup.py'"'"'; __file__='"'"'C:\\Users\\Vital\\AppData\\Local\\Temp\\pip-install-9vkxn_kd\\rebound\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Vital\AppData\Local\Temp\pip-record-uxwu9jsr\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.

I should just install linux in this machine but if anyone has encountered this issue I would love to hear your advice (merry xmas :)

dfm commented 4 years ago

This is actually falling while trying to install rebound before it even gets to exoplanet. So you could look there to see if you can find tips. Let's leave this issue open though because rebound is not a required dependency for all of exoplanet so we should make it possible to skip installation. It might work for you to try pip install --no-deps exoplanet for now but that might lead to more problems down the line.

Vital-Fernandez commented 4 years ago

Thank you Dan very much for your reply (and for this library).

I tried your suggestion. The command gave me:

(exoplanet_env) C:\Users\Vital>pip install --no-deps exoplanet
Requirement already satisfied: exoplanet in d:\programs\anaconda3\envs\exoplanet_env\lib\site-packages\exoplanet-0.2.4.dev6+g2171caa-py3.7.egg (0.2.4.dev6+g2171caa)

However, when I tried to import exoplanet:

In [1]: import exoplanet
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-1-4ba751a2f474> in <module>
----> 1 import exoplanet

D:\Programs\Anaconda3\envs\exoplanet_env\lib\site-packages\exoplanet-0.2.4.dev6+g2171caa-py3.7.egg\exoplanet\__init__.py in <module>
     10 ]
     11
---> 12 from . import distributions, gp, interp, orbits
     13 from .citations import CITATIONS
     14 from .estimators import *  # NOQA

D:\Programs\Anaconda3\envs\exoplanet_env\lib\site-packages\exoplanet-0.2.4.dev6+g2171caa-py3.7.egg\exoplanet\orbits\__init__.py in <module>
     12 from .dur_to_ecc import duration_to_eccentricity
     13 from .keplerian import KeplerianOrbit, get_true_anomaly
---> 14 from .rebound import ReboundOrbit
     15 from .simple import SimpleTransitOrbit
     16 from .ttv import TTVOrbit

D:\Programs\Anaconda3\envs\exoplanet_env\lib\site-packages\exoplanet-0.2.4.dev6+g2171caa-py3.7.egg\exoplanet\orbits\rebound.py in <module>
      4
      5 import theano.tensor as tt
----> 6 from rebound_pymc3.integrate import IntegrateOp as ReboundOp
      7
      8 from .constants import au_per_R_sun, day_per_yr_over_2pi

D:\Programs\Anaconda3\envs\exoplanet_env\lib\site-packages\rebound_pymc3-0.0.3-py3.7.egg\rebound_pymc3\integrate.py in <module>
     13 import theano.tensor as tt
     14
---> 15 from .build_utils import (
     16     get_compile_args,
     17     get_cache_version,

D:\Programs\Anaconda3\envs\exoplanet_env\lib\site-packages\rebound_pymc3-0.0.3-py3.7.egg\rebound_pymc3\build_utils.py in <module>
     14 import pkg_resources
     15
---> 16 import rebound
     17
     18 from .rebound_pymc3_version import __version__

ModuleNotFoundError: No module named 'rebound'

However, if it is a rebound library issue I shall investigate its requirements...

Vital-Fernandez commented 4 years ago

It seems rebound is actually not compatible with windows. From the documentation:

Note: If you want to run REBOUND on Windows, the best way is likely to install the Windows Subsystem for Linux. After installing the gcc compiler, e.g., sudo apt-get install gcc, you should be able to install REBOUND and any python libraries by following the Linux/Mac installation instructions in this documentation. Unfortunately we do not have Windows installations ourselves, so we cannot actively support installation problems. Thanks to Keto /Zhang for finding this workaround.

... so I better change OS :)

dfm commented 4 years ago

@Vital-Fernandez: I just published a new release that moves rebound to an optional dependency so:

python -m pip uninstall rebound_pymc3
python -m pip install -U exoplanet

should now do the trick for you. It should also be available for windows on conda-forge soon.

Vital-Fernandez commented 4 years ago

@Vital-Fernandez: I just published a new release that moves rebound to an optional dependency so:

python -m pip uninstall rebound_pymc3
python -m pip install -U exoplanet

should now do the trick for you. It should also be available for windows on conda-forge soon.

Thank you very much! I am going to test it right now!

Vital-Fernandez commented 4 years ago

@dfm So far all the tests I have run work fine 👍

Thanks a lot for your work.

shbhuk commented 4 years ago

Hi, Just checking regarding this. Despite rebound being pushed to the optional dependencies.. it will still be required to run the unit tests, right?

Just trying to diagnose the errors there and hence am wondering if this is the main cause.

dfm commented 4 years ago

Ah - good point! I believe that that is true. Let's open a new issue to move those to optional as well.