relic hook makes offline installation tricky
AldenJurling opened this issue · 4 comments
This block in setup.py
:
if not pkgutil.find_loader('relic'):
relic_local = os.path.exists('relic')
relic_submodule = (relic_local and
os.path.exists('.gitmodules') and
not os.listdir('relic'))
try:
if relic_submodule:
check_call(['git', 'submodule', 'update', '--init', '--recursive'])
elif not relic_local:
check_call(['git', 'clone', 'https://github.com/spacetelescope/relic.git'])
sys.path.insert(1, 'relic')
except CalledProcessError as e:
print(e)
exit(1)
makes it tricky to install pysiaf
in an offline environment. relic
is required during package installation, but is not otherwise declared as a dependency anywhere. If you don't do anything special, it will try to go down the git clone
path, which is of course not possible without internet access.
There are sort of two related issues in here: First, when collecting a set of requirements in your online environment for later deployment, relic
will not be collected automatically. Second, even if you have a wheel for relic
, pip
doesn't know it needs to install to install relic
before it can install pysiaf
.
I believe this is an example of the problem the build system requirements section of pyproject.toml
was intended to solve. If pysiaf
had a pyproject.toml
, it could read
[build-system]
requires = ["setuptools", "wheel", "relic"]
build-backend = "setuptools.build_meta"
which I think would cue pip
to do the right thing. However, I unfortunately I haven't worked on a project that uses pyproject.toml
or migrated my own to it, so I'm not 100% sure on how that works, or if any other changes to setup.py
or requirements declaration would be needed.
I've worked around the issue in my particular application by explicitly added relic
to my set of up requirements, and doing a first pip install
pass for setuptools wheel relic
, but it took a little exploration to understand the issue.
@mperrin, FYI, this indirectly impacts offline installation of webbpsf
through the pysiaf
dependency, which is what got me here. Fortunately the workaround isn't too hard.
@shanosborne see above from Alden.
Is relic
even still supported/maintained at this point? I think not, deprecated in favor of setuptools_scm. Maybe consider updating pysiaf to be more consistent with the current stsci-package-template and with how we do things elsewhere in webbpsf and poppy?
I am actually no longer a developer on pysiaf, so I'll pass this issue off to the new developer @mfixstsci
Hey All, I can take a look it this afternoon.
I think this was also solved with Issue #231 , but I'll test it before we close this.