fujiisoup / py3nj

Wigner's 3J, 6J, 9J symbols for python
https://py3nj.readthedocs.io/
Apache License 2.0
18 stars 5 forks source link

Fail to pip install py3nj when installing from requirements #17

Open yachmena opened 3 years ago

yachmena commented 3 years ago

Hello, I have a problem with my setup.py when py3nj is installed from requirements, it fails. I think the problem might be related to incorrectly defined dependencies in py3nj? Would be grateful if someone could help

fujiisoup commented 3 years ago

Thank you for raising the issue.

I think the problem might be related to incorrectly defined dependencies in py3nj?

Do you have any idea to fix this? A pull-request would be appreciated ;)

fujiisoup commented 3 years ago

I've tried to install richmol@develop on google colab https://colab.research.google.com/drive/1-PIEXzqm-9GrUwbqEkQGZxVDLFlqU_JS?usp=sharing but it looks installing all the the packages successfully, including py3nj.

yachmena commented 3 years ago

Thank you, the problem with py3nj for me actually appears in readthedocs, it looks like setup requires numpy

Collecting py3nj>=0.1.2 Downloading py3nj-0.1.2.tar.gz (28 kB) ERROR: Command errored out with exit status 1: command: /home/docs/checkouts/readthedocs.org/user_builds/richmol/envs/latest/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-8tj1seso/py3nj_8164107df62c40e4b1779b37a96fb977/setup.py'"'"'; file='"'"'/tmp/pip-install-8tj1seso/py3nj_8164107df62c40e4b1779b37a96fb977/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-nmb_yj7k cwd: /tmp/pip-install-8tj1seso/py3nj_8164107df62c40e4b1779b37a96fb977/ Complete output (5 lines): Traceback (most recent call last): File "", line 1, in File "/tmp/pip-install-8tj1seso/py3nj_8164107df62c40e4b1779b37a96fb977/setup.py", line 5, in from numpy.distutils.core import setup, Extension ModuleNotFoundError: No module named 'numpy'

fujiisoup commented 3 years ago

I see. I need to import numpy in py3nj/setup.py https://github.com/fujiisoup/py3nj/blob/15f179ecc21033022b05e27c681a1512e2b0e604/setup.py#L1-L5 to compile fortran codes.

(As you do in richmol/setup.py) https://github.com/CFEL-CMI/richmol/blob/830c1dee565f495d6c4691b15f0b749b94cdaa94/setup.py#L3

I think readthedoc tries to read the script before installing numpy, which causes the error. Do you have any idea?

fujiisoup commented 3 years ago

This looks relating, https://stackoverflow.com/questions/60045913/installing-numpy-before-using-numpy-distutils-core-setup

I will work for it but it may take time. PR would be really appreciated.

yachmena commented 3 years ago

Thanks a lot @fujiisoup for you efforts! I ended up moving "py3nj" from the requirements.txt to conf.py autodoc_mock_imports = ["mpi4py", "py3nj"] which solved the problem with RTD.