PRBEM / IRBEM

IRBEM-LIB provides routines to compute magnetic coordinates for any location in the Earth's magnetic field, to perform coordinate conversions, to evaluate geophysics/space-physics models, and to propagate orbits in time.
https://prbem.github.io/IRBEM/
Other
33 stars 14 forks source link

python wrappers in conda env #14

Closed claudepi closed 3 years ago

claudepi commented 3 years ago

@mshumko Do you have any experience installing the python wrappers when using conda environments? I ask because I am installing IRBEM on a new linux system and I always get nervous about using pip to install packages alongside conda. I was following your instructions for the python wrappers ("python3 -m pip install --user -e .") but I'm wondering whether I should do that inside of my standard conda env, or outside of it. Thoughts?

AntoineBrunet commented 3 years ago

I think providing a conda-forge package for IRBEM and the python wrapper would be a nice milestone and solve this issue nicely. I can have a look at it but of you want to do it @mshumko, do not hesitate.

Le jeu. 10 juin 2021 à 18:02, Seth C @.***> a écrit :

@mshumko https://github.com/mshumko Do you have any experience installing the python wrappers when using conda environments? I ask because I am installing IRBEM on a new linux system and I always get nervous about using pip to install packages alongside conda. I was following your instructions for the python wrappers ("python3 -m pip install --user -e .") but I'm wondering whether I should do that inside of my standard conda env, or outside of it. Thoughts?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/PRBEM/IRBEM/issues/14, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACK3OEDASAD3WIPRS4VYRTTSDO2FANCNFSM46O2KLCQ .

mshumko commented 3 years ago

@claudepi I do not have experience working with Conda, but in my limited research I found this thread that has some suggestions.

An alternate (better?) solution avoids pip, although it may have other consequences. These commands should get the wrapper installed with setuptools.

cd IRBEM/python
python3 setup.py develop

To be safe I would first install this inside a virtual environment.

@AntoineBrunet I agree that this is a worthwhile milestone. You're welcome to look at packaging it in Conda, however there are a few other steps we need to do first:

To put the wrapper on PyPI and Conda, we need it to compile the Fortran code as part of the automatic install. However, I've been wanting to update the Makefile to compile IRBEM on Mac and Windows before I seriously consider packaging the Python code. The biggest unknown for me is how the package and automatically compile the fortran code. The current python wrapper directory layout (with respect to the source folder) makes this unnecessarily hard. For me it is more of a question of time and motivation to chip away at these tasks.

claudepi commented 3 years ago

@mshumko Great, thanks Mike. I installed pip within my conda env like in the thread (conda install pip). Then, within my conda env, I ran your code to install the python wrappers (python3 -m pip install --user -e .). Luckily it did not want to install any new packages since all of the packages I had already installed in that env satisfied the requirements. This is good because that's where pip can break a conda env (by installing conflicting packages). I ran your tests ( IRBEM_tests_and_visualization.py and coords_tests_and_visualization.py) and the results looked good. Thanks! Note that I did not try the setuptools thing.

mshumko commented 3 years ago

@claudepi I am glad to hear that it installed without problems.

I purposefully kept the external packages to just numpy and scipy.

For future visitors: I've seen scipy break when it was installed by pip in a conda environment. I don't have a great solution to this except to only install scipy using conda.