:globe_with_meridians: :straight_ruler: Great Circle calculations for Python 2/3 using Vincenty's formulae: http://en.wikipedia.org/wiki/Vincenty's_formulae
MIT License
13
stars
7
forks
source link
Install fails if numpy is not already installed #3
I was trying to install pygc on a clean system using my own project's requirements.txt file as the source list of packages. This file list included numpy and pygc, among many others.
The install process fails when attempting to install pygc. The error reported is that numpy is not installed.
This problem seems to occur because when pip is collecting the installation requirements for all the packages I am installing, it imports the pygc setup.py which imports pygc which in turn imports numpy which is not yet installed. The pygc module is being imported in the setup.py file just to obtain the version string. This information could be obtained using a number different strategies that do not require the module to be installed. For example, in some of my projects I simply open the file (e.g. using open("pygc/__init__.py", 'r') and parse the contents to extract the version string. This would avoid requiring numpy to be installed just to import the setup.py to find that numpy is required.
To temporarily work around this chicken and egg style issue I have created two requirements.txt files that I run sequentially. The first contains numpy and the second contains pygc. This ensures that numpy is importable when pygc setup.py file is being run.
I was trying to install pygc on a clean system using my own project's requirements.txt file as the source list of packages. This file list included numpy and pygc, among many others.
The install process fails when attempting to install pygc. The error reported is that numpy is not installed.
This problem seems to occur because when pip is collecting the installation requirements for all the packages I am installing, it imports the pygc setup.py which imports pygc which in turn imports numpy which is not yet installed. The pygc module is being imported in the setup.py file just to obtain the version string. This information could be obtained using a number different strategies that do not require the module to be installed. For example, in some of my projects I simply open the file (e.g. using
open("pygc/__init__.py", 'r')
and parse the contents to extract the version string. This would avoid requiring numpy to be installed just to import the setup.py to find that numpy is required.To temporarily work around this chicken and egg style issue I have created two requirements.txt files that I run sequentially. The first contains numpy and the second contains pygc. This ensures that numpy is importable when pygc setup.py file is being run.